Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Django 1.5 issue - new auth model - minor adjustment needed #6

Open
jensenbox opened this issue Nov 29, 2012 · 2 comments
Open

Django 1.5 issue - new auth model - minor adjustment needed #6

jensenbox opened this issue Nov 29, 2012 · 2 comments

Comments

@jensenbox
Copy link

Unhandled exception in thread started by <bound method Command.inner_run of <django.contrib.staticfiles.management.commands.runserver.Command object at 0x1ddb510>>
Traceback (most recent call last):
  File "/opt/rh/venv/src/django/django/core/management/commands/runserver.py", line 92, in inner_run
    self.validate(display_num_errors=True)
  File "/opt/rh/venv/src/django/django/core/management/base.py", line 281, in validate
    raise CommandError("One or more models did not validate:\n%s" % error_text)
django.core.management.base.CommandError: One or more models did not validate:
auth_remember.remembertoken: 'user' defines a relation with the model 'auth.User', which has been swapped out. Update the relation to point at settings.AUTH_USER_MODEL.
@jensenbox
Copy link
Author

I copied in the auth_remember folder in and change models.py:

Line 5 is now:

from django.conf import settings

and line 36 is now:

user = models.ForeignKey(settings.AUTH_USER_MODEL, related_name="remember_me_tokens")

@jensenbox
Copy link
Author

Separate issue: default date and time for the created column should use the django supplied now() function

Add the following:

from django.utils.timezone import now

and change the created column definition:

created = models.DateTimeField(editable=False, blank=True,  default=now())

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant