Mirco
CSRF Token.
different domains, u cannot u have to rely on JWT by using httpOnly cookies
Lena
different domains, u cannot u have to rely on JWT by using httpOnly cookies
So, do you have any other suggestions for this? I don't think that just using JWT is very good for security.
cj
So do I need to define Cookie with React on the client?
if you're building a REST API you shouldn't rely on cookies
cj
So, do you have any other suggestions for this? I don't think that just using JWT is very good for security.
JWT was made exactly to share information with security in mind, why do you think it's not good for that?
Lena
JWT was made exactly to share information with security in mind, why do you think it's not good for that?
If the JWT Access Token is compromised, can't it be abused? That's why using CRSF Token seemed like a good solution to me.
cj
you don't rely on cookies with APIs
Abdulrasheed
Not sure if I get you correctly, but have you tried using the safe filter? This should make the results display the styled content instead of pure html. Like this: {{ styled_text|safe }}
What i mean is that it is only displaying the html part of the documents if a word is in bold tag the word will be bold normal but the stilyes is not there eg. the css part
Yazan
hello after I extended my user with abstractuser model when I create a new user the password isn't getting hashed and the user can't login any more any help?
cj
Because i thought that jinja2 is required.
required for what exactly? is there any edge case you can't achieve with DTL that you really need to use jinja2 instead?
Yazan
I'm Using abstractuser do u mean the opposite?
Doragonsureiyā
hello after I extended my user with abstractuser model when I create a new user the password isn't getting hashed and the user can't login any more any help?
Please provide a full explanation including all the details that you consider relevant. Your statement is too broad and there is no clear way to answer you, you have to explain: - what you're doing - what you're expecting - what you're using - where you're running the script - what Python version you're using - what packages and their versions you're using - and the most important thing: show the code YOU wrote (read rule 5️⃣ for that) and more details, that way your chances to get help will increase
Yazan
I'm Using djoser in my rest api app and I've added a phone number field into my new modified user model to put it instead of username field to login with password and phone number
Yazan
I'm not updating my password
Yazan
I tried to create a user then logging in it was created but I wasn't able to login
Nima
Just create new view for only password to change or create by User.set_password(password) DRF is not do that by this way
Vasily
required for what exactly? is there any edge case you can't achieve with DTL that you really need to use jinja2 instead?
No, I don't have any reason to use jinja2, I thought it is required for django, but now I see that I was wrong. Thx for the advice.
cj
No, I don't have any reason to use jinja2, I thought it is required for django, but now I see that I was wrong. Thx for the advice.
yeah, jinja2 is an alternative template language inspired in DTL that can be used combined with other frameworks that need to render an HTML template, like Flask, yes you can use jinja2 with Flask... and Django just added support to it just in case ¯\_(ツ)_/¯ but if you don't have a really strong/good reason to replace DTL with jinja2, just don't
.
The documentation seems to recommend using AbstractBaseUser, describing it as “The easiest way to construct a compliant custom user model..” Can you share why AbstractUser might be a better choice instead? I’ve been using AbstractUser myself from following a tutorial though, but unsure why that’s also a popular choice. https://docs.djangoproject.com/en/4.1/topics/auth/customizing/#specifying-a-custom-user-model
Jayanthi
how to use pagination for a query set for post methord
Jayanthi
like retriving data from multiple data set
Kush
How to write pytest for login page in django?
Lena
Hi, in DRF i ise JWTAuthentication but it doesn't logout. The Access Token I sent after logging out is working, is there a way to prevent this? I put the token on the blocklist.
Kene
It's not expired reason why it works.
Himanshu
When I uploaded excel file in filed using celery it gives error. Value too long for type character varying (100) and also using ma_lenght in field
Himanshu
What I d0?
Jayanthi
hi i need help for pagination
Doragonsureiyā
hi i need help for pagination
No one can help you until you explain your difficulties.
Jayanthi
quey pagination
Saleque
How to use long poll in django
Saleque
I mean Long Polling
Vladimir
Hi all. When I run command "python3 manage.py makemigrations <my_app_name>" I get error "ModuleNotFoundError: No module named 'accounts'". What could be the problem?
Vladimir
"accounts" module is not in the same directory as your manage.py file
accounts module is not my app, thats the Dhango standard module
SantiU
python manage.py migrate --run-syncdb
Vladimir
python manage.py migrate --run-syncdb
thx. The same error and traceback: Traceback (most recent call last): File "manage.py", line 21, in <module> main() File "manage.py", line 17, in main execute_from_command_line(sys.argv) File "/usr/lib/python3/dist-packages/django/core/management/__init__.py", line 381, in execute_from_command_line utility.execute() File "/usr/lib/python3/dist-packages/django/core/management/__init__.py", line 357, in execute django.setup() File "/usr/lib/python3/dist-packages/django/__init__.py", line 24, in setup apps.populate(settings.INSTALLED_APPS) File "/usr/lib/python3/dist-packages/django/apps/registry.py", line 91, in populate app_config = AppConfig.create(entry) File "/usr/lib/python3/dist-packages/django/apps/config.py", line 90, in create module = import_module(entry) File "/usr/lib/python3.8/importlib/__init__.py", line 127, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "<frozen importlib._bootstrap>", line 1014, in _gcd_import File "<frozen importlib._bootstrap>", line 991, in _find_and_load File "<frozen importlib._bootstrap>", line 973, in _find_and_load_unlocked ModuleNotFoundError: No module named 'accounts'
SantiU
AUTHENTICATION_BACKENDS = ( 'django.contrib.auth.backends.ModelBackend', )
SantiU
anyone host Django in windows iis?
SantiU
I already have this in settings.py
mmm is not the best practice but you can remove the migrations and pycache folders
KD
How to(customize) add button in jazzmin admin panal.
S
Hi does anyone know the best practices when downloading and uploading files. Do i store the file names in an SQL database and the file itself in a folder.
S
I want the user to click a button and the file pops up in a new tab or it downloads.
Rishabh
I want the user to click a button and the file pops up in a new tab or it downloads.
Pass the download url directly on button href It will trigger download
C
Anyone have python web development course?
Mohammad
Can any of my friends help me to learn Django? I am a beginner
Doragonsureiyā
Can any of my friends help me to learn Django? I am a beginner
Looking for Django tutorials? you can follow these three recommended ones: * Official documentation and tutorial * Tutorial from MDN * Tutorial from django-girls
~
Guys, is it possible to use celery without docker?
~
yes
thanks
👨🏻‍💻
Hello everybody. Is it possible to filter a queryset with a model that has a OneToOneField to the user model by permissions to have permission in the user model?
👨🏻‍💻
This is not clear, to me at least
There is a profiles model with a OneToOneField to the User model. Each user is tied to a specific group with its own permissions. Can I filter queryset from profiles models by permission?
👨🏻‍💻
Double "_" seems to be applied to the fields of the linked model during filtering. Will it work to permissions?
👨🏻‍💻
Profile.objects.filter(user__in=[obj.id for obj in User.objects.all() if obj.has_perm('permission')]) Will it works?
A
Hi guys 👋🏻 What is the best way to optimize images for Django website ?:)
ibraheem
Hello, I have two fields, a field for the academic stage and a field for the class. I want when I choose the primary stage, for example, in the stage field, only the rows of this stage appear for me. How do I do that in the interface of the site and in the admin site
Charly
Hi guys 👋🏻 What is the best way to optimize images for Django website ?:)
Whatever you found to optimize images in general it has nothing to do with django
.
Hi guys 👋🏻 What is the best way to optimize images for Django website ?:)
You can automatically reduce file size by overriding the form’s save method.
ibraheem
I think you’ll need to share your models in a code paste website first.
ok thes is my models: https://linkode.org/#oG4n9k8gI6UYljEr7WMso4
.
ok thes is my models: https://linkode.org/#oG4n9k8gI6UYljEr7WMso4
Admin: use inlines e.g. define ScoolClassInline(models.StackedInline) and use it in ScoolStageAdmin Interface: get reverse relationship related_classes = scoolstages.scool_classes_set.all Anyway, the convention to define model should be like ScoolStage and ScoolClass, otherwise it can be confusing to compare and learn from standard resources.
.
can you right a code?
Sorry at the moment no, I can’t. But your keywords for further research are admin inlines and reverse relationships. All the best.
Himanshu
I am generating excel file using dataframe and I want upload excel file in FileField.
Himanshu
Himanshu
I want use Excel file as object
Charly
Gives Error
Well we can't see the error in your computer
Денис
do anyone convert xls to pdf?