Naggafin
what is the problem?
부산
what is the problem?
Field "id" expected a number got <SimpleLazyObject>. This is the error I have been encountering for two days. No one can solved this error in my Django community. Please help me
Naggafin
can you give context surrounding this? my immediate impression at first is it sounds like you're using a value wrapped in gettext_lazy
부산
I delete database and all migrations even I created a new project and implemented that project as above it throw me this error too
부산
Naggafin
are you using i18n and translations util functions in your codebase? if so, be careful about how these get applied to your models
Naggafin
부산
The project is not working even just I request the homepage also I am not able to enter the admin page
Naggafin
can you give more context exactly about what causes this error to happen?
부산
Naggafin
are you using view functions or classes?
부산
This is the Ecommerce project, this error taken place after implementing profile view.
Naggafin
well, let me back up. when you make an HTTP request to a view, does it happen then? or does it happen as soon as you start the django instance, i.e. with manage.py runserver?
부산
Naggafin
so when you make a GET request to your HomeView, it happens?
부산
Please help me out. I almost have done the project but this error is stucking me. I can not throw this project because of I worked hardy on it
Naggafin
relax, software problems are always solvable. when there's a will, there is a way. we'll get to a solution
Naggafin
I want to suggest an idea. have you tried placing breakpoint() at the beginning of a view's dispatch() method and then stepping through the code until you reach the point of error? i.e.:
class MyView(View):
def dispatch(self, *args, **kwargs):
breakpoint()
return super().dispatch(*args, **kwargs)
...
Naggafin
부산
There is an interesting something that I did not implemented any view which are waiting for ID as described in the problem
Naggafin
부산
부산
Naggafin
What is an breakpoint()? Where should I put it in my View?
breakpoint() initiates a pdb (python debugger) session. you can place it anywhere you like, but the most effective points are places in which you know precede failure points. when python hits a breakpoint(), execution stops and you're given control of the interpreter through the regular REPL; the same as if you did manage.py shell, except from that point with that application state
breakpoint is a built-in function of python
ROG 💻
Do you know of any similar library to control idle time in a django app and redirect to a specific url?
ROG 💻
https://django-session-security.readthedocs.io/en/latest/quick.html
Charly
Naggafin
my sentiment also
부산
ROG 💻
What do you exaclty mean by idle time?
That the user has left the app open, that they are not doing anything and that x minutes have passed, then the app warns them first with a popup if they want to continue connected or not in the app
부산
Naggafin
Naggafin
obviously it doesn't communicate with the frontend though. but the way you solve that, I'd think, would be just to have a js timer popup after a certain time
Naggafin
so if your session timeout was 10 mins, maybe you'd make the popup show after 7. the session timeout on django resets with every HTTP request made for that session
Naggafin
Naggafin
but I don't think you need to
Naggafin
if someone loads a page, the session reset timer resets in django. so, on your frontend, make a timer that is slightly less than your django session timeout and have it reset on page load
ROG 💻
so if your session timeout was 10 mins, maybe you'd make the popup show after 7. the session timeout on django resets with every HTTP request made for that session
Naggafin
that way, they won't exactly be aligned, but it is "close enough" to be effectice
부산
Naggafin
Naggafin
data between client and server was never meant to be in stateful sync in the HTTP model
Naggafin
web sockets alleviate this problem by providing stateful data
Naggafin
but for something so simple, doing this via web socket would be a massive unnecessary pain in the ass. you're better off just going with the happenstance approach: resetting the timer on client end and server end on every HTTP request
Naggafin
they're not technically aligned, but it works well enough to not notice
ROG 💻
yes it is a good alternative to work with web socket but I think I found something that could help, which is more or less what I was needing, the library seems interesting --> https://pypi.org/project/django-auto-logout/
Naggafin
oh wow. that looks like a nice little gem. every once in awhile you come across those really cool useful libraries like that that not many people have heard of before
ROG 💻
ROG 💻
https://github.com/bugov/django-auto-logout
.
Can someone plz suggest where i can host my DJango projects freely... thanks in advance
Gollamudi
Hai
Gollamudi
I have a doubt on django
Gollamudi
Can i share the code
Gollamudi
this is login.html https://dpaste.org/tjoB9
Gollamudi
this is view.py https://dpaste.org/ovr1y
Gollamudi
this is urls.py https://dpaste.org/g61Uj
Gollamudi
i am unable to redirect to the continue_watching page
Gollamudi
Can you modify the code to corrext
Christian
Why don't you render the other template from the view?
Christian
You can also redirect to it from the login view
Gollamudi
I don't know about django
Gollamudi
Can you send the modified code
Christian
Just render the other template
Chris
Does anyone know how to work with images (upload, fetch from db) using ajax in django
Aashish
Anonymous
How can i add login notification like
Logged to the page
Aashish
Cheshtaaaaaaa
Anonymous
Can u refer any websites to refer
Anonymous