Ok Daniel!

The model is:

class Imagem(models.Model):
    """ Várias Imagens são relativas a um Paciente """
    IMAGEM_LATERAL = '1'
    IMAGEM_FRONTAL = '2'
    IMAGEM_PERFIL = '4'

    IMAGEM_TIPOS_CHOICES = (
                              (IMAGEM_LATERAL, _('Imagem lateral')),
                              (IMAGEM_FRONTAL, _('Imagem frontal')),
                              (IMAGEM_PERFIL, _('Imagem do perfil')),
    )

    class Meta:
        ordering = ('paciente', 'titulo',)
        verbose_name = _('Imagem')
        verbose_name_plural = _('Imagens')

    paciente = models.ForeignKey('Paciente')
    titulo = models.CharField(max_length=100)
    slug = models.SlugField(
                            max_length=100,
                            blank=True,
                            unique=True
                            )
    descricao = models.TextField(blank=True)
    original = models.ImageField(
                                 null = True,
                                 blank = True,
                                 upload_to = 'galeria/original',
                                 )
    thumbnail = models.ImageField(
                                 null = True,
                                 blank = True,
                                 upload_to = 'galeria/thumbnail',
                                 )
    publicacao = models.DateTimeField(
                                      default = datetime.now(),
                                      blank = True,
                                      )

    tipo = models.CharField(
                            choices = IMAGEM_TIPOS_CHOICES,
                            max_length = 1,
                            )

    def __unicode__(self):
        return self.titulo

    def get_absolute_url(self):
        return reverse('imagem', kwargs={'slug': self.slug}) #nome
imagem ligado ao imagem do galeria/urls.py

And the ModelAdmin:

class AdminImagem(admin.ModelAdmin):

    list_display = ('paciente','titulo','tipo')
    list_filter = ('paciente','tipo',)
    search_fields = ('titulo','descricao',)
    radio_fields = {"tipo": admin.VERTICAL}

Thanks a lot!

On 9 mar, 13:23, Daniel Roseman <dan...@roseman.org.uk> wrote:
> On Mar 8, 4:36 pm, gustavo <gustavosen...@gmail.com> wrote:
>
> > Sure Daniel,
>
> > I have the admin showing only the "tipo"s label, not the choices!
>
> What are the choices? Honestly, it would be easier if you gave more
> than a single line of code here.
> --
> DR.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to