Hello everyone, I am a neophyte and maybe it's a stupid question so thank 
you in advance aid.
My question is: can I go back and retrieve all the movies assigned to a 
specific actor, director, or other through the class film? Or do I have to 
create a specific class for each item to which I want to connect the Film? 
(as I have done precisely with the Film, the fact is that I looked very 
hard-working and maybe there's a better solution)
Here's the models.py:

from django.db import models

class Umore( models.Model ):
    umore = models.CharField( max_length=25 )
    def __unicode__(self):
        return self.umore
    class Meta:
        verbose_name_plural = "Umori"

class Genere_Film( models.Model ):
    genere = models.CharField( max_length=25 )
    def __unicode__(self):
        return self.genere
    class Meta:
        verbose_name_plural = "Generi_Film"

class Anno( models.Model ):
    anno = models.CharField( max_length=4 )
    def __unicode__(self):
        return self.anno
    class Meta:
        verbose_name_plural = "Anno"

class Durata( models.Model ):
    durata = models.CharField( max_length=5 )
    def __unicode__(self):
        return  self.durata
    class Meta:
        verbose_name_plural = "Durata"

class Attore( models.Model ):
    nome = models.CharField( max_length=30 )
    cognome = models.CharField( max_length=30 )
    foto = models.CharField( max_length=100 )
    data_inserimento = models.DateField( null=True, verbose_name="data 
d'inserimento" )
    def __unicode__(self):
        return self.nome + " " + self.cognome + " " + self.foto
    class Meta:
        verbose_name_plural = "Attori"

class Regista( models.Model ):
    nome = models.CharField( max_length=30 )
    cognome = models.CharField( max_length=30 )
    foto = models.CharField( max_length=100 )
    data_inserimento = models.DateField( null=True, verbose_name="data 
d'inserimento" )
    def __unicode__(self):
        return self.nome + " " + self.cognome + " " + self.foto
    class Meta:
        verbose_name_plural = "Registi"

class Studio( models.Model ):
    nome = models.CharField( max_length=30 )
    foto = models.CharField( max_length=100 )
    data_inserimento = models.DateField( null=True, verbose_name="data 
d'inserimento" )
    def __unicode__(self):
        return self.nome #+ " " + self.foto
    class Meta:
        verbose_name_plural = "Studi"

class Trailer( models.Model ):
   trailer = models.CharField( max_length=100 )
   data_inserimento = models.DateField( null=True, verbose_name="data 
d'inserimento" )
   def __unicode__(self):
        return self.trailer
        class Meta:
            verbose_name_plural = "Trailers"

class Film( models.Model ):
    titolo = models.CharField( max_length=39 )
    trama = models.CharField( max_length=1000 )
    locandina = models.CharField( max_length=100 )
    copertina = models.CharField( max_length=100 )
    trailer = models.ForeignKey( Trailer )
    data_inserimento = models.DateField( null=True, verbose_name="data 
d'inserimento" )
    anno = models.ForeignKey( Anno )
    durata = models.ForeignKey( Durata )
    attori = models.ManyToManyField( Attore )
    registi = models.ManyToManyField( Regista )
    studi = models.ManyToManyField( Studio )
    umori = models.ManyToManyField( Umore )
    generi = models.ManyToManyField( Genere_Film )
    def __unicode__(self):
        return self.titolo + " " + self.trama + " " + self.locandina + " " 
+ self.copertina
    class Meta:
        verbose_name_plural = "Film"

-- 
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 http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to