I can't understand how to pass to the template a relative path rather than 
an absolute. Could you help me please...??!

here a class of my models.py :

class Brano( models.Model ):
    titolo = models.CharField( max_length=39 )
    testo = models.TextField( max_length=1000 )

    locandina = models.FilePathField( path="C:/Users/Federico/Google 
Drive/Umore/apps/Database/static/Brani/Locandina", recursive=True )
    copertina = models.FilePathField( path="C:/Users/Federico/Google 
Drive/Umore/apps/Database/static/Brani/Copertina", recursive=True )

    data_inserimento = models.DateField( null=True, verbose_name="data 
d'inserimento" )
    anno = models.ForeignKey( Anno )
    durata = models.CharField( max_length=5 )
    albums = models.ManyToManyField( Album )
    artisti = models.ManyToManyField( Artista )
    generi = models.ManyToManyField( Genere_Brano )
    colonne_sonore = models.ManyToManyField( Film, blank=True )
    def __unicode__(self):
        return self.titolo
    class Meta:
        verbose_name_plural = "Brani"
        ordering = ("-anno", )

here a def of my views.py :

def brano(request, id):
    brano = get_object_or_404( Brano, pk=id )
    return render_to_response('Brano.html', { 'brano': brano })

here part of my template :

<img class="w660 h400" src="{{ brano.locandina }}">


-- 
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.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to