A
A
Andrey2015-04-14 19:14:24
Django
Andrey, 2015-04-14 19:14:24

How to implement multiple images in models?

Hello!
Some models require multiple images to be linked.
To do this, you need to create a separate images application and in it an image model with an imagefield, and then pull up the image using "many to many" where necessary, do I understand correctly?
Tell me, maybe there are more options with json, etc., in general, how do you do it?)

Answer the question

In order to leave comments, you need to log in

3 answer(s)
S
sim3x, 2015-04-14
@sim3x

standalone images app

separate model images

V
Vadim Shandrinov, 2015-04-14
@suguby

Ask the question correctly: show the data structures, do not be too lazy to insert pieces of code.
And now it turns out: I have a bike, so I put an asterisk from Shimano, but he does not go :) what is the big one? what asterisk?

Z
zelsky, 2015-04-15
@zelsky

Some models require multiple images to be linked.
1. Add a primary_key in these models
2. From the image model, create a Foreign_key referring to the model above.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question