Orack
class A(models.Model): userid= models.CharField(unique=True)
Orack
class B(models.Model): user=models.ForeignKey(A,on_delete= model.cascade, to_field='userid') data=models.CharField()
Orack
user=001 is already saved in database in class As view , then when I post user=001 it shows that alreay exists as it is unique before userid data 001 abc I want userid data 001 xyz
Maksim
You don't need to create userid field, it already exists by default
Kapil
Hello All Can anyone tell me how to resolve 503 error in Django.
Orack
just imagine some field with unique=true
Orack
class A(models.Model): userid= models.CharField(unique=True)
serializer of A is https://hastebin.com/wokapelide.py
Arturo
Get or update
Orack
And the problem is? If you want to update the data you have 2 options. Use get of update
u mean obj = A.objects.get(userid=userid) obj.data = "some_new_value" obj.save()?
Ghorz
no need to study tango with django 2 then
Said who. You better study it.
drunktimelord
Said who. You better study it.
no, i don't wanna learn Django just yet
Ghorz
Said who. You better study it.
There is only a few difference between two and 3. Ive created 2 project in Django 3 within the past one month. I only encountered issues with DRF because of six location and a few issues. Though I modified DRF to work in 3. But won't use it in production until DRF foundation release their upgrade
Arturo
Orack
Show the code
https://hastebin.com/ejeyoreqic.py
Orack
show your code and give context 🤷🏻‍♂️
https://hastebin.com/ejeyoreqic.py
Yash
Anyone know how to fix mysqlclient installation error
Anonymous
Am new to django but am having problem with writing my logic in view and also displaying it in template please if you have any resources that can explain this please help with it
Yash
Did everything but this bitch is too sturdy
Ghorz
How
Step 1: Open a browser Step 2: Write down https://google.com or https://duck.com and press Enter Step 3: In the search box write down the same words you asked here Step 4: Read the firsts results
Anonymous
I think u followed the same steps and u also don't know
Ghorz
I think u followed the same steps and u also don't know
Follow and repeat until you get it, that's how you learn to code
Anonymous
Follow and repeat until you get it, that's how you learn to code
Then y are u in this group? I can just google everything
Anonymous
*U
Arturo
https://hastebin.com/ejeyoreqic.py
Well. You are creating a new record. Nop updating the previous one
Anonymous
Exactly google it.
I asked y are u here
cj
I asked y are u here
stop flooding non-sense
Orack
I asked y are u here
because life exists
Anonymous
Exactly google it.
If u don't want to help leave don't say use Google
Anonymous
stop flooding non-sense
Dude I asked about ml with django he replied google it
cj
Django with ml anyone plz
don't ask meta-questions, also you can use google to find out more information about that topic
cj
Dude I asked about ml with django he replied google it
yes, that's what you have to do first, use Google, and don't ask meta-questions, ask directly your issues.
Arturo
i want to update if its alreaady there
Make another view with update logic . Don't use the same
cj
Dude I asked about ml with django he replied google it
please go and read this: http://catb.org/~esr/faqs/smart-questions.html
Orack
Make another view with update logic . Don't use the same
then same url wont fit for both update and create ?
Anonymous
Ok everyone if u have any doubts please google it
cj
Ok everyone if u have any doubts please google it
using google is the first thing to do, you can ask for specific doubts here to this group, giving enough context of what you're trying to do, what you've done in order to solve your issues, and show code so people can easily help you
Arturo
then same url wont fit for both update and create ?
You can use the same. But I prefer use different url. You can use with put method instant of post
Anonymous
This group doesn't serve any purpose
Anonymous
Just google it it's the only suggestion many experts give
Orack
Model.objects.update_or_create
cj
Just google it it's the only suggestion many experts give
exactly, using Google is the first thing to do, you can ask for specific doubts here, giving enough context of what you're trying to do, what you've done in order to solve your issues, and show code so people can easily help you
Orack
Model.objects.update_or_create
ic this wont work for my case, where are we supposed to use it anyways ?
Ghorz
Just google it it's the only suggestion many experts give
Find out your requirements, Google for information and tools Read and research further Plan your design and revise Get to work, once you hit a block, brute force until you get exhausted. If by then know solutions, ask questions based on your issues with code on pastebin, what you've tried and what you want to achieve. Will be glad to help. Thank you.
Orack
You can use the same. But I prefer use different url. You can use with put method instant of post
i just replaced 'post' with 'put' still doenst work
Orack
{ "error": { "userid": [ "a with this userid already exists." ] } }
Ghorz
+1
😊
Hari
Hi guys
Hari
In forms i have choice list
Hari
In that have to show one text field in for one
Hari
Example : In choice list :- (amount, comment , reason ) radioselect In this i have to show text field for reason and for all this one entry field is there already
Orack
is there a good script to write hotkeys in linux. like ctrl+1 for python3 manage.py makemigrations ctrl+2 for python3 manage.py migrate
Flavien
Hello all help me please. how to have this type of link: https://xxx.herokuapp.com/static/css/style.css in my template on heroku ?
Anonymous
Please I have my code example working but have been trying to use it under view and template but I cant figure it out please I need resources to help me with it
Flavien
Hello all help me please. how to have this type of link: https://xxx.herokuapp.com/static/css/style.css in my template on heroku ?
I just deployed a project on heroku and created a superuser to add image files but it doesn't load into my template. Please help me .
raven
is there a good script to write hotkeys in linux. like ctrl+1 for python3 manage.py makemigrations ctrl+2 for python3 manage.py migrate
just in case you are asking for alias you cab create it by adding [scripts] server = "python manage.py runserver" in your Pipfile and running it by pipenv run server
Jesus
I have a model created in Django, simple one. I have updated the value of this model through the web page. Is there anyway to check the previous values of a certain ID?
Opeyemi
please if anyone has the time, can they take a look at https://github.com/opeodedeyi/creative-api i am trying to implement a following and follower feature and it doesnt work as planned.
Flavien
Hello all help me please. how to have this type of link: https://xxx.herokuapp.com/static/css/style.css in my template on heroku ?
Flavien
Hello all help me please. how to have this type of link: https://xxx.herokuapp.com/static/css/style.css in my template on heroku ?
I just deployed a project on heroku and created a superuser to add image files but it doesn't load into my template. Please help me .
Orack
pipenv run makemigrations will be long
raven
haha but it can reduce typing time for bigger commands like makemigrations
raven
i use mm alias for makemigrations
Murshid
Why application that deployed trough elastic beanstalk cli(aws) not showing in aws application list in aws site
Orack
got better
application named autokey
Raja
Big news https://www.djangoproject.com/weblog/2019/dec/02/django-3-released/