Skip to content

Instantly share code, notes, and snippets.

@dimiro1
Created December 19, 2013 00:48
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dimiro1/8032468 to your computer and use it in GitHub Desktop.
Save dimiro1/8032468 to your computer and use it in GitHub Desktop.
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)
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