0
I’m developing an application with Djando
and Python
.
In models.py
, to create an object cliente
with a name, for example, I do the following:
class Cliente(models.Model):
nome = models.CharField(max_length=255)
in forms.py
I’ll tell you what:
class ClienteForm(forms.ModelForm):
class Meta:
fields = ('nome',)
widgets = {'nome': forms.TextInput(attrs={'class': 'form-control'}),}
labels = {'nome': _('Nome'),}
but how do I get this field instead of a text field to be a file .doc
?
I need to attach a word document to each client, something like this:
class Cliente(models.Model):
nome = models.CharField(max_length=255)
documento = models.DOCUMENTO.DOC