Hello fellow djangonauts,

I'd like to implement an admin page (field, widget, template...
whatever) to edit xml-formatted contents of TextFields. Every child
node of the xml data has to be editable in a *separate* TextField.

Simple example:
I want to store some information about books, but for every book there
is a different set of information available. So I am going to store
the xml-formatted information set into a single TextField.
(Unfortunately it is not possible to split up the information set into
a 1:n-relation - for internal reasons). The only information available
for all books is the book's name. So I define this Book class:

class Book(models.Model):
    name = models.CharField('name of the book', max_length=200)
    infoset_xml = models.TextField('additional info')

The contents of infoset_xml are expected to look like this:

<infoset>
<info type="author">John Smith</info>
<info type="pagecount">234</info>
</infoset>

or

<infoset>
<info type="publishing_date">>1987-06-05</info>
<info type="pagecount">42</info>
<info type="price">$1,50</info>
</infoset>

The "ordinary user"'s admin page should contain one TextField for the
book's name and one additional TextField for every info-node within
infoset_xml.

The "administrator"'s admin page should contain one TextField for the
book's name and one TextField for editing the raw infoset_xml.

Unfortunately I've failed in implemeting the "ordinary user"'s admin
page (using MultiValueField and MultiWidget, and lxml for xml
parsing). The problem is, that it's not determined how many info-nodes
infoset_xml may contain. So the admin page has to dynamically adapt to
the number of info-nodes.

Is that possible? I'm desperately hoping that somebody can give me a
hint on how to implement it.

TIA and regards,
-Stephan


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to