Changes between Initial Version and Version 1 of Ticket #27976


Ignore:
Timestamp:
Mar 22, 2017, 1:49:53 AM (7 years ago)
Author:
Wim Feijen
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #27976 – Description

    initial v1  
    55       self.fields['lawyer'].label_from_instance = lambda obj: obj.userprofile.name
    66}}}
    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.
     7However, 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.
    88
    99Part of my code in more detail is here. I'm using UserProfiles because I find them way easier to understand than extended user models.
     
    2727        fields = ['group', 'name', 'email', 'vendor', 'customer', 'city', 'country', 'photo', 'tel', 'tel2', 'bar_city', 'bar_date_of_admission', 'lawyer']
    2828}}}
     29
     30The form is outputted as divs using crispy_forms
Back to Top