There's actually quite a good reason why you can't override model field in
Subclasses in the general case - the parent model actually creates a table
of its own. In the case of abstract parents this should be possible, even
without an override flag. I'm not sure if there are some difficulties in
tracking whether the field was defined in an abstract model or not, which
may explain why it is currently not possible, but I think this would be the
correct flavour of patch to allow you to do what you think you should be
able to.

In the mean time, I can only suggest copying and pasting the AbstractUser
class...
On 1 Jun 2013 09:13, "Chris Wilson" <[email protected]> wrote:

> Hi all,
>
> Regarding ticket #7220 
> <https://code.djangoproject.**com/ticket/7220<https://code.djangoproject.com/ticket/7220>>,
> this is bugging me at the moment. I share a database with a non-django app,
> and need to insert test data, and having to set last_login to something is
> annoying.
>
> I understand @SmileyChris' point that there are no migrations (yet) in
> core, so this is a bit difficult to fix. However I have a proposal:
>
> I tried to fix this myself by overriding last_login in our custom user
> class, and got this error:
>
>     FieldError: Local field 'last_login' in class 'IschoolUser' clashes
>     with field of similar name from base class 'AbstractUser'
>
> I propose that we allow overriding fields, with a safety mechanism: it's
> required to add an "override=True" attribute to the field. Users who want
> to change an existing field must add this attribute to the new field in
> their subclass, and manage any migrations or database changes themselves.
> That removes the responsibility from Django to manage it, which currently
> it can't.
>
> What do you say? If this sounds like a good idea I can work up a patch.
> That would enable a sensible workaround for ticket #7220 (override the
> field and add south to your project) which isn't currently possible.
>
> Cheers, Chris.
> --
> Aptivate | http://www.aptivate.org | Phone: +44 1223 967 838
> Future Business, Cam City FC, Milton Rd, Cambridge, CB4 1UY, UK
>
> Aptivate is a not-for-profit company registered in England and Wales
> with company number 04980791.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django developers" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to 
> django-developers+unsubscribe@**googlegroups.com<django-developers%[email protected]>
> .
> To post to this group, send email to 
> django-developers@**googlegroups.com<[email protected]>
> .
> Visit this group at http://groups.google.com/**
> group/django-developers?hl=en<http://groups.google.com/group/django-developers?hl=en>
> .
> For more options, visit 
> https://groups.google.com/**groups/opt_out<https://groups.google.com/groups/opt_out>
> .
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/django-developers?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to