0

Using django 10 and postgres 9.4.

After the website full setup I noticed that I cannot create new objects from my applications, default django apps like users are OK.

ran makemigrations and migrate afterwords, and when re trying it says nothing to migrate. To make it simple: When entering django shell and typing

from users.models import *
User.objects.all()
Out[3]: [<User: root>]

but :

UserProfile.objects.all()
Out[4]:
<repr(<django.db.models.query.QuerySet at 0x39b4610>) failed: django.db.utils.ProgrammingError: relation "users_userprofile" does not exist
LINE 1: ...."is_superuser", "users_userprofile"."wight" FROM "users_use...
                                                             ^

UserProfile is my site users with onetoone to django.contrib.auth

class UserProfile(models.Model):
    user = models.OneToOneField(User)

Thanks

2
  • 3
    What happens if you run makemigrations <yourappname>? Commented Aug 30, 2016 at 15:10
  • that did the trick :) thanks, thought i did it earlier Commented Aug 30, 2016 at 15:17

1 Answer 1

-3

you must import the django.setup before doing the operation:

import django
django.setup()
Sign up to request clarification or add additional context in comments.

1 Comment

out of context.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.