In an authentication backend I'm currently writing, I've supplied a custom
User model that extends the contrib.auth User model. I have the need to
allow email addresses to be NULL.

A little context: I'm writing an OAuth2 wrapper for an OAuth2 client I
relatively recently wrote (yes, I know that there are other clients already
written out there, but I'm writing this one due to being quite partial to
my module ;)). Some OAuth2 providers don't provide user e-mail addresses,
regardless of scope params. All providers however, provide some form of a
user ID. As you can't simply use field hiding in Django models, I figure
that I can achieve this by one of the following two methods:

1. Copy/paste the entire model, changing the attribute of the one field.
2. User._meta.fields[4].null = true

#2, even though seemingly hacky at best seems to be the lesser of the two
evils as it at least keeps things DRY (and is potentially far less
maintenance down the road).

My question is, is there another method of achieving this that I'm not
seeing? Preferably one that *isn't* hacky?

Thanks,
Demian

-- 
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.

Reply via email to