Changes between Initial Version and Version 1 of Ticket #27976
- Timestamp:
- Mar 22, 2017, 1:49:53 AM (8 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Ticket #27976 – Description
initial v1 5 5 self.fields['lawyer'].label_from_instance = lambda obj: obj.userprofile.name 6 6 }}} 7 However, when obj has no userprofile, the code does not raise an Exception, as expected, but fails silently and the field disappears . I find this dangerous and would just expect the field to raise an Exception, so I can fix it, instead of causing abnormalities.7 However, when obj has no userprofile, the code does not raise an Exception, as expected, but fails silently and the field disappears from the form output. I find this dangerous and would just expect the field to raise an Exception, so I can fix it, instead of causing abnormalities. 8 8 9 9 Part of my code in more detail is here. I'm using UserProfiles because I find them way easier to understand than extended user models. … … 27 27 fields = ['group', 'name', 'email', 'vendor', 'customer', 'city', 'country', 'photo', 'tel', 'tel2', 'bar_city', 'bar_date_of_admission', 'lawyer'] 28 28 }}} 29 30 The form is outputted as divs using crispy_forms