From 60ad39dba46f26df912c05b13aa5927b0b415e65 Mon Sep 17 00:00:00 2001 From: Sanj Date: Sat, 6 Oct 2012 05:31:29 +0530 Subject: [PATCH] add mediagallery, this time to get it right --- itf/mediagallery/__init__.py | 0 itf/mediagallery/models.py | 42 ++++++++++++++++++++++++++++++++++++ itf/mediagallery/tests.py | 16 ++++++++++++++ itf/mediagallery/views.py | 1 + 4 files changed, 59 insertions(+) create mode 100644 itf/mediagallery/__init__.py create mode 100644 itf/mediagallery/models.py create mode 100644 itf/mediagallery/tests.py create mode 100644 itf/mediagallery/views.py diff --git a/itf/mediagallery/__init__.py b/itf/mediagallery/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/itf/mediagallery/models.py b/itf/mediagallery/models.py new file mode 100644 index 0000000..cef7cac --- /dev/null +++ b/itf/mediagallery/models.py @@ -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. diff --git a/itf/mediagallery/tests.py b/itf/mediagallery/tests.py new file mode 100644 index 0000000..501deb7 --- /dev/null +++ b/itf/mediagallery/tests.py @@ -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) diff --git a/itf/mediagallery/views.py b/itf/mediagallery/views.py new file mode 100644 index 0000000..60f00ef --- /dev/null +++ b/itf/mediagallery/views.py @@ -0,0 +1 @@ +# Create your views here.