# use xml to django forms

**URL:** <https://forum.djangoproject.com/t/use-xml-to-django-forms/9224>\
**Category:** Getting Started\
**Created:** [August 13, 2021, 5:55pm UTC](https://forum.djangoproject.com/t/use-xml-to-django-forms/9224 "2021-08-13T17:55:42Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![Shrestha7](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/shrestha7/32/5287_2.png) [@Shrestha7](https://forum.djangoproject.com/u/Shrestha7)\
**Post date:** [August 13, 2021, 5:55pm UTC](https://forum.djangoproject.com/t/use-xml-to-django-forms/9224/1 "2021-08-13T17:55:42Z")

</div>

I have a project where when someone uploads an XML file from Django admin that files data which is in XML should go to Django forms display in forms. can anyone give me advice how am I suppose to do that in Django ?

---

<div class="post-metadata">

**Author:** ![KenWhitesell](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/kenwhitesell/32/280_2.png) [@KenWhitesell](https://forum.djangoproject.com/u/KenWhitesell)\
**Post date:** [August 13, 2021, 7:15pm UTC](https://forum.djangoproject.com/t/use-xml-to-django-forms/9224/2 "2021-08-13T19:15:46Z")

</div>

There’s no direct connection between the two.

You’ll have a view that can receive the uploaded file and process it, saving the data into one or more models. You’ll then write another view that uses a form built from those models to display the previously-submitted data.

---

<div class="post-metadata">

**Author:** ![Shrestha7](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/shrestha7/32/5287_2.png) [@Shrestha7](https://forum.djangoproject.com/u/Shrestha7)\
**Post date:** [August 14, 2021, 12:48pm UTC](https://forum.djangoproject.com/t/use-xml-to-django-forms/9224/3 "2021-08-14T12:48:51Z")

</div>

correction to my question I want to upload XML files from Django admin and show that XML file data into to the Django Forms in the view. Can please give me advice how to do it in this too ?

---

<div class="post-metadata">

**Author:** ![KenWhitesell](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/kenwhitesell/32/280_2.png) [@KenWhitesell](https://forum.djangoproject.com/u/KenWhitesell)\
**Post date:** [August 14, 2021, 1:57pm UTC](https://forum.djangoproject.com/t/use-xml-to-django-forms/9224/4 "2021-08-14T13:57:27Z")

</div>

Your view would need to read that file, separate it into whatever data structures you’re going to present in the form, and then display that form in your view.

If you’re going to edit this data (and not just display it), you’re _really_ going to want to copy the data into your database and manage the data through a Model.

---

<div class="post-metadata">

**Author:** ![Shrestha7](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/shrestha7/32/5287_2.png) [@Shrestha7](https://forum.djangoproject.com/u/Shrestha7)\
**Post date:** [August 30, 2021, 11:28am UTC](https://forum.djangoproject.com/t/use-xml-to-django-forms/9224/5 "2021-08-30T11:28:51Z")

</div>

how can I edit the XML file in my database after saving it?

---

<div class="post-metadata">

**Author:** ![KenWhitesell](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/kenwhitesell/32/280_2.png) [@KenWhitesell](https://forum.djangoproject.com/u/KenWhitesell)\
**Post date:** [August 30, 2021, 11:35am UTC](https://forum.djangoproject.com/t/use-xml-to-django-forms/9224/6 "2021-08-30T11:35:08Z")

</div>

The same ways you edit any other data. You can create a Model Form for that model, and create a view to display and save submitted data. Or, you can use the Django admin on that model.

It doesn’t matter that the data is nominally XML text data. It’s still just text.

---

<div class="post-metadata">

**Author:** ![Shrestha7](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/shrestha7/32/5287_2.png) [@Shrestha7](https://forum.djangoproject.com/u/Shrestha7)\
**Post date:** [August 30, 2021, 11:56am UTC](https://forum.djangoproject.com/t/use-xml-to-django-forms/9224/7 "2021-08-30T11:56:30Z")

</div>

I saw Serializing Django objects[¶](https://docs.djangoproject.com/en/3.2/topics/serialization/#serializing-django-objects) concept in django documentation related to XML . May I know when and what for should I use this concept in gist?

---

<div class="post-metadata">

**Author:** ![KenWhitesell](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/kenwhitesell/32/280_2.png) [@KenWhitesell](https://forum.djangoproject.com/u/KenWhitesell)\
**Post date:** [August 30, 2021, 12:12pm UTC](https://forum.djangoproject.com/t/use-xml-to-django-forms/9224/8 "2021-08-30T12:12:50Z")

</div>

The very first paragraph of that documentation reference explains it as well as I’d be able to.

---

<div class="post-metadata">

**Author:** ![Shrestha7](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/shrestha7/32/5287_2.png) [@Shrestha7](https://forum.djangoproject.com/u/Shrestha7)\
**Post date:** [August 30, 2021, 12:21pm UTC](https://forum.djangoproject.com/t/use-xml-to-django-forms/9224/9 "2021-08-30T12:21:06Z")

</div>

Will that Serializing Django object apply in my case like converting xml into json and displaying it?

---

<div class="post-metadata">

**Author:** ![KenWhitesell](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/kenwhitesell/32/280_2.png) [@KenWhitesell](https://forum.djangoproject.com/u/KenWhitesell)\
**Post date:** [August 30, 2021, 12:26pm UTC](https://forum.djangoproject.com/t/use-xml-to-django-forms/9224/10 "2021-08-30T12:26:55Z")

</div>

No - at least not based on what you’ve posted so far.

What I’m getting from what you’ve described so far is that you want someone to be able to upload an XML file, and to store that XML data as a field in a database, to be able to be subsequently edited and saved back to the database.

There’s no data transformation involved there. That XML is a single field with a model.

You put XML into the database, you’ll get XML out of the database.

If you wish to parse and process that XML into a model with separate fields, etc, that’s a **completely** different set of requirements.

---

<div class="post-metadata">

**Author:** ![PholohoHlaha](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/pholohohlaha/32/29589_2.png) [@PholohoHlaha](https://forum.djangoproject.com/u/PholohoHlaha)\
**Post date:** [August 20, 2025, 7:47am UTC](https://forum.djangoproject.com/t/use-xml-to-django-forms/9224/11 "2025-08-20T07:47:33Z")

</div>

@KenWhitesell Thank you, your comments help me a lot.🙏
