Nava
Nava

Reputation: 6566

How to extend or increment the model field dynamically in django admin?

In my Django admin i want to add the URLField box dynamically.that means In my model i have one URLField for that model,In future the links will be added more than one.but i have only one URLField.I wannt it should be flexible to add multiple URLFields.

Note: Inline Model will solve this. but,For the single field it should be extended as a Foreignkey also it occupies lot of time for that optional operation.

I am expecting the custom support to add the model fields only in django admin?

The attached file will expect something!

enter image description here

Upvotes: 1

Views: 536

Answers (1)

Brandon Taylor
Brandon Taylor

Reputation: 34553

One approach is to limit the inline formset to 0 extra objects if there is already a record present for that foreign key field by setting the "extra" property: https://docs.djangoproject.com/en/1.3/ref/contrib/admin/#inlinemodeladmin-options

Upvotes: 1

Related Questions