mahdi
mahdi
Doragonsureiyā
ARS
Hi
ARS
I am getting this error in django admin: 'str' object has no attribute 'utcoffset'
ARS
Any help would be greatly appreciated Thank you
M E H D I 1 9 0
hi
i have a problem
When debug is false and cant find my static
any can help me?
Maxim
Maxim
Maxim
web server is the program
M E H D I 1 9 0
i do not understand
you told me i must use in the host its not problem? when debug is false
Maxim
Maxim
M E H D I 1 9 0
Naggafin
you will get a substantial number of redundant db hits if you do this however, which is why django does not natively support this. for every related Actor, it will be an n+1 db hit.
Naggafin
I am getting this error in django admin: 'str' object has no attribute 'utcoffset'
sounds like an issue which you need to read the python docs on. https://docs.python.org/3/library/stdtypes.html#text-sequence-type-str
you will see the interpreter is correct. according to the python std lib docs, str type objects have no attribute utcoffset. so, without more context, no one can help you other than to say the interpreter is telling you the correct error information.
Naggafin
Naggafin
This happen in userregistration serializer
I use django-knox for DRF user authentication and serialization. perhaps have a look at that for a solution? usually no need to re-invent the wheel on something like this
ARS
Obaida Aljarjary
STATIC_URL = 'static/'
{% load static %}
{% static 'logo.jpg' %}
[28/Jun/2023 00:25:17] "GET /static/logo.jpg HTTP/1.1" 404 1783
Obaida Aljarjary
Naggafin
How i can fix it?
have you read the django docs about deploying static files first?
Obaida Aljarjary
ROG 💻
Hello everyone, has anyone had a problem with the Chrome browser not logging you out once the browser or tab is closed?
ROG 💻
my settings.py configuration is:
ROG 💻
#Close Browser
SESSION_EXPIRE_AT_BROWSER_CLOSE = True
SESSION_SAVE_EVERY_REQUEST = True
SESSION_ENGINE = 'django.contrib.sessions.backends.cache'
ROG 💻
django version: 4.1.7
Naggafin
Hello everyone, has anyone had a problem with the Chrome browser not logging you out once the browser or tab is closed?
I don't know exactly how the default django implementation of session expiry at browser close works, but you could consider using a library called allauth to handle this. the login form has a switch for a "Remember me" option, which necessarily implies session logout on browser close. this is a very mature library too, having been in development since 2012 and is actively maintained now. link: https://django-allauth.readthedocs.io/en/latest/overview.html
Fernando
Hello everyone. I'm using Django forms to send info from my MySQL db to my template and get answers from template to my db. There a way to make better visualization for forms beside form.as_p, div, table, ul. I'm looking for new ways to visualize my forms.
Thanks
Christian
Naggafin
Hello everyone. I'm using Django forms to send info from my MySQL db to my template and get answers from template to my db. There a way to make better visualization for forms beside form.as_p, div, table, ul. I'm looking for new ways to visualize my forms.
Thanks
this is probably one of the most frustrating experiences with django and has been for some time: its lack of an innovative solution for generating stylized (and custom attributed) forms without having to create a full HTML template from scratch, even for relatively minor adjustments (like ONLY adding CSS to a particular field, everything else being the same). there are third party libraries out there like django crispy forms, but I've never found a library that has a philosophy I agree with (i.e. my issue with crispy is they seem to trend towards defining structure in Python, which is NOT a job for Python; HTML was literally designed to define the structure of a webpage, that should be being used for that purpose instead). I've created a custom form library that makes use of some of django 5.0 alpha's features and generally makes defining forms work like models, allowing one to define a Meta class and then supply attributes in dicts; i.e., to add css you would do:
class MyForm(forms.Form):
...
class Meta:
css = {'fields': {'my_field': ['list', 'of', 'css', 'classes']}}
it works generally on everything but fieldsets. but I haven't published it to github yet. I suppose I should do that, if you'd like to give it a go. otherwise, best thing I can tell you is to write an HTML template from scratch for your form and assign it to it with MyForm.template_name attribute
Naggafin
this is probably one of the most frustrating experiences with django and has been for some time: its lack of an innovative solution for generating stylized (and custom attributed) forms without having to create a full HTML template from scratch, even for relatively minor adjustments (like ONLY adding CSS to a particular field, everything else being the same). there are third party libraries out there like django crispy forms, but I've never found a library that has a philosophy I agree with (i.e. my issue with crispy is they seem to trend towards defining structure in Python, which is NOT a job for Python; HTML was literally designed to define the structure of a webpage, that should be being used for that purpose instead). I've created a custom form library that makes use of some of django 5.0 alpha's features and generally makes defining forms work like models, allowing one to define a Meta class and then supply attributes in dicts; i.e., to add css you would do:
class MyForm(forms.Form):
...
class Meta:
css = {'fields': {'my_field': ['list', 'of', 'css', 'classes']}}
it works generally on everything but fieldsets. but I haven't published it to github yet. I suppose I should do that, if you'd like to give it a go. otherwise, best thing I can tell you is to write an HTML template from scratch for your form and assign it to it with MyForm.template_name attribute
I just made a repo for it if you want to try it. no docs yet. it's more experimental than anything else, but it works. https://github.com/Naggafin/django-extensible-forms
Naggafin
don't know if that would help with what you are trying to do
Naggafin
a feature of my library though allows one to define attributes for the field separator tag. right now, this is only <div>, as each field is wrapped in a <div> tag to separate from one another. you can add attributes for this through the Meta's css = {'separators': {'my_field': ['CSS', 'list']}}
Fernando
Naggafin
Thanks. I will take a look
as you please :). I definitely need to come up with some rudimentary documentation. if you feel like using it, I can explain what all it can do in a PM. for the most part I did this because I got tired of having to write a custom HTML template every time I wanted basic CSS or HTML attributes defined.
in any case, you say you're having an issue with HTML?
Fernando
Gollamudi
https://linkode.org/#8d6yAg2DQYlLvq6tACBvk5
Gollamudi
i am unable to login with that code
Gollamudi
Okay
Gollamudi
reply
@cyberZW
Hell guys any one who can tell me any free hosting platforms where I can deploy my webapp
Axel.eth
Tatiana
Hi All) Anyone used Heroku for deploy and blaze bucket for file storage? Can’t connect to bucket also return to error of “invalid endpoint”…I’m not sure which library I need to use or which settings set up right.
Please HELP HELP HELP
🌚🌚🌚
Sumit
Hi , How can I open django admin at 127.0.0.1:8000 instead of 127.0.0.1:8000/admin/ when debug = False.
Sumit
with debug= True, it is running fine, but with debug = false , django is not adding trailing / , so it is causing an error
AMIR
Hello
I had a project that was working on Django 3.1 and I was connected to mqtt broker with it. Today, I had to upgrade the project version to Django 4.2, but the mqtt connection gives a timeout error
Can anyone help me?
Traceback (most recent call last):
File "/home/HomeAmn/report/mqtt.py", line 171, in <module>
client.connect("37.156.29.21", 1883, 60)
File "/usr/local/lib/python3.11/site-packages/paho/mqtt/client.py", line 914, in connect
TimeoutError: timed out
E
I have 1 model, and it updates on different pages, so i have 2 forms for this model, but when i enter data into fields on page4 and i need to go back to page3 to edit data and then go to page4, fields of page4 will be empty and data from model is deleted
class Page3Form(forms.ModelForm):
class Meta:
model = Object
class Page4Form(forms.ModelForm):
class Meta:
model = Object
Xusrav
Jan
Tererai Tyler
Hello Guys my cmd is not going past the django-admin start project its giving an error anyone who knows how to pass this error
ROG 💻
(offline)REBEL WAS INNOCENT( READ BIO)
Can anyone tell me the basic of django i want to learn it
ROG 💻
부산
TypeError at /
Field 'id' expected a number but got <SimpleLazyObject: <django.contrib.auth.models.AnonymousUser object at 0x000001A1326800A0>>. how can I solve this problem?
(offline)REBEL WAS INNOCENT( READ BIO)
Tatiana
Hi All) Anyone used Heroku for deploy and blaze bucket for file storage? Can’t connect to bucket also return to error of “invalid endpoint”…I’m not sure which library I need to use or which settings set up right.
Please HELP HELP HELP
🌚🌚🌚
KingFx
I have a form
I want when a user fill the form that I can receive data to my email account
Shivam
Django Rest oauth toolkit provider authentication and when user login genrate access token
Maxim
Doragonsureiyā
Shivam
I want face error grant type
Anonymous
Anonymous
Anonymous
Ohh
Anonymous
U need to learn about generate tokens
Anonymous
And send messages to account
aditya
I want to make two separate django and connect then, example one project is for payment things and 2nd one is main project. Is there any way or idea about it
Naggafin
I want to make two separate django and connect then, example one project is for payment things and 2nd one is main project. Is there any way or idea about it
that seems like an odd way to configure things. can you go into detail about your decision for this design paradigm? if it were me, I would keep everything in one project, but have the payment system in its own module. I do this for the project I'm working on now, which expects to be able to transact in cryptocurrencies. for accomplishing this, I made a crypto module, which every app which requires crypto functionality uses. the module itself sits inside of a django app, also titled crypto, which provides models for crypto wallets and basic REST API views. perhaps a setup like that is easier? having two separate django instances running which are expected to be interfacing in unison seems like a really complicated thing to pull off. communication between them would be done via HTTP, and that would be one hell of a db setup and apache config.
부산
is there anyone who can solve the problem I am encountering? I will pay how much he/she wants if he/she can solve that problem