Generic method that can take any Django Model and provide information about manytomany field.

2018-09-11 Thread Akshay Gaur
Also posted here : https://stackoverflow.com/questions/52280584/any-way-to-fetch-the-through-fields-for-an-object-linked-via-many2many-field-wit I am trying to write a generic method that can take any Django Model and returns it in a dictionary form. So for example, if my models are defined thu

Re: How to save multiple model form in one template?

2018-09-07 Thread Akshay Gaur
I think it would be easier to write out a custom form (without using your model classes, just the fields that you will need for all the models) and then in the save method for that form's view, you create model objects using the fields in the POST request. On Friday, September 7, 2018 at 5:43:1

Re: How to assign multiple model in a single html form in Django class based view?

2018-06-19 Thread Akshay Gaur
You may want to try inline formsets . On Tuesday, June 19, 2018 at 8:45:14 AM UTC-5, Sunil Kothiyal wrote: > > > I am new in Django. I am working on Django 2.0. I need to show multiple > model forms(user profile, ad

Re: Media files

2018-06-19 Thread Akshay Gaur
Maybe there is an issue with the way django is serving the docs. Try the following: - in your base urls.py, add the following: if settings.DEBUG: urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT) In case this doesn't work, would it be possible for you to p

Re: Passing values from Python to Javascript

2018-05-24 Thread Akshay Gaur
Hi Cuneyt, How do you add the data fields and their values to tags generated by python? For example, how would you add a data field to something generated by {{ form.name }}? -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from

Re: Passing values from Python to Javascript

2018-05-24 Thread Akshay Gaur
Hi Cutest, How do you add the data fields and their values to tags generated by python? For example, how would you add a data field to something generated by {{ form.name }}? -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from

Re: Passing values from Python to Javascript

2018-05-23 Thread Akshay Gaur
Hi Steve, I am new to Django as well. To do what you wanted to do (pass values from python to js), I used ajax queries (using jquery) and then did a JsonResponse to the ajax call. The ajax call then handles the data as required. Sample usage: VIEWS.PY: class InstructorDeleteView(DeleteView):