I have a Movie model
and I have a Image model
the Image model has a ForeignKey(Movie)
Each Movie has an arbitrary amount of Images.
I have a view where I list all the Movies.
For each Movie entry, I want one Image.
How do I do that?
I can do a "movies = Movies.objects.all()" and pass "movies"
MV wrote:
> I need to check if 2 different entries in the database exist, and serve
> different variables to the template if
> 1. they both exists
> 2. if only the first one exists
> 3. if only the last one exists
> 4. if none exists.
>
> -
> MV
>
> >
>
&g
I need to check if 2 different entries in the database exist, and serve
different variables to the template if
1. they both exists
2. if only the first one exists
3. if only the last one exists
4. if none exists.
-
MV
--~--~-~--~~~---~--~~
You received this
Hi there,
I have a question about class variables in Django. If I create a
custom field, e.g.
class TinyMCEField(models.Field):
superadmin = False
def formfield(self, **kwargs):
if superadmin:
defaults = {'widget':TinyMCE(... blah blah blah})}
else:
4 matches
Mail list logo