The Inspired
U have other way
Another way is to make another field in your model and not make that unique
Hello everyone
How can I customize my gunicorn logging with django?
By default when I run gunicorn It's not logging any request in console and I want to see my logs in console with gunicorn, how can I fix this?
EDIT:
When Debug is True, my django logging working correctly. but when I set Debug to False and run gunicorn it log nothing in console.
Kareem
If I want to practice writing more models.. i should write html forms first then map it to the models Right??
Ravikumar
Hi Everyone , HOW TO KEEP MODEL DATA UPDATE HISTORY IN DJANGO
.
.
Adithya
Hello everyone
i am getting error as : AttributeError: 'Manager' object has no attribute 'create_user'
but I have defined create_user function
class CustomUserManager(BaseUserManager):
def create_user(self, email, password= None, **extra_fields):
if not email:
raise ValueError('Email is require')
email = self.normalize_email(email)
user = self.model(email = email, **extra_fields)
user.set_password(password)
user.save()
return user
Adithya
though i defined why i am getting error
Adithya
please help me anyone
Adithya
class Users(AbstractUser):
username = None
id = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False)
email = models.EmailField(unique=True)
#password = models.CharField(max_length=20)
objects = CustomUserManager()
USERNAME_FIELD = 'email'
REQUIRED_FIELDS = []
def str(self):
return f"{self.email}"
Adithya
please help
Adithya
Error:
user= Library.objects.create_user(
AttributeError: 'Manager' object has no attribute 'create_user'
Jeet
What is integrity error
Kiarash
Adithya
Meme
A model instance (model 1) been saved and a function is called to create a instance on another model (model 2) with the ID of the model created (model 1) .
If I access the model instance of model 1 by ,
Model1.objects.latest('id')
Then create a new instance to model 2 .
Question : will any id mistach occurs if multiple users access the same functionality at the same time ?
DeViL
Any good YouTube channel to learn django
DeViL
Is searched a lot
DeViL
But you all are experienced person
So that's why I'm asking
DeViL
I only want to know any good paid or unpaid
Good course
DeViL
So I'm asking you to guide me
Igor
I have a ManyToMany relationship between two models A and B, and a model AB that is a table through which ManyToMany relationship is working. (let's say, model A have field bs = ManyToManyField('B', through='AB'))
I need to drop all entries in AB for a certain id from A. What is the best way to do it? Django docs propose doing it like this: some_a.bs.clear() but I am not sure if it is the best way, wouldn't it be better to do it like this:
AB.objects.filter(id=some_a.id).delete() And if not, why not?
Reis_969
Hi help me please why the form is not valid my cod
Reis_969
``` PRODUCT_QUANTITY_CHOICES = [(i, str(i)) for i in range(1, 21)]
class CartAddProductForm(forms.Form):
quantity = forms.TypedChoiceField(choices=PRODUCT_QUANTITY_CHOICES, coerce=int)
update = forms.BooleanField(required=False, initial=False, widget=forms.HiddenInput) ```
S
Can anyone help me, I'm writing query to get most bookmarked objects in django but when I'm trying to use serializer it's throwing error. How can I retrieve only required fields from django model instead all fields
Charly
S
ok tq i try that
Kiarash
Kiarash
S
https://dpaste.org/LdhX9 here is my code can anyone guide me where im doing wrong
Nazir
How to make a graph in graph
Anonymous
im getting this error : "Key 'slug' not found in 'CustomUserForm'. Choices are: date_joined, email, first_name, groups, is_active, is_staff, is_superuser, last_login, last_name, password, user_permissions, username."
while using slug . but couldnt find any reason
i just added slug field to model and prepopulated_field to admin site
prepopulated_fields = {"slug":['username']}
model:slug = models.SlugField(default='',null=True) but models is based on abstactuser , i thought maybe that is problem
Anonymous
can you hlp?
GoodOne
HI even though base dir is mentioned interpreter is looking static file under template
Anonymous
Shrey
Hello Everyone,
By default django servers run on http urls or IP Addresses. Currently my project is running on hosted ip_address How do we make the project run on https !?
I tried using django-sslserver, even have SSL Certificates and key. What are the other modifications required inside settings.py file !?
Charly
S
Hello, can anyone guide me... how can i get recently viewed objects in django ? is there any reference plz help me
Miriam
Good morning,
I am getting the following error and I do not know why, I have looked for possible reasons but none of the ones I have found seem to have to do with my case.. —>
A server error occurred. Please contact the administrator.
my settings.py it is: https://pastecode.io/s/4tapmw4y
Miriam
Miriam
Miriam
it is too generic an error for too many possibilities, it would have to be corrected because it does not disclose information and no error appeared in the terminal
Muبaّşir
How to write transaction history model for product and money
Help me pls
Anonymous
Anonymous
Your project is yours to handle
Adithya
Hii everyone
I have created AbstractUser for 3 users in project
while i am trying to create a user
by running this command
Library.objects.create_user(username='adithya', password='adi')
i am getting following error
raise TypeError("%s() got an unexpected keyword argument '%s'" % (cls.name, kwarg))
TypeError: Library() got an unexpected keyword argument 'username'
please help me guys
Adithya
SantiU
Hello! How to associate two Django users to the same data? one with write permission, and the other with read permission? Thankss
Meme
Adithya
ohh then how to create brother could you please explain
Meme
You could create users using django built in user model or a custom model that inherits from abstractuser
Adithya
Adithya
https://linkode.org/#JpJGwSZX8EhVJ6CbOHG0L
Adithya
Adithya
Meme
Instead it inherits from users
Adithya
okay but why iam getting error bro, how to solve it
Meme
To create a Library user right ?
Meme
It's hard for me to go back and forth with code 😜 .
Meme
I think you need to modify create user method of the customusermanager
Adithya
Ohh okay bro
Adithya
Tq
Adithya
Meme
def create_user(self, email, password=None, role=None, **extra_fields):
if not email:
raise ValueError('Email is required')
email = self.normalize_email(email)
user = self.model(email=email, role=role, **extra_fields)
user.set_password(password)
user.save()
if user.role == Users.Role.LIBRARY:
LibraryProfile.objects.create(user=user)
Meme
?
Pls lemme know if it works or not
Krishna
Hi I want learn django
Can any one teach me please