Opened 13 years ago
Closed 13 years ago
#18848 closed Cleanup/optimization (wontfix)
model/presentation separation
Description (last modified by ) ¶
I'm working through the tutorial and noticed the following snippet:
class Poll(models.Model): # ... def was_published_recently(self): return self.pub_date >= timezone.now() - datetime.timedelta(days=1) was_published_recently.admin_order_field = 'pub_date' was_published_recently.boolean = True was_published_recently.short_description = 'Published recently?'
All 3 attributes admin_order_field, boolean, and short_description seem to be related to how was_published_recently is presented in the admin interface. I guess there might be other such attributes in models.Model as well.
Maybe such attributes should be moved to admin.ModelAdmin
?
Thanks,
Heling
Change History (1)
comment:1 by , 13 years ago
Description: | modified (diff) |
---|---|
Resolution: | → wontfix |
Status: | new → closed |
Note:
See TracTickets
for help on using tickets.
Thanks for the suggestion. If we had to do it all over again, possibly we'd come up with a scheme where there admin-only stuff was not hung somewhat arbitrarily off of model methods. However at this point we cannot remove support for this way of doing it without massive backwards-incompatibility. And adding a "cleaner" way without removing the old way would, I think, be more confusing than helpful.