예제 #1
0
class Gallery(Base):
    list_description = models.CharField(_('List Description'),
                                        max_length=255,
                                        blank=True,
                                        null=True)
    description = models.TextField(_('Description'), blank=True, null=True)
    sort_value = models.IntegerField(_('Sort Value'), default=galleryCount())
    main_image = MediaField(blank=True,
                            null=True,
                            limit_choices_to={'content_type__model': 'image'},
                            related_name='gallery_main_image')
    gallery = MultipleMediaField(
        blank=True,
        null=True,
        sorted=True,
        limit_choices_to={'content_type__model': 'image'},
        related_name='gallery_gallery')

    class Meta:
        verbose_name = 'Gallery'
        verbose_name_plural = 'Galleries'
        ordering = [
            '-sort_value',
        ]

    def url(self):
        return None
예제 #2
0
class Membership(Base):
    tagline = models.CharField(_('Tag line'),
                               max_length=255,
                               blank=True,
                               null=True)
    description = models.TextField(_('Description'))
    from_date = models.DateField(_('From'), blank=True, null=True)
    end_date = models.DateField(_('End'), blank=True, null=True)
    cost = models.CharField(_('Cost'), max_length=255, blank=True, null=True)
    sort_value = models.IntegerField(_('Sort Value'),
                                     default=membershipCount())
    download = MediaField(blank=True,
                          null=True,
                          limit_choices_to={'content_type__model': 'download'},
                          related_name='membership_download')

    class Meta:
        verbose_name = 'Membership'
        verbose_name_plural = 'Memberships'
        ordering = [
            'from_date',
            'sort_value',
        ]

    def url(self):
        return None
예제 #3
0
class Trips(Base):
    list_description = models.CharField(_('List Description'),
                                        max_length=255,
                                        blank=True,
                                        null=True)
    description = models.TextField(_('Description'), blank=True, null=True)
    day = models.ForeignKey(Calendar)
    start_date = models.DateTimeField(_('Start Date and Time'),
                                      blank=True,
                                      null=True)
    end_date = models.DateTimeField(_('End Date and Time'),
                                    blank=True,
                                    null=True)
    map = MediaField(blank=True,
                     null=True,
                     limit_choices_to={'content_type__model': 'map'},
                     related_name='trip_map')
    main_image = MediaField(blank=True,
                            null=True,
                            limit_choices_to={'content_type__model': 'image'},
                            related_name='trips_main_image')
    gallery = MultipleMediaField(
        blank=True,
        null=True,
        sorted=True,
        limit_choices_to={'content_type__model': 'image'},
        related_name='trips_gallery')
    documents = MultipleMediaField(
        blank=True,
        null=True,
        sorted=True,
        limit_choices_to={'content_type__model__in': [
            'download',
            'pdf',
        ]},
        related_name='trips_document')

    def __unicode__(self):
        return "{0} on {1}".format(self.title, self.day)

    def __str__(self):
        return "{0} on {1}".format(self.title, self.day)

    class Meta:
        verbose_name = 'Trip'
        verbose_name_plural = 'Trips'
        ordering = ['-day', '-start_date', '-end_date', 'title']
예제 #4
0
class Session(Base):
    DAY_OF_WEEK = (
        ('0', _('Monday')),
        ('1', _('Tuesday')),
        ('2', _('Wednesday')),
        ('3', _('Thursday')),
        ('4', _('Friday')),
        ('5', _('Saturday')),
        ('6', _('Sunday')),
    )
    description = models.TextField(_('Description'), blank=True, null=True)
    list_description = models.CharField(_('List Description'),
                                        blank=True,
                                        null=True,
                                        max_length=255)
    cost = models.TextField(_('Cost'), blank=True, null=True)
    day_of_week = models.CharField(_('Day of Week'),
                                   max_length=10,
                                   choices=DAY_OF_WEEK)
    sort_value = models.IntegerField(_('Sort Value'), default=sessionCount())
    location = MediaField(blank=True,
                          null=True,
                          limit_choices_to={'content_type__model': 'map'},
                          related_name='session_map')
    club = models.BooleanField(_('At Club'), default=False)

    class Meta:
        verbose_name = 'Session'
        verbose_name_plural = 'Sessions'
        ordering = [
            'sort_value',
        ]

    def url(self):
        return None
        # return reverse('articles',kwargs={'slug':self.slug})

    def get_next_session(self):
        '''
        This will get the next active session for this day.
        :return: 
        '''
        def getnext(date, day):
            event = None
            while event is None:
                date = date + timedelta(days=1)
                if date.weekday() == int(day):
                    cal = Calendar.objects.get(date=date)
                    if cal.free:
                        event = cal
            return event

        return getnext(datetime.today(), self.day_of_week)
예제 #5
0
class Event(Base):
    EVENT_TYPE = (('cancel', _('Cancel')), ('closed', _('Closed')),
                  ('notice', _('Notice')), ('event', _('Event')), ('trip',
                                                                   _('Trip')))

    date = models.ForeignKey(Calendar)
    event_type = models.CharField(_('Event Type'),
                                  max_length=255,
                                  choices=EVENT_TYPE)
    start_time = models.TimeField(_('Start Time'), blank=True, null=True)
    end_time = models.TimeField(_('End Time'), blank=True, null=True)
    author = models.ForeignKey(User, blank=True, null=True)
    description = models.TextField(_('Description'), blank=True, null=True)
    map = MediaField(blank=True,
                     null=True,
                     limit_choices_to={'content_type__model': 'map'},
                     related_name='event_map')
    main_image = MediaField(blank=True,
                            null=True,
                            limit_choices_to={'content_type__model': 'image'},
                            related_name='event_main_image')
    gallery = MultipleMediaField(
        blank=True,
        null=True,
        sorted=True,
        limit_choices_to={'content_type__model': 'image'},
        related_name='event_gallery')

    def __unicode__(self):
        return "{0} on {1}".format(self.title, self.date)

    def __str__(self):
        return "{0} on {1}".format(self.title, self.date)

    class Meta:
        verbose_name = 'Event'
        verbose_name_plural = 'Event'
        ordering = [
            'date',
        ]
예제 #6
0
class PageImages(models.Model):
    title = models.CharField(_('Title'), max_length=255)
    is_public = models.BooleanField(_('Public'), default=False)
    objects = models.Manager()
    public = PublicManager()
    created = CreationDateTimeField()
    modified = ModificationDateTimeField()
    main_image = MediaField(blank=True,
                            null=True,
                            limit_choices_to={'content_type__model': 'image'},
                            related_name='pageimage_main_image')

    def __unicode__(self):
        return self.title

    class Meta:
        verbose_name = 'Page Image'
        verbose_name_plural = 'Page Images'
예제 #7
0
class Article(Base):
    list_description = models.CharField(_('List Description'), max_length=255, blank=True, null=True)
    description = models.TextField(_('Description'), blank=True, null=True)
    post_date = models.DateField(_('Post Date'), blank=True, null=True)
    author = models.ForeignKey(User, blank=True, null=True)
    sort_value = models.IntegerField(_('Sort Value'), default=articleCount())
    category = models.ManyToManyField(Category, blank=True, null=True)
    main_image = MediaField(blank=True, null=True, limit_choices_to={'content_type__model':'image'}, related_name='article_main_image')
    gallery = MultipleMediaField(blank=True, null=True, sorted=True, limit_choices_to={'content_type__model':'image'}, related_name='article_gallery')

    class Meta:
        verbose_name = 'Article'
        verbose_name_plural = 'Articles'
        ordering = ['-sort_value',]
        permissions = (
            ('can_publish', 'Can publish this item'),
        )

    def url(self):
        return None
예제 #8
0
class About(Base):
    description = models.TextField(_('Description'), blank=True, null=True)
    image = MediaField(blank=True,
                       null=True,
                       limit_choices_to={'content_type__model': 'image'},
                       related_name='about_main_image')
    gallery = MultipleMediaField(
        blank=True,
        null=True,
        sorted=True,
        limit_choices_to={'content_type__model': 'image'},
        related_name='about_gallery')
    sort_value = models.IntegerField(_('Sort Value'), default=aboutCount())

    class Meta:
        verbose_name = 'About'
        verbose_name_plural = 'Abouts'
        ordering = [
            'sort_value',
            'created',
        ]