Teutranian
it has obviously
Teutranian
I m doing this looking at the source code
Mirco
Teutranian
https://github.com/django/django/blob/master/django/contrib/auth/models.py#L132
Mirco
Why don't you follow the documentation ?
It's ok to read the source code but no needed this time
Mirco
The documentation is pretty clear about extending User model
Teutranian
https://docs.djangoproject.com/en/3.1/topics/auth/customizing/#a-full-example?
Mirco
Mirco
Mirco
You can also follow
https://simpleisbetterthancomplex.com/tutorial/2016/07/22/how-to-extend-django-user-model.html
Teutranian
oops tht correct , thanks Mirco
Mirco
Doragonsureiyā
Teutranian
I don't know y I made that silly mistake
Mirco
Shreehari
print(request.data["date_slot_requested"] < datetime.today().strftime("%Y-%m-%d"))
is printing as True for {
"date_slot_requested": "2020-01-10"
}
I want to make sure that the requested date is not a past date. Am i doing something wrong ?
Mirco
Teutranian
Teutranian
https://www.programiz.com/python-programming/datetime/current-datetime
Shreehari
Shreehari
Teutranian
but first from datetime import date
Shreehari
got it 👍
Mirco
it's actually date.
Yes but the main problem is that he's trying to compare strings and not date objects.
This is what you @cult_of_kosmos have to understand
Teutranian
I couldn't find anything like datetime.today()
Hemraj
Teutranian
Mirco
Teutranian
for @cult_of_kosmos 's problem
Shreehari
Fixed it, thank you all for the help
Shreehari
Mirco
Doragonsureiyā
Teutranian
https://dpaste.org/YGDs#L46 can you also tell what's wrong woth the migrations?
Teutranian
I want to segregate users in three groups.
Teutranian
I copied a snippet from stackoverflow and put it in the already created migrations. But the Groups.objects.all() is empty
Mirco
Did u migrate it ?
ken
hi. need some suggestions on how to deliver different landing pages for different user groups in django
how and where to put the logic.
Mirco
Mirco
ken
ken
sure, I'll have a look.
Teutranian
I m totally noob with migrations
Mirco
Mirco
Data migration are irreversible
Teutranian
Running migrations:
No migrations to apply.
Teutranian
Teutranian
I can experiment without hazard until I 'm working on this dummy data
Teutranian
hmm, is there any good django gotham or some conferencce video on migrations concept?
Mirco
https://simpleisbetterthancomplex.com/tutorial/2017/09/26/how-to-create-django-data-migrations.html
Teutranian
didn't I do the same thing?
Teutranian
created a function and ran makemigrations and migrate
Teutranian
understanding the whole migrations would require me to make few more projects.
Mirco
Usually the process is to create the empty migration, write the function to be passed to the RunPython
In this way Django will recognize the migration to be ran
Teutranian
do you mean shift that function to an empty file?
Teutranian
ok I can do that
âshîsh
I currently work on function based views. I want to switch into class based views.
I know both has it's own advantages. But still I want to know that is it a wise decision to learn class based views and use it over function based views ??
Asking helpful replies (based on your own experienced, not copy paste from Google)
Thanks in advanced
🤩🤩
Mirco
Mirco
0x31c4ae1
Teutranian
dependencies = [
('auth', '0012_alter_user_first_name_max_length'),
] y is auth being used here?
h
Teutranian
oops I switched back to a previous commit and forgot to set it in settings.py, the base.User model
Teutranian
no luck
âshîsh
Abdulboriy Alimov (Abdulboriy Ibn Abdulxay Ibn Sharif Al-Uzbek)
Can you suggest any repo in git to look and learn from django codes ?
UnoNumero04
Hi
Can u give me this course plz ...
Thank you
Teutranian
https://dpaste.org/DWju
Teutranian
can I get some help with this error? I think the groups got created. But in the shell that long strange traceback is there while importing and checking Group.objects.all().
Mr. COwO2 Preis
https://www.django-rest-framework.org/api-guide/serializers/#writing-update-methods-for-nested-representations
def update(self, instance, validated_data):
owner = validated_data.pop('owner')
instance.owner_id = owner.id
return instance
i'm currently trying this, but the owner in my case is just empty, so i get this error:
'collections.OrderedDict' object has no attribute 'id'
someone knows what i'm doing wrong?
full code:
https://del.dog/aimostobal.txt
Teutranian
ok problem solved