|Reported by:||yaoheling@…||Owned by:||nobody|
|Component:||Database layer (models, ORM)||Version:||1.4|
|Has patch:||no||Needs documentation:||no|
|Needs tests:||no||Patch needs improvement:||no|
Description (last modified by kmtracey)
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?