Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ProgrammingError at / relation does not exist

I can not find answer in other places. (Sorry for asking again but)

what is wrong? Did anyone have such an error?

ProgrammingError at /register/ relation "user_user" does not exist LINE 1: SELECT (1) AS "a" FROM "user_user" WHERE "user_user"."userna...

I extended user abstract model and error saying no relation When i extend user in sqlite3 no errors such this but postgre is full databse error

 class User(AbstractUser):
    social_username = models.CharField(max_length=100, null=True, blank=True)

views.py

def registration(request):
    if request.method == 'POST':
        form = RegisterUserForm(request.POST)
        if form.is_valid():
            form.save()
            username = form.cleaned_data.get('username')
            raw_password = form.cleaned_data.get('password1')
            user = authenticate(username=username, password=raw_password)
            login(request, user)
            messages.success(request,'You were successfully registered  %s' % user.first_name)
            return HttpResponseRedirect('/')
        messages.error(request, 'Something went wrong while authenticating')
        return render(request, 'project/register.html', {'form': form})

    else:
        form = RegisterUserForm()
        return render(request, 'project/register.html', {'form': form})

settings.py

AUTH_USER_MODEL = 'user.User'
like image 304
Adam Smith Avatar asked Aug 11 '26 07:08

Adam Smith


1 Answers

Not sure why this error occurs but you could just run this command and you are good to go without losing your data.

python manage.py migrate --run-syncdb
like image 81
Shubham Dodeja Avatar answered Aug 13 '26 05:08

Shubham Dodeja