Opened 3 years ago

Closed 3 years ago

#32977 closed Uncategorized (invalid)

conditionalize Class Meta. I want to achieve something like this. How can i do it?

Reported by: hellorahulnarang Owned by: nobody
Component: Uncategorized Version: 3.2
Severity: Normal Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description (last modified by Mariusz Felisiak)

        if self.name_format == "First name Last name":
            class Meta:       
                ordering = ['first_name', 'last_name']
        elif self.name_format == "Last name First name":
            class Meta: 
                ordering = ["last_name","first_name"]
        elif self.name_format == "Last name, First name":
            class Meta: 
                ordering = ["last_name","first_name"]
        else:
            class Meta:
                ordering = ["first_name","last_name"]

Change History (1)

comment:1 by Mariusz Felisiak, 3 years ago

Description: modified (diff)
Resolution: invalid
Status: newclosed

Please don't use Trac as a support channel. Closing per TicketClosingReasons/UseSupportChannels.

Note: See TracTickets for help on using tickets.
Back to Top