Doragonsureiyā
Where should I share code so that you all can help with it
Rule 5️⃣: To share code or error tracebacks, use an online pasting service like: - https://dpaste.org - https://linkode.org - https://hastebin.com - https://bin.kv2.dev If you posted a wall of text, go back and delete it.
Ali
You can learn while you are making project. This is the best way to learn something
cj
Some is okay ? for work with jquery ? Or not ?
jQuery is too old, but if you want, you can use it, but some vanilla JS would be enough depending on what you want to achieve in your front-end
cj
Some is okay ? for work with jquery ? Or not ?
if you're really eager to learn JS to build fancy front-end, go for Vue.JS or React.JS
Aman Deoli
Please help in this : https://dpaste.org/9L1yw
Aman Deoli
Been stuck at it for about 20hrs
vahiden
if you're really eager to learn JS to build fancy front-end, go for Vue.JS or React.JS
i need one thing just work a little beatiful untill I will learn these things little by little it is possible?
vahiden
yes
Thanks god bless you
Ali
Yes first watch a video about this like 1 hours javascript then create a project( to do app etc.). start doing a project. You should take support google chatgpt stackoverflow
Ali
while you are making project
Aman Deoli
what is the problem
Not able to make the post request to the api view
Aman Deoli
it is giving me erro of 400
Ali
bro try to write your Tag model over the Question model
Aman Deoli
bro try to write your Tag model over the Question model
Like what I have defined Tag model differently and have a attribute as Name, But when it comes to use of it in Question model it is used as manytomany tag
Morteza
Please help in this : https://dpaste.org/9L1yw
You should create those tags that frontend sends to you
Aman Deoli
How should the json look like while sending the post request
Aman Deoli
You should create those tags that frontend sends to you
But in that way everytime a new question is made a user will make a new tag or a tag that has been made again and again ? I want them to just send the id's and on the backend we will handle with these id's and set it to the question object
Aman Deoli
You should create those tags that frontend sends to you
Think of it like a stackoverflow question , here the user will create a question and will select multiple tags he/she thinks that are good and then click on save and on the backend every question object will have these tags
Morteza
Think of it like a stackoverflow question , here the user will create a question and will select multiple tags he/she thinks that are good and then click on save and on the backend every question object will have these tags
I think drf will not handle tags creation, just remove tags field from Question serializer but keep it in the fields section and in the create method get the tags and add them to the created answer also the send the tags id to the backend, example: tags: [1, 2, 3]
Morteza
Check this, i edited your code
Aman Deoli
Check this, i edited your code
Thanks, I will check and get back asap!
Morteza
Thanks, I will check and get back asap!
I think i have a typo there, in the Question serializer, create mthod, the return block should be return question
Aman Deoli
https://dpaste.org/vpC5i correct one
{ "tags": [ "Incorrect type. Expected pk value, received str." ] } This error is shown , Now post request is successfull but only takes one tag not multiple tags Eg:- [1,2,3] isn't working But :- 2 is working
Aman Deoli
The error is clear, you should pass id of the tag.
So how should the mutliple tags passed in json I tried [1,2,3] 1,2 "1,2"
Morteza
first one
Aman Deoli
first one
I tried sending it in postman but showing same error
Morteza
Do you pass the data as json ?
Aman Deoli
Do you pass the data as json ?
{ "detail": "Multipart form parse error - Invalid boundary in multipart: None" } This is the error i faced when send as json
Morteza
parser_classes = (MultiPartParser, FormParser) remove this line from your view
Morteza
Is that for the image ?
Morteza
JSONParser Also you can add this But im not sure what result you will get. there is multiple options that how you want send the data to backend, first you should choose the way that you want send the data.
Morteza
if you want send the data as FormParser, it will not validate the array as list, you should get it with list method.
Morteza
ꙮ
i have two models: menu and item. the first one is a parent for the second one. in admin panel while creating new item i need to update parent dropdown menu depending on chosen element in menu field. i tried to use formfield_for_foreignkey, but idk how to filter queryset, as theres no instant of item in creation. sorry if im asking a stupid question, but im googling it for 2 days, lol #models.py class Menu(models.Model): title = models.CharField(max_length=20) # <other fields> class Item(models.Model): menu = models.ForeignKey(Menu, on_delete=models.CASCADE) parent = models.ForeignKey("self", on_delete=models.CASCADE, null=True, blank=True) # <other fields>
ꙮ
also, i can not use jquery\js and libraries
.
also, i can not use jquery\js and libraries
I believe you’ll need to use js to dynamically modify the dropdown options without reloading the page. Unless you want to enforce the process that only after creating the item with menu selection, and then when editing the object will the parent dropdown be populated, and perhaps you’d want to make the menu selection then readonly after creation. Otherwise use js.
Aman Deoli
Add the JSONparser alongside the MultiPartParser Test it.
So when I am passing image and 1 tag from the post req it is success But when passing image and mutliple tags or no image and multiple tags it is giving error
....
Any one know employee salary calculation in django any one know ping me.
....
Too broad to help you
Basic salary to calculate the grosspay can you explain
Rohan
How to show different product images when user clicks on colour button
.
How to show different product images when user clicks on colour button
Here’s one way to do it: Add a link to each color button that navigates to a specific URL, in which each url calls a specific view function, in which each function provides differently filtered images, and renders the same template.
kiran
Can we update the value of the model when expiry date has reached..
KD
How I can update District based on selected state in django Admin panel
.
Can we update the value of the model when expiry date has reached..
Yes we can. There are many ways to do it, here’s some, each with its own pros and cons: 1. Task scheduler e.g., Celery and others 2. Put in views function so that every time the object is accessed, update the model value accordingly
.
How I can update District based on selected state in django Admin panel
Many ways to do this, such as overriding any one of these methods and inserting any additional processes you want in it: 1. ModelAdmin.save_model 2. ModelForm.save 3. ModelForm.form_valid 4. Model.save 5. Model.full_clean 6. ModelForm.full_clean
Kritesh
Can anymore help with one issue
AB
Hey guys..... I have an issue with my Django project. I cannot retrieve file uploaded through my html template
Kritesh
That how would I pass data in url as dynamic token without using slash Means I want to pass data by using '? ' instead of '/'
Kritesh
Can anybody help me with that
Дока
What do u want?
Rasoul
Hello i want to insert a array in database(mysql) What should i do?
Hello i want to insert a array in database(mysql) What should i do?
You should use bulk create queryset https://stackoverflow.com/questions/3608487/bulk-create-model-objects-in-django
Rasoul
No, no, I want to save a stop in a field. For example, the positive points of a product. 1 product and several positive items in one field
Kritesh
But anyway I get that thanks for helping me
Mayank
My default page is not updating