Only admin can create an object from a model

2017-08-14 Thread Prithviraj Mitra
I want the admin only to create a object from a model. Is it possible? #EmailAddress.objects.create(user=instance, email=instance.email) >From models.py class EmailAddress(models.Model): user = models.OneToOneField(User, unique=True, related_name ='address') email = models.EmailField()

Assertionerror because of custom user model and django allauth

2017-08-12 Thread Prithviraj Mitra
I am a fresher in django(version - 1.10). I am using allauth app in the frontend for registration. I am getting an error in the frontend while signing up. assert not EmailAddress.objects.filter(user=user).exists() AssertionError

Re: How to insert a row in another table once a user is created

2017-08-12 Thread Prithviraj Mitra
ilAddress.objects.create(user=instance, verified=False) > > Otherwise the EmailAddress class seems to be unrelated to anything, > which does not make sense for a relational database. > > On Friday, 11 August 2017 20:32:01 UTC+2, Prithviraj Mitra wrote: >> >> I am a fresher in

Re: How to insert a row in another table once a user is created

2017-08-12 Thread Prithviraj Mitra
> Otherwise the EmailAddress class seems to be unrelated to anything, > which does not make sense for a relational database. > > On Friday, 11 August 2017 20:32:01 UTC+2, Prithviraj Mitra wrote: >> >> I am a fresher in django. I am using django 1.10 with allauth app which >&

Re: How to insert a row in another table once a user is created

2017-08-12 Thread Prithviraj Mitra
he EmailAddress class seems to be unrelated to anything, > which does not make sense for a relational database. > > On Friday, 11 August 2017 20:32:01 UTC+2, Prithviraj Mitra wrote: >> >> I am a fresher in django. I am using django 1.10 with allauth app which >> takes car

How to insert a row in another table once a user is created

2017-08-11 Thread Prithviraj Mitra
I am a fresher in django. I am using django 1.10 with allauth app which takes care of frontend registration, sending user confirmation email,validation, login with email etc. So it all works in the frontend. In the backend I managed to change the user creation form by adding an extra field

module object has no attribute after using different version of Python

2017-08-05 Thread Prithviraj Mitra
I have both versions python 2.7 and 3.4 installed. I am using some code which is developed under 2.7 but I am using under 3.4. So after compiling using the following command python manage.py runserver I get the following error - File "C:\pyprojects\focus\site\general\forms.py", line 26, in