Right. There's currently no way to enforce required=True at the database
level.
I honestly don't mind whether Django decides to do this or not, since I
can always hack our local tree to enforce this at the database level,
but I thought it's an idea worth discussing. In my case, I found a
couple of stray records with empty strings in columns where that wasn't
supposed to happen, so enforcing it at the database level for me is a
worthwhile safety concern.
There are obviously questions about whether this idea is generally
applicable, and whether it can be implemented across all the backends.
I'm just happy that I understand why the Oracle driver now coerces all
fields to be null=True, even though that's not suitable for the project
I'm working on. (Yay open source :).
On 6/19/2012 6:06 PM, Kurtis Mullins wrote:
So you're trying to, basically, enforce "required=True" at the
database-level?
On Tue, Jun 19, 2012 at 7:23 PM, Ian <ian.g.ke...@gmail.com
<mailto:ian.g.ke...@gmail.com>> wrote:
On Monday, June 18, 2012 5:59:27 PM UTC-6, André Pang wrote:
What I'd like to do is (1) disallow NULLs, and (2) disallow
empty strings. It looks like there's no current way to do
this with Oracle since the backend overrides null to always be
True, and blank is an admin validation thing only.
There's also no current way* to do this AFAIK with postgresql,
mysql, or sqlite. I'm not opposed to the feature request, but if
we're going to do it, then I think it should be universal, not
just for Oracle. For the other backends I suppose a CHECK
constraint would be required.
Cheers,
Ian
* Of course with any backend there is the option of writing custom
DDL and running it instead of or in addition to syncdb.
--
You received this message because you are subscribed to the Google
Groups "Django users" group.
To view this discussion on the web visit
https://groups.google.com/d/msg/django-users/-/GbrE1zMU3N4J.
To post to this group, send email to django-users@googlegroups.com
<mailto:django-users@googlegroups.com>.
To unsubscribe from this group, send email to
django-users+unsubscr...@googlegroups.com
<mailto:django-users%2bunsubscr...@googlegroups.com>.
For more options, visit this group at
http://groups.google.com/group/django-users?hl=en.
--
You received this message because you are subscribed to the Google
Groups "Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/django-users?hl=en.
--
You received this message because you are subscribed to the Google Groups "Django
users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/django-users?hl=en.