Dictionary in admin interface

15 views
Skip to first unread message

Sven Mäurer

unread,
Jan 23, 2015, 1:32:21 PM1/23/15
to django...@googlegroups.com

I want to manage a dictionary inline over the admin interface. These are my models. What I got working is of course a separated management of request and dictionary. But I want to add key value pairs in the request admin interface with a TabularInline. Do I have to skip the dictionary in some way or what do I have to do?

class Dictionary(models.Model):
    name = models.CharField(max_length=255)

class KeyValuePair(models.Model):
    container = models.ForeignKey(Dictionary, db_index=True)
    key = models.CharField(max_length=240, db_index=True)
    value = models.CharField(max_length=240, db_index=True)

class Request(models.Model):
    params = models.ForeignKey(Dictionary, related_name="params_map", blank=True, null=True)

Collin Anderson

unread,
Jan 27, 2015, 3:05:21 PM1/27/15
to django...@googlegroups.com
Hi,

The admin doesn't really have a way to do this. You could edit KeyValuePair inline on Dictionary.

Why not have a "Params" model that has a ForeignKey to Request?

Collin
Reply all
Reply to author
Forward
0 new messages