Friday, October 5, 2012

Re: Virtualenvs and editing contrib stuff manually

Hi Russel.  Thanks again for your help.  I guess "recommend" was the wrong word to use.  I just mean it's how the docs tell you to do it.

But instead of doing it this way, I just created a new class like this
class MyUser(User)
with all the additional fields I wanted, which allows me to use all the auth stuff for logging in etc. and it seems to make forms easier.  It just felt cleaner at the time, but the more I think about it I wonder if there might be a reason why this might be bad practice. For example, I don't like how creating a new MyUser object makes duplicates in the "MyUsers" and "Users" sections of the admin.  I haven't tried it, but it seems to me this will still be the case if I were to use the foreign key method.

What I was trying to do was have Users for the site administrators, and MyUsers for site "members", while still taking advantage of all the built-in contrib.auth stuff.  I would think that this scenario is common enough that there is a standard way of dealing with it.

On Thursday, September 27, 2012 4:13:34 PM UTC-4, Tundebabzy wrote:
No you won't be smitten.

As for isolating your edited django, you can do that but then you
would have to be responsible for improving the code base by yourself.
Also, your edit might inadvertently break django or introduce bugs
that you might find difficult to trace and solve or that might change
some of the logic required to make django work.

On 9/27/12, Chris Pagnutti <chris.p...@gmail.com> wrote:
> Hi.  First-time poster here.  Feel free to point out any rules I'm not
> following.
>
> I've been looking around for how to make the django.contrib.auth User
> classe's "email" field to be unique and required.  There are bunches of
> ways to do it, but it's just soooo darn easy to go into the source and
> change how the field is defined.
> e.g. email = models.EmailField(_('email address'),unique=True)
>
> But in my searches, I've read warnings that you should not do this.  The
> reason, if it is given, is that you'll break your app if you update the
> contrib packages.  But what if I work in virtualenvs and just leave the
> django version and packages intact for that particular app in that
> particular environment?  What are the other practical and philosophical
> reasons for NOT editing the contrib source?  Will I be smitten from the
> django community if I do so?
>
> Thanks to all.
>
> --
> 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/-/YX9X8u9mdbwJ.
> To post to this group, send email to django...@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>

--
Sent from my mobile device

--
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/-/GuC5W4mN7qIJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate