Saturday, 15 February 2014

python - Add many in Django Admin -


In the model list view in Django Administrator, there is a button to add a model. I want to extend it a bit and be able to add multiple items at once. My models are for images, and it would be nice to be able to add many images at a time.

I found success in creating custom fields within the individual model view, but do not know where in the list view can start someone, at least tell me in the right direction?

Edit:

I want to change this view, and I want to add a button to the top right of the "Add Multiple Pictures"

Enter image details here

I think that you want to use it, assuming that you have a model in which a set of images and a model for each image (for example

  class port Ioleo (models.model): name = models.CharField (max_length = 100) square image (models.Model): port = models.ForeignKey (Portolio) name = models.CharField (max_length = 100) img = models.ImageField () # Or else you are accumulating the image, as an example URL,  

Then you can see your admin.py

  class ImageInline (Admin. Tabular inline): model = image class portfolio admin (admin.modeladmin): inline = [imagineline],  

(You can also specify extras, e.g. To begin with how many inline models

, but you should start, believe what you mean)


No comments:

Post a Comment