django-custom-user

Custom users with django allauth

[亡魂溺海] 提交于 2019-12-11 00:04:26
问题 I am trying to use a custom user with django-allauth/social auth In settings.py, I have AUTHENTICATION_BACKENDS = ( # Needed to login by username in Django admin, regardless of `allauth` "django.contrib.auth.backends.ModelBackend", # `allauth` specific authentication methods, such as login by e-mail "allauth.account.auth_backends.AuthenticationBackend", ) SOCIALACCOUNT_PROVIDERS = \ {'facebook': {'SCOPE': ['email', 'user_likes', 'user_status', 'user_about_me', 'basic_info', 'read_stream'],

TypeError: create_superuser() missing 1 required positional argument: 'profile_picture'

我是研究僧i 提交于 2019-12-07 13:53:19
问题 I get the following error after adding the profile_picture field: TypeError: create_superuser() missing 1 required positional argument: 'profile_picture' This profile_picture field is an "ImageField" set as "Null = True". I have tried the following: def create_user(...., profile_picture=None, ....) . It didn't work. and the error occurs only in command prompt when i create superuser from there. Here is my models.py from django.db import models from django.contrib.auth.models import

heroku: relation “auth_group” does not exist

随声附和 提交于 2019-12-07 12:30:59
问题 I'm facing problem while doing syncdb on heroku. I have a custom user model and when I try to sync,heroku gives this error. django.db.utils.ProgrammingError: relation "auth_group" does not exist I tried python manage.py makemigrations but nothing is getting resolved. Help me find the solution. 回答1: I just had a similar problem. It seems that the auth module should be the first module to migrate but for some reason that isn't happening. All what I did to solve this was ./manage.py migrate auth

How to solve error raised : No module named 'django.contrib.customuser'

江枫思渺然 提交于 2019-12-06 06:26:22
I am new to Django, trying to create a custom user for my project. When I am running the server, it raises No module named 'django.contrib.customuser' and sometimes, Manager isn't available; auth.User has been swapped for Mysite.CustomUser. Even i changed my settings: django.contrib.auth to django.contrib.custommuser. Please someone help me solving this. Here's my code models.py: from datetime import datetime from django.db import models from django.contrib.auth.models import User, BaseUserManager, AbstractUser, AbstractBaseUser from django.utils.translation import ugettext_lazy as _ class

TypeError: create_superuser() missing 1 required positional argument: 'profile_picture'

戏子无情 提交于 2019-12-06 03:14:44
I get the following error after adding the profile_picture field: TypeError: create_superuser() missing 1 required positional argument: 'profile_picture' This profile_picture field is an "ImageField" set as "Null = True". I have tried the following: def create_user(...., profile_picture=None, ....) . It didn't work. and the error occurs only in command prompt when i create superuser from there. Here is my models.py from django.db import models from django.contrib.auth.models import BaseUserManager, AbstractBaseUser class UserManager(BaseUserManager): def create_user(self, email, full_name,

django-allauth: custom user generates IntegrityError at /accounts/signup/ (custom fields are nulled or lost)

陌路散爱 提交于 2019-12-03 20:15:02
问题 I'm trying to integrate django-allauth with a custom user model (subclassed AbstractUser, but when I test the signup form I get an integrity error due to field (date_of_birth) being null, but the value submitted was u'1976-4-6' I'm learning the new custom user stuff, as well as class-based views as I'm learning django-allauth, so I'm confident that I'm doing something wrong, but after a couple days of reading the github issues, the few tutorials, readthedocs, and stackoverflow questions I

Modify response from Django REST API using CustomUserModel extending default User Model and API classes

天涯浪子 提交于 2019-12-02 06:46:25
I have a Django Project with CustomUserModel. I have extended Django default RegisterView with my CustomRegisterView, and also created CustomLoginView by extending LoginView. Everything works fine, data too get saved with custom fields, and while loging in and registering, I get a "key" in response, but I want to customize response of both the APIs with additional fields such as primary key value and a result_flag which will be either 0 or 1. My CustomRegisterSerializer class is defined as- class CustomRegisterSerializer(RegisterSerializer): email = serializers.EmailField() password1 =

Django 1.7 data migration for custom user model

故事扮演 提交于 2019-11-30 20:58:54
问题 I have created a custom user model for my project. I have written a data migration file to copy contents of auth.User to my new custom user table. It doesn't seem to work properly. It is throwing below error, from django.db import migrations, transaction @transaction.atomic def copy_old_users(apps, schema_editor): User = apps.get_model("auth", "User") CustomUser = apps.get_model("custom_auth", "User") fields = ['id', 'username', 'email', 'first_name', 'last_name', 'is_staff', 'is_active',

django-allauth: custom user generates IntegrityError at /accounts/signup/ (custom fields are nulled or lost)

て烟熏妆下的殇ゞ 提交于 2019-11-30 15:11:21
I'm trying to integrate django-allauth with a custom user model (subclassed AbstractUser, but when I test the signup form I get an integrity error due to field (date_of_birth) being null, but the value submitted was u'1976-4-6' I'm learning the new custom user stuff, as well as class-based views as I'm learning django-allauth, so I'm confident that I'm doing something wrong, but after a couple days of reading the github issues, the few tutorials, readthedocs, and stackoverflow questions I still have no clear idea of what I'm doing wrong (well I know one thing I'm doing wrong: trying different

Django Creating a Custom User with the Django Rest Framework

为君一笑 提交于 2019-11-29 23:32:52
问题 I'm trying to create a custom user using the Django Rest Framework. I got it to the point to where I can create a regular user, but I'm unsure on how to extend it to the custom user model. models.py: from django.db import models from django.contrib.postgres.fields import ArrayField from django.contrib.auth.models import User class UserProfile(models.Model): user = models.OneToOneField(User, on_delete=models.CASCADE) languages = ArrayField(models.CharField(max_length=30, blank=True))