Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #models.py
- class Sales(models.Model):
- customer = models.ForeignKey("Customer")
- ctype = models.ForeignKey("Customer_type", verbose_name="Customer Type")
- #forms.py
- from django.utils.translation import ugettext_lazy as _
- class Sales_form(forms.ModelForm):
- class Meta:
- model = Sales
- fields = ('customer','ctype')
- error_messages = {
- 'ctype' : {
- 'required' : _("This field is required!")
- }
- }
- '''
- but the error still returns:
- {"ctype": ["This field is required!"]}
- What I want is like this
- {"Customer Type": ["This field is required!"]}
- '''
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement