Anonymous
I guess he's created a customer user and saved password without using setPassword() method
Anonymous
User is created but password is not hashed
Axror
Hi there which is better FBV or CBV ? I can't use FBV where can i learn it
Axror
Gfg
🤷🏻‍♂🤷🏻‍♂ Can u be more specific
Anonymous
Geeks for geeks
Axror
Yeah got it
Mirco
I guess he's created a customer user and saved password without using setPassword() method
If he's using createsuperuser everything you have just said is not true
Axror
Mirco
For common tasks i use cbv
It depends on your needs. Sometime a small FBV is enough, most of times CBV is what you will use
Anonymous
Which errors specifically ?
Not a staff account
Dmitriy
What is the difference between using a TextChoices class and a choices argument in a field?
Axror
I don't know exactly bro
Axror
What is the difference between using a TextChoices class and a choices argument in a field?
But in choices in a chield field it's like an html rounds
Anonymous
If he's using createsuperuser everything you have just said is not true
after changing the AUTH MODEL to custom user... Create superuser will use the overridden sign-up/register view to create superuser
Mirco
What is the difference between using a TextChoices class and a choices argument in a field?
The first one allows u to define choices that you will pass into choices attribute Previously you had to use Enums Text choices are based on enums basically
Anonymous
How do @login_requerd work?
Mirco
How do @login_requerd work?
It checks if your user is authenticated or not The view is accessible if and only if the user is logged in
Leonardo
Guys, good morning. How to run tests using various PostgreSQL schemas? I'm running the command "./manage.py test model.test_views --keepdb" but when I look at the database "test_ *" it is missing the schemas, have only public schema, and the test get error because it doesn't find the schemas and your respectives entities. NOTE: my search_path in the connection string is already with all the schemas and working perfectly in Django Admin for category entities Environment: Django 3.1.4 Python 3.9 PostgreSQL 11
Rahul
How to get full url of image 127.0.0.1/images/user5.jpg
Axror
#question how to display some contents of webpage, for example edit and delete links, to the admin only?
𝖉𝖗𝖔𝖎𝖉𝖜𝖔𝖑𝖋 🐺
Hello... how can I use django to print receipts..... if user clicks a button then a receipt is printed
Anonymous
#question how to display some contents of webpage, for example edit and delete links, to the admin only?
Just put the content inside if block if user.is_superuser: ...content...
Axror
Just put the content inside if block if user.is_superuser: ...content...
Bro how to fix this problem? I can send messages to any types of emails but not to Gmail accounts?
Axror
EMAIL_BACKEND = ‘django.core.mail.backends.smtp.EmailBackend’ EMAIL_HOST = ‘smtp.gmail.com’ EMAIL_USE_TLS = True EMAIL_USE_SSL = False EMAIL_PORT = 587 EMAIL_HOST_USER = ‘your_account@gmail.com’ EMAIL_HOST_PASSWORD = ‘your account’s password’
Axror
This is the configuration, I also allowed less secure apps and 2 step verification key for this app
Leonardo
Anyone use TDD with PostgreSQL and multiple schemas?
Anonymous
Hello Please I have an HTML form in which a user selects a value from multiple values using HTML select tag. How can I get and process the selected item.. Thanks
マクスイム • グセブ
Hello Please I have an HTML form in which a user selects a value from multiple values using HTML select tag. How can I get and process the selected item.. Thanks
Use Django forms, I'm talking about forms.ChoiceField which allows you to create this HTML select and process data using form = <Your form class>(request.POST) if form.is_valid(): data = form.cleaned_data["field"] # do whatever you want
Anonymous
Place
Hello everyone, i am here to ask you (i searched in google before a lot but doesn't find anything) but i have a models.ImageFIeld but i would like that in my db everytime it saves a data, it saves the path to the file not only the name of the file saved by default with the .url attribute! thank you so much for your help!
Fred
Is there a way to convert your Django website to a mobile application
Fred
No
Ok thanks
Axror
author = models.ForeignKey( { only Superusers }, on_delete=models.CASCADE) How to only refer to superusers?
Axror
Please help me:)
Mirco
So that the author can be only superusers not all users
This check is not done inside the foreign key It's an object permission related to the Post model
Mirco
In Django they are called permissions and you have to handle it inside your views
Mr. Marlega
author = models.ForeignKey( { only Superusers }, on_delete=models.CASCADE) How to only refer to superusers?
Bro... U have to do it in views like u can create ur own decorators kinda things
Mirco
Bro... U have to do it in views like u can create ur own decorators kinda things
No need of custom decorators Django usually uses Mixins to check permissions
.
author = models.ForeignKey( { only Superusers }, on_delete=models.CASCADE) How to only refer to superusers?
U can try to use django signals and check if the user is a superuser by user.is_superuser and if he/she is create one author model for them (:
Mirco
U can try to use django signals and check if the user is a superuser by user.is_superuser and if he/she is create one author model for them (:
Absolutely not What he wanna do is just permissions check and the view is the place to do the check as Django docs explain well
հօรรεiռ
hi how i can add a custom relation in an installed app model for example i have a blog app and a magazine app and installed them via pip in venv then in my site i want to add a magazine_id field in my blog app i extend from blog model and add that relation but django make another table with that field but i need to update exciting table. how i can do it
...
How can i add placeholder for choises in modelform class?
Axror
U can try to use django signals and check if the user is a superuser by user.is_superuser and if he/she is create one author model for them (:
Thank you but I'm using my own custom user. So i tried to access superusers by this way, settings.AUTH_USER_MODEL.objects.filter(is.superuser) and get_usermodel().objects.filter(is.superuser), both of them didn't work. But with Built in User model, it all worked
mukul
How can i add placeholder for choises in modelform class?
COLOR_CHOICES = ( ('green','GREEN'), ('blue', 'BLUE'), ('red','RED'), ('orange','ORANGE'), ('black','BLACK'), ) class MyModel(models.Model): color = models.CharField(max_length=6, choices=COLOR_CHOICES, default=" ")
Umarjon
how to save data from html form to database using django?
Anonymous
i got error while using this code
Anonymous
cannot assign "'3'" :"Vendor.vendor" must be a "User
thenils
How can we do email verification
thenils
Need basic ideas
mukul
Need basic ideas
Use django-verify-email
Vinod
Hi all,how can I implement background tasks architecture without celery and rabbitmq?
Hello
You can use django-q and redis for message broker
Vinod
You can use django-q and redis for message broker
Thanks for response,I mean Without que and message broker architecture
Vinod
django-rq would be suffice for it
It is external package I Guess,i am thinking to do with cron jobs,what u say?
...
Anyone good knowledge of Django dm me.Need some help.
Lucid
Hi! Does anyone know how to import data from excel file in data base in django framework
Harsh
Django-import-export
Lucid
Have I to run the query ?
Harsh
Checkout the docs for this libraru
Harsh
You just have to import it from admin panel
Lucid
Okay got it
Doragonsureiyā
Oo... Thanks
You're welcome! 😊
Forouzan
Hi friends. Could you please tell me how can i create a comment form in single page?!