Created
December 19, 2013 00:48
-
-
Save dimiro1/8032468 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from django.contrib import admin | |
from .models import Gallery, Image | |
class ImageInline(admin.StackedInline): | |
model = Image | |
extra = 0 | |
fields = ('image',) | |
class GalleryAdmin(admin.ModelAdmin): | |
inlines = (ImageInline,) | |
admin.site.register(Gallery, GalleryAdmin) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from django.db import models | |
from filer.fields.image import FilerImageField | |
class Image(models.Model): | |
gallery = models.ForeignKey('Gallery') | |
image = FilerImageField(verbose_name=u'Imagem') | |
class Gallery(models.Model): | |
title = models.CharField(u'Título', max_length=65) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment