#15984 closed New feature (wontfix)
model fields options in Meta class
Reported by: | Matt Harasymczuk | Owned by: | nobody |
---|---|---|---|
Component: | Database layer (models, ORM) | Version: | |
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
Move model fields options, such as:
- blank=BOOL
- null=BOOL
- auto_add=BOOL
- auto_add_now=BOOL
- db_index=BOOL
and others boolean options to Meta class of this model.
It would make model fields more readable and human friendly.
it works for unique_together
why not to add:
unique = ('name', 'login', 'ssn')
db_index = ('name', 'login')
auto_add = ('signup_date', )
auto_add_now = ('last_mod', )
null = ('comment', 'first_name')
read_only = () # editable=False
... and so on ...
It was discussed at 2011-05-06 at Django-dev
Note:
See TracTickets
for help on using tickets.
In the discussion thread, there is a -1 from a core dev, a +1 from the community and some loosely-related talk.
From a practical point of view:
Based on these elements, I think this ticket falls in the "Django could be designed differently" bucket and I'll mark it as wontfix (it could be re-opened if the discussion on django-developers continues and Alex changes his mind).