add mediagallery, this time to get it right
This commit is contained in:
parent
d0c7a8fbfa
commit
60ad39dba4
0
itf/mediagallery/__init__.py
Normal file
0
itf/mediagallery/__init__.py
Normal file
42
itf/mediagallery/models.py
Normal file
42
itf/mediagallery/models.py
Normal file
|
@ -0,0 +1,42 @@
|
|||
from django.db import models
|
||||
from app.models import ItfModel
|
||||
from ox.django.fields import DictField
|
||||
|
||||
class GalleryAlbum(ItfModel):
|
||||
'''
|
||||
|
||||
'''
|
||||
title = models.CharField(max_length=512, unique=True)
|
||||
slug = models.SlugField(unique=True)
|
||||
content_type = models.ForeignKey(ContentType)
|
||||
object_id = models.PositiveIntegerField()
|
||||
content_object = generic.GenericForeignKey('content_type', 'object_id')
|
||||
|
||||
def __unicode__(self):
|
||||
return self.title
|
||||
|
||||
|
||||
class GalleryItem(models.Model):
|
||||
title = models.CharField(max_length=512, blank=True, null=True)
|
||||
album = models.ForeignKey(GalleryAlbum)
|
||||
data = models.DictField()
|
||||
|
||||
def __unicode__(self):
|
||||
return self.title
|
||||
|
||||
|
||||
class Photo(GalleryItem):
|
||||
image = models.ImageField()
|
||||
|
||||
|
||||
#class Video(GalleryItem):
|
||||
# ...
|
||||
|
||||
|
||||
#class YoutubeVideo(GalleryItem):
|
||||
# ...
|
||||
|
||||
|
||||
|
||||
|
||||
# Create your models here.
|
16
itf/mediagallery/tests.py
Normal file
16
itf/mediagallery/tests.py
Normal file
|
@ -0,0 +1,16 @@
|
|||
"""
|
||||
This file demonstrates writing tests using the unittest module. These will pass
|
||||
when you run "manage.py test".
|
||||
|
||||
Replace this with more appropriate tests for your application.
|
||||
"""
|
||||
|
||||
from django.test import TestCase
|
||||
|
||||
|
||||
class SimpleTest(TestCase):
|
||||
def test_basic_addition(self):
|
||||
"""
|
||||
Tests that 1 + 1 always equals 2.
|
||||
"""
|
||||
self.assertEqual(1 + 1, 2)
|
1
itf/mediagallery/views.py
Normal file
1
itf/mediagallery/views.py
Normal file
|
@ -0,0 +1 @@
|
|||
# Create your views here.
|
Loading…
Reference in New Issue
Block a user