If you want a fixed set of file field, you declare multiple file
field, each with a different name. For exemple:

    class UserProfile(models.Model):
        photo_front = models.FileField(...)
        photo_side = models.FileField(...)

If you want a list of photo, you don't know yet how many, you use a
second model with a foreign key:

    class UserPhoto(models.Model):
        user =  models.ForeignKey(UserProfile, models.CASCADE,
related_name="photos")
        photo = models.FileField(...)

With the second model, you access all the photo with
user_profile.photos.all(). If the related_name attribute on the
foreign key is "photo_set", user_profile.photo_set.all().

I hope this will help you and that I am clear enough :)

2017-01-26 0:00 GMT+01:00 ايهاب توفيق <e.bugaig...@gmail.com>:
> I am new in django and to know how to use multiple file field in the same
> model can any one help me
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/da76e41d-1975-4371-b91d-4eedd9ba9a96%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.



-- 

Cordialement, Coues Ludovic
+336 148 743 42

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAEuG%2BTZY7Rn%3DWZMZ8etjg1JaG8NFv5%2BTM4WxV6Qfi_0KEH-%3D6w%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to