Teutranian
it has obviously
Teutranian
I m doing this looking at the source code
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
https://github.com/django/django/blob/master/django/contrib/auth/models.py#L132
The code is not telling u what you did. BaseUserManager has no that method.
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
Doragonsureiyā
oops tht correct , thanks Mirco
You're welcome! 😊
Teutranian
I don't know y I made that silly mistake
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 ?
h
Done sir, sorry for bothering you again. The mistake I did was I have to change the default name of the html file otherwise it will take from the django. Thank you for all your support.
Update, if someone was following this. This will not lead you to write answer, for this you have to change the extension from html to txt, in case if you are using django-rest-auth,not sure of dj-rest-auth. Thanks for all your support and guidance.
Teutranian
https://www.programiz.com/python-programming/datetime/current-datetime
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
Hello...please I need help integrating stripe to django
https://testdriven.io/blog/django-stripe-tutorial/
Mirco
Update, if someone was following this. This will not lead you to write answer, for this you have to change the extension from html to txt, in case if you are using django-rest-auth,not sure of dj-rest-auth. Thanks for all your support and guidance.
Nope, it's not mandatory. HTML and text are to versions of templating It's the same for overriding normal Django registration email templates , it's not related to some packages If your code works only with this change, maybe there is something wrong with your code or the package
Teutranian
for @cult_of_kosmos 's problem
Shreehari
Fixed it, thank you all for the help
Teutranian
https://testdriven.io/blog/django-stripe-tutorial/
https://github.com/dj-stripe/dj-stripe/blob/master/README.md
Doragonsureiyā
Fixed it just now Thank you
You're welcome! 😊
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
hi. need some suggestions on how to deliver different landing pages for different user groups in django how and where to put the logic.
Into the view, you have to check if the user is part of a group and if so return different template
ken
Into the view, you have to check if the user is part of a group and if so return different template
thanks for the response, so I have an accounts app for account related operations, and the main app. should I direct from the account app itself (after login) or forward to the main app views.
Mirco
thanks. any suggestions for best practices in django ?
Buy and read 2 Scoops of Django book for best practices
ken
sure, I'll have a look.
Teutranian
Did u migrate it ?
Migrations show no changes detected
Teutranian
I m totally noob with migrations
Mirco
Migrations show no changes detected
I mean migrate not makemigrations
Mirco
I m totally noob with migrations
Don't do data migration by copy and pasting from StackOverflow if you don't know what they are
Mirco
Data migration are irreversible
Teutranian
Running migrations: No migrations to apply.
Teutranian
I can experiment without hazard until I 'm working on this dummy data
Mirco
Running migrations: No migrations to apply.
Because you have to create an empty migration to use data migration
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 🤩🤩
Teutranian
dependencies = [ ('auth', '0012_alter_user_first_name_max_length'), ] y is auth being used here?
h
Nope, it's not mandatory. HTML and text are to versions of templating It's the same for overriding normal Django registration email templates , it's not related to some packages If your code works only with this change, maybe there is something wrong with your code or the package
That's what i was thinking it's totally strange , this might be the bug, actually this package is not maintained since last 1.5 years because i followed every step clearly. I'll try to perform it using dj-rest-auth and we will see
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
Does anyone except you actually use function based views in real projects?
Many of like me use. & We make satisfactory apps on function based views in IoT, private chats & API callings
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