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
Fauzaan一
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?
Muflone
Cloud Service
👑 Dharmzeey
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.
Vishnu
Dlight
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
Anonymous
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
God
カカロット
how to use authenticate
Anonymous
Anonymous
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
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()
Hoshyar
Muflone
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')
Bakhodir
Maxim
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
Bakhodir
Bakhodir
hamid
hamid
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?
Cloud Service
Cloud Service
Can you share the exact error you are getting
.
in which YouTube channel i can learn the framework of python django
.
who knowns about django
Cloud Service
.
ModuleNotFoundError: No module named 'django.contrib.staticfilestasks'
.
who know about this error
.
how can i solve this problem
hamid
Muflone
jūdê
jūdê
.
.