Morteza
def add(request): if request.method == "POST": form = TransactionForm(request.POST) if form.is_valid(): try: form.save() return redirect('/') except: pass
if it's only a method that you defind in the views you should only pass the function without calling it it should be path("", views.add, name="anything_you_want") django will call your view and pass the request as argument to your view automatically.
Luis
thanks, i will try
़д।युषी। ✽
kancharla
Hi guys In my project I have earlier used one DB now I have changed DB connection details in settings.py file but it is still returning data from old DB
kancharla
Can anyone help me fix this issue
kancharla
I have done both makemigrations and migrate
Ivan
hi, can somebody help me?
Doragonsureiyā
hi, can somebody help me?
Not until you explain your difficulties.
Ivan
I'm starting with django and I working with some httprequest with fetch
Ivan
How can I share code?
Ivan
https://codeshare.io/4e3yBj
Ivan
I have this code..... and I´m trying to get response from backend.
Ivan
https://codeshare.io/78DvBD
Ivan
I'm trying to detect when user send HTTP_ACCEPT and response a json, but I always get 302 response, url it's ok, because but I think is something around csrf_token
Adhil latheef
Is it possible to set default_storage to firebase.storage()......???
Anonymous
Operation error at / admin /login No such table auth user
dคv¡d
have you try to do the new project? and still stuck in the same case?
Shadow
Operation error at / admin /login No such table auth user
https://stackoverflow.com/questions/24682155/user-registration-with-error-no-such-table-auth-user
Shadow
Have u try following this solution? It might be helpful, if cannot try recreating the superuser and makemigrations n migrate
Amady
Hello everyone For educational purpose I'm making a clone of ask.fm/f3.com - website for asking anonimous questions to users. The problem is I need table of users to have a connection with table of questions. How can I achieve that? Do i need to extend User model somehow?
Витек*
Hello You need to do a global full-text search for all indexes via elasticsearch. How do I make unique search settings for each index? Where to dig?
Anonymous
how to create a like/dislike btn
bala
Can someone kindly tell me the js script for dropdown menu box in django
Anonymous
if I run my app t faced a bug like this DoesNotExist at /detail/1 News matching query does not exist.
Shubhaam
Can anyone tell me how to host django project on heroku
Shubhaam
Or anyother platform
Raj
Hi, I have 3 models: Location, State and City. Location has two ForeignKey fields: state and city. When I select a particular state on the admin site, I want to select the cities that comes under the selected state only not the other state cities on the admin site. How to implement this?
M
Hello guys is there a way to edit timesince so it can be show only hours and if it 24h will be show only days.
Heet Raval
Hey how to solve not nul constraint failed error ......I have also tried using null = True
Doragonsureiyā
Hey how to solve not nul constraint failed error ......I have also tried using null = True
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
hm
how can I completely remove stripe from a project
Charly
how can I completely remove stripe from a project
Just remove the code that uses it and delete the dependency
Charly
what about the codes in venv .?
That's what do I mean when said remove the dependency
Enes
what about the codes in venv .?
use pip uninstall the_package_of_stripe
hm
ok lemme try it
Serghei
i have a problem, i dont know, how to activate enveronment django in vs code, help me
Serghei
Serghei
ssory, what means os?
cj
ssory, what means os?
Operating System
Serghei
windows
Houston
On linux it is source venv/bin/activate On windows if im not mistaken was: venv/scripts/activate
Ivan
ssory, what means os?
operating system
Enes
Activate the virtual environment You can activate the python environment by running the following command: Mac OS / Linux source mypython/bin/activate Windows mypthon\Scripts\activate You should see the name of your virtual environment in brackets on your terminal line e.g. (mypython). Any python commands you use will now work with your virtual environment
Houston
windows
Have you created it yet?
Serghei
yes
Serghei
thanks everyone i get it
Ricardo
Hi, one question. I'm working with two forms, but from one form, I only want it to update me. Only one field recovers its value, but I don't know how to tell it to save it. When using form.save, it gives me an error.
Д
No ideas guys how to do it?!
this question is way way way too vague
Д
No ideas guys how to do it?!
formulate your question so that we have a chance of answering
M
i need to filter timesince tag
M
its show for me hours and days in the same time i need just hours
Д
its show for me hours and days in the same time i need just hours
so the problem is not the filtering but displaying the data once you have it?
M
Yes
Д
Yes
so, what is the type of the variable when you have filtered it?
Д
python has many different types of ways to handle this problem
M
i dont realy understand because timesince is a tag ready to use in django
Д
i dont realy understand because timesince is a tag ready to use in django
and I don't know what timesince is... but you DO get some kind of data from somewhere, which you are trying to display somewhere, correct?
M
Want i need just to know where i can edit it or how i can edit it in views.py
Д
aaaaaaaa it's some kind of templating thing
M
Yes thats it html tag
Д
Yes thats it html tag
the docs say that if the first part is the midnight of the day, then it should return the number of hours only https://docs.djangoproject.com/en/4.0/ref/templates/builtins/#timesince
M
But after it will be show hours and days and when its been a week its gonna show weeks and days for me i want just only days or only hours ...
M
so what do you want it to show when it has gone to weeks? that it gets rounded to hours?
No its gonna be only days and after 15 days i will do an auto delete for my forms so its not important the years or the weeks
Д
because it doesn't make sense if it shows "4 hours ago" if it should say "3 days and 4 hours ago"