Initial commit
[snf-cloudcms] / cloudcms / models.py
1 from django.db import models
2 from django.conf import settings
3 from django.contrib.sites import models as sites_models
4
5 from feincms.module.medialibrary.fields import MediaFileForeignKey
6 from feincms.module.medialibrary.models import MediaFile
7
8
9 class Application(models.Model):
10     code = models.CharField('Identifier', max_length=100, null=False, blank=False,
11             help_text="Just a codename of the application, to be used in "\
12                     "several places where no free text is allowed"\
13                     "(e.g. urls, paths, etc)")
14     title = models.CharField(max_length=255, null=False, blank=False,
15             help_text="The title of the application")
16
17     logo = MediaFileForeignKey(MediaFile, blank=True, null=True)
18     site = models.ForeignKey(sites_models.Site)
19     app_url = models.URLField(help_text="The url of the application UI (not "\
20             "the cms", verify_exists=False, blank=True, null=True)
21
22     linked_in_username = models.CharField(max_length=255, blank=True)
23     twitter_username = models.CharField(max_length=255, blank=True)
24     facebook_username = models.CharField(max_length=255, blank=True)
25
26     show_twitter_feed_on_top = models.BooleanField(default=False)
27
28     @classmethod
29     def current(cls):
30         return cls.objects.get(site__pk=settings.SITE_ID)
31
32     def __unicode__(self):
33         return self.title
34
35 # hook for feincms configuration, is this appropriate place ??? who knows
36 from cloudcms.cms import *
37