Adding Category

18 views
Skip to first unread message

Aayush Bhattarai

unread,
Jun 3, 2019, 7:03:09 AM6/3/19
to Django users
Hi, I am using Django==2.2.1 as Class-Based View. I wanted to add a category in a drop down and when anyone clicks it should be gone to category.
What will be the best method for doing this? Follow the step of DRY. Thanks for your Time.

Capture.PNG


sachinbg sachin

unread,
Jun 3, 2019, 7:10:59 AM6/3/19
to django...@googlegroups.com
Use the parent child relationship in single model

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.
To post to this group, send email to django...@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/7a0a0299-895f-4951-bd2e-98c00e69beda%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Aayush Bhattarai

unread,
Jun 3, 2019, 9:10:14 AM6/3/19
to Django users
Hey, dude didn't get what you are saying. Can you show me via example?

sachinbg sachin

unread,
Jun 3, 2019, 1:39:54 PM6/3/19
to django...@googlegroups.com
relate your  category model like this


On Mon, Jun 3, 2019, 6:39 PM Aayush Bhattarai <bhattara...@gmail.com wrote:
Hey, dude didn't get what you are saying. Can you show me via example?

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.
To post to this group, send email to django...@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
Screenshot (12).png

sachinbg sachin

unread,
Jun 3, 2019, 1:41:42 PM6/3/19
to django...@googlegroups.com
--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.
To post to this group, send email to django...@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.

sachinbg sachin

unread,
Jun 3, 2019, 1:44:14 PM6/3/19
to django...@googlegroups.com
make ur category model like this
Screenshot (13).png

sachinbg sachin

unread,
Jun 3, 2019, 1:45:41 PM6/3/19
to django...@googlegroups.com
make category like that and relate the category model as foreignkey for model which one u neaded 

sachinbg sachin

unread,
Jun 3, 2019, 1:48:24 PM6/3/19
to django...@googlegroups.com
write the post request api for the drown fields to that model

Reply all
Reply to author
Forward
0 new messages