Borrowing functionality from Django Admin forms

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Borrowing functionality from Django Admin forms

Justin-23
I have a user who saw how new objects can be created using the Admin forms, and asked if I could reproduce some of that functionality.  I'm still new to Django, and even newer to building forms.  I'm wondering if there is a way to "borrow" elements from the Admin forms into my own forms and templates.  Particularly, I would like the ability to create a new related object by clicking the "+" sign next to that dropdown list on another form.

I have not been able to find much documentation on how the Admin forms are constructed for a given Django project.  I understand the basic form construction method, but I can't seem to find the equivalent workings in the Admin site.  Where is the equivalent of urls.py, where the links are mapped to specific Views?  Where are the equivalents of the Views, where a context is created and sent to the template?

I would like to get more familiar with the working code behind Django, and eventually contribute to the project, so feel free to get technical.

Thx.


--
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 [hidden email].
To post to this group, send email to [hidden email].
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/92f87737-2be9-4a04-8840-2edc14452b43%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Borrowing functionality from Django Admin forms

Andy-3
Take a deeper look at the RelatedFieldWidgetWrapper (https://github.com/django/django/blob/1.3.2/django/contrib/admin/widgets.py#L200)

Am Mittwoch, 7. März 2018 21:11:18 UTC+1 schrieb Justin Johnson:
I have a user who saw how new objects can be created using the Admin forms, and asked if I could reproduce some of that functionality.  I'm still new to Django, and even newer to building forms.  I'm wondering if there is a way to "borrow" elements from the Admin forms into my own forms and templates.  Particularly, I would like the ability to create a new related object by clicking the "+" sign next to that dropdown list on another form.

I have not been able to find much documentation on how the Admin forms are constructed for a given Django project.  I understand the basic form construction method, but I can't seem to find the equivalent workings in the Admin site.  Where is the equivalent of urls.py, where the links are mapped to specific Views?  Where are the equivalents of the Views, where a context is created and sent to the template?

I would like to get more familiar with the working code behind Django, and eventually contribute to the project, so feel free to get technical.

Thx.


--
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 [hidden email].
To post to this group, send email to [hidden email].
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/a60deb69-3580-46f5-8f2b-eb59ef9be955%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.