ᴏʟᴇɢ
Hi.
I ran into a little problem while setting up the timezone in Django with PostgreSQL.
I have a model with the "auto now add" DateTime field.
Data is added 3 hours earlier.
Django=3+
PostgreSQL=14
in settings.py I have
TIMEZONE = "Europe/Moscow"
USE_TZ = True
in postgres.config
timezone = "Europe/Moscow"
timezone_log = "Europe/Moscow"
And I altered this timezone to the database user
ALTER USER dbms set TimeZone to 'Europe/Moscow';
$psql_ select * from now();
2021-11-04 17:14:16.673291+03
$_ date
Thu 4 Nov 17:14:56 MSK 2021
if now I create objects with django in database. I see
2021-11-04 14:14:16.673291+03
Please tell me what I need to configure so that the date is normal -
17:14:16
cj
voiceless
I have a question
I can't understand after high search...
How to stored jwt (access, refresh) token in cookies onlyHttp?
Ajitesh
Geralt
is there any naming convention when doing django-admin startproject
H i r A
Hi
It's all my codes on the model page and class Post is works right but class Points no. When I want to save score, it gives me error.
Can you tell me where is my problem?
H i r A
https://nekobin.com/vemepunugo
can you help me now?
Vaibhav
Vaibhav
H i r A
Vaibhav
voiceless
William
Arash
Hi. I wanted a tip from you. Thank you for your help ... Is it possible to add a product to the cart and create the cart itself on the frontend or not? Or should the view be written on the other side of Django so that Frontend can show these?
Musa
Олег
to make a spa, do I need to make an api in Django and access it using js? is there another way?
Hussein
How to get browser id ?
Anonymous
Hi is there any filter for template tag that we want to show a month in Gregorian format? Because by default is another lang and I don't want to change it in my setting.
Instead of نوفنمبر
I want to show Nov in my template.
Anonymous
Hello
Anonymous
Detected path traversal attempt in '/home/leyla/deployment/media/photos/asics/2021/11/04/c5a98e62452e9a0e38fae.webp'
Anonymous
image_path = os.path.abspath(settings.MEDIA_ROOT + '/photos/asics/' + date.today().strftime('%Y/%m/%d/'))
Anonymous
what is my bad?
Anonymous
def rename_file(instance, filename):
if filename.find('.') >= 0:
dot_index = (len(filename) - filename.rfind('.', 1)) * (-1)
filename = filename[0:dot_index]
filename = '{}.{}'.format(filename, 'webp')
return os.path.join(image_path, filename)
Anonymous
this code transform my file for jpg to webm
Ismael
what is my bad?
https://forum.djangoproject.com/t/django-3-2-4-update-suspiciousfileoperation-detected-path-traversal-attempt/8196/3
Ismael
check this
Anonymous
I tried, I didn't succeed
マクスイム • グセブ
マクスイム • グセブ
Idk I haven't faced this error yet but maybe it occurs because of an incorrect file path you pass to upload_to destination of model's filefield. That may explain everything
マクスイム • グセブ
Anonymous
Anonymous
Brayton
Good night group, could someone help me with a question I have?
Tanner
Yes I know but I don't want to use js
Chances are you’ll have to use some js at some point in your projects! It’s not awful, it’s essential! If you really want a template tag, you can swiftly write a custom one https://docs.djangoproject.com/en/3.2/howto/custom-template-tags/. You could create an enum class with all the months hard coded and render the Gregorian month accordingly!
Bakhodir
hi every body, how can I check password hash which generated with Yii2 framework on django?
Anonymous
Anonymous
Anonymous
Anonymous
enansi
Hi everyone, I'm doing a basic demo project, its a messaging application. So I have the models Group , Message , User ... I want to track Read/Unread messages, so I have a MessageRead (time_read, message_id, user_id) model... is there a better way to track read messages other than doing an entire model?
Sanjay Krishnan
Vaibhav
enansi
Vaibhav
How would that look?
Just write down ur functional requirements like what all. need to know and track and use message as an fk
Sanjay Krishnan
Жоомарт
Hello, I made a parser that works with Django and saves data to the database, but I also need to add something like a button to the Django admin panel for parsing, does anyone know how to implement this?
Sunken
Hi everyone
Is there any body can help me with this error?
Could not install package due to an OSError: No such file or directory:...
It is relate to run "git push heroku master"
I'd tried every solution I have found
Eric
Hussein
Hallo, How to get browser id ?
Doragonsureiyā
ADI
How we can get two models fields data one model frentend
Plese explain it
Eric
Hallo, How to get browser id ?
If you mean "Get the User Agent of the browser that makes a request?" then you just access the META attribute of the request object:
request.META['HTTP_USER_AGENT']
ADI
How can I display two model data in django ? Freinds
Hussein
Hussein
I want to save the browser id in the user's database so that he can not log in from another place later
Ashish
I deployed django app in heroku but static files and images not working help me?
λ701
Ashish
Yes
Ashish
Change debug false and allow host
Anonymous
Anonymous
Roberto
Hello all, I want to render a symbol in svg format inside a class-based listview template.
I found django-inline-svg which let use the {%svg 'file_name' %} template tag to render the file_name.svg.
I was trying to do something like:
{% for sign in article.signs.all %}
{% svg '{{sign.name}}_symbol' %}
{% endfor %}
but of course it doesn't work. Would you please suggest me a way to do it?
ᴏʟᴇɢ
Dominik
Hi guys, I ran into this error and can’t understand why it happens
django.core.exceptions.ImproperlyConfigured: Requested setting INSTALLED_APPS, but settings are not configured. You must either define the environment variable DJANGO_SETTINGS_MODULE or call settings.configure() before accessing settings.
*Note everything in the project is working and I can start testserver normally.
It just happens when I’m trying to run my models.py code for testing.
Edge
cj
cj
are you using pytest or Django's TestCase?
Dominik
Dominik
It should not be a usual TestCase. It is just to look if my script is working fine.
N
I have a problem. In the input, of course, the input field is affiliated with the crditcard library in Dijango. I am required to register in it 11/23
If you register something other than that, for example. number. 55/44. or letters. I get an error on the whole site, how do I solve this problem for me for a month
max 17
Anonymous
What it means: user = request.user, so I have not imported request, neither user. How django find my users?