Firdaus
the way I explain to myself is "annotate in queryset" is kinda like "@property decorator on Model's method"
Firdaus
i don't answer DM, anything ask in public
Reza .
Hello I have a problem I wanted the (forgot my password) part of the site (password recovery) to work with both (email and phone number). I made CustomPasswordResetView which inherits from (PasswordResetView). token = default_token_generator.make_token(user) And with this line, I made a token and sent it to the user as a link But this link only works for people who only have a phone number in their account. And it doesn't work for these people (have only email, have email and phone number, don't have phone number and email) and when you click on the link it brings Bad Token page. Can anyone help?
Артем
I can not deploy the site on the hosting, please help
M. Hossein
I have a field in model model called followings like this: followings = models.ManyToManyField(         'self',         symmetrical=False,         help_text='Users to follow.',         related_name='followers',         blank=True,     ) In my model admin, I can change followings but I cannot see followers What can I do to have a followers list in my model admin?
M. Hossein
symmetrical=True should work
I don't want it to be symmetrical
Muflone
I don't want it to be symmetrical
then you have to create another relationship between the followers and the followings or a computed field
M. Hossein
then you have to create another relationship between the followers and the followings or a computed field
That's not what I'm looking for I think I can use a custom form for my admin page but don't know have to populate followers part of the form
Naggafin
does anyone have experience using the parameterized library?
Naggafin
I'm looking to get some clarification on its usage. I wrote a bunch of unit tests, and I'm using parameterized.expand to help with easily creating tests that have mostly the same code but different inputs. I was thinking I could stack the parameterized.expand decorator, like so: @parameterized.expand(['some', 'val'], name_func=lambda f, param_num, param_args: f"{f.__name__}_{param_args[0]") @parameterized.expand(['diff', 'other'], name_func=lambda f, param_num, param_args: f"{f.__name__}_{param_args[0]") def test_some_unit_test(self, one, two): .... this appears not to be the case however, as for the upper parameterized.expand decorator, I'm getting an error stating that NoneType has no attribute __name__ when accessing f.__name__ in the f-string. I have my intuition on why this is, but that's neither here nor there. is there any feasible way to stack expand decorators or the like without issue? I really would hate to have to collapse all my expand decs. that would be a pain in the ass
jūdê
In an interview they asked have you ever edited the controller. So am still little bit confused
What a framework like ASP .NET calls a controller is equivalent to what Django calls a View It uses MVC, Django uses MVT, The view in MVC is necessarily what the sees and the controller handles the input and interaction. But in Django, the Templates handle what the user sees and the views handle input and all. Just read into it a little bit more. People forget that software design patterns are not universal and forget to use the correct software design pattern for the framework/tool. I hope that clears up your confusion even a little a bit.
Dlight
Have you solved it
Yes mate thanks
Anonymous
https://linkode.org/#11NPYo5VL869PasBvIZxz4
Anonymous
amhaving this challenge below django.db.utils.IntegrityError: null value in column "patient_id" of relation "Emergency contact information" violates not-null constraint DETAIL: Failing row contains (Peace, Nice, goddey, on, 09134211243, Peace close, 2023-07-16 01:41:30.375929+00, 2023-07-16 01:41:30.375929+00, null, sister, /media/840_2dZLo1e.jpg).
Anonymous
that is the link to my code above
Supra
amhaving this challenge below django.db.utils.IntegrityError: null value in column "patient_id" of relation "Emergency contact information" violates not-null constraint DETAIL: Failing row contains (Peace, Nice, goddey, on, 09134211243, Peace close, 2023-07-16 01:41:30.375929+00, 2023-07-16 01:41:30.375929+00, null, sister, /media/840_2dZLo1e.jpg).
Any specific reason you are using ManyToMany field in your model? Quick observation looking at your code: 1) Avoid using upper cases in db_table. Django documentation specifies it could create problems with some databases like MySQL 2) Avoid using space when you specify db_table field. Replace space by underscore
Anonymous
Noted thanks but my issue is relationship to be specific one to one relationship
Anonymous
The parent I'd is not being filled in the child table thereby is giving me parent_id can not be null
Supra
I do not know the background of your use-case. But you can specify all the details like first, name, last name, etc in the Patient model. You can keep only the created and updated fields in your CommonField model.
Supra
So it is possible that a patient can have more than one emergency right? I think it your Emergency model should specify patient field as a ForeignKey to the Patient model
Anonymous
Am understand you and thanks just that the patient only have right to one emergency
Anonymous
That is why I specified it as one to one
Supra
Also I see you have specified unique=True in the Emergency model. Try changing it to primary_key=True. OneToOneField will have exactly the same number of records as that of the Patient model. So setting unique=True will not make sense.
Anonymous
My major challenge is that the Id from the parent table that is not being inherited in the child
Supra
Try changing your class from Emergency(CommonField) to Emergency(models.Model) and see if it fixes the problem.
Anonymous
ok but that will not make me achieve the objective
👑 Dharmzeey
ok but that will not make me achieve the objective
Sorry, what's the objective Because Emergency is inheriting from commonField, and it also has a patient field which is a one to one with Patient model that's also inheriting from commonfield
👑 Dharmzeey
Is there any reason for that
God
Hi. Can we create User model for admin authentication and Customer model for api authentication Issue that im facing is im not able to create jwt token for customer
Kumar Shreyansh
Hi How do you save an array of values from multiple checkboxes to a model? Also can you tell me which model field and form widget should be used? I used MultipleChoiceField with CheckboxSelectMultiple widget in the model form, but when it goes to the View, the if form.is_valid() condition returns None. I don't know how to tackle this one particular field. Please help!
tushar
Hi. Can we create User model for admin authentication and Customer model for api authentication Issue that im facing is im not able to create jwt token for customer
User model will be responsible for the token generation which will be configured in settings file. I am suggesting you if you want to create customer you can take is_cusomer field in user model insted of taking a separate model. Here you surely have to take an abstract base user inherited in your user model and have to configure the user model in settings file.
カカロット
how to use authenticate
Charly
how to use authenticate
https://docs.djangoproject.com/en/4.2/topics/auth/
Anonymous
My challenge is on one to one relationship the parent Id is not inherited it the child so it's giving me parent_id is null which is against the constrain
Rupesh
I am solved this problems
Doragonsureiyā
I am solved this problems
What are you talking about?
Bro
Hi i have problem i have TABLE with size 3_000_000 rows, and when i try cleanup it in docker its our of resources and just close container with exit code, how i can re write DELETE without any returned results? python Market.objects.filter( authors__isnull=True, books__isnull=True, visible=False).delete()
Bakhodir
class UserSerializer(serializers.ModelSerializer): def init(self, customer): self.customer = customer class Meta: ref_name = "user_serializers" fields = [ 'id', 'full_name', 'email', 'phone_number', 'address', ] model = User if not customer: fields.append('password')
M. Hossein
I have a MultipleChoiceField in my serializer. I want to send a pk from ViewSet to serializer through context and fill out my MultipleChoiceField choices dynamically. How can I do this?
Bakhodir
Maxim
__init__
but you have __int__ in your code
hamid
hellow I have this problem in one of my project
you can do it with only one table
hamid
password filed must be null and blank true
hamid
and in usermanager you had to check for customer canset none and other must be required in user manager functions for example like create_admin user and other sorry for English and I hope to help you
Dlight
Hey ya'll. Quick question how to make EmailField in Signup form , Required . In CBW?
Dlight
Lots of resources online for this
I tried all the Stackoberflow solutions , none is working
Cloud Service
Can you share the exact error you are getting
Dlight
Can you share the exact error you are getting
There is no error, in Signup form the email field Is optional , so user is not forced to input Email , how to make this Required as password
.
in which YouTube channel i can learn the framework of python django
.
who knowns about django
Supra
Hey ya'll. Quick question how to make EmailField in Signup form , Required . In CBW?
You can make this field as required = True in your forms.py. Even if the model field is optional, the user will be forced to enter an email in the form. Make sure add the form_class in your CBV.
.
ModuleNotFoundError: No module named 'django.contrib.staticfilestasks'
.
who know about this error
.
how can i solve this problem
Muflone
ModuleNotFoundError: No module named 'django.contrib.staticfilestasks'
you forgot a , in the settings between staticfiles and tasks
jūdê
ModuleNotFoundError: No module named 'django.contrib.staticfilestasks'
INSTALLED_APPS = [ …, “django.contrib.staticfiles”, “tasks”, …, ]
jūdê
in which YouTube channel i can learn the framework of python django
You can start with Dennis Ivy or Corey Schafer, they are both good teachers