Opened 4 years ago
Last modified 4 years ago
#32977 closed Uncategorized
conditionalize Class Meta. I want to achieve something like this. How can i do it? — at Initial Version
| 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
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"]
Note:
See TracTickets
for help on using tickets.