예제 #1
0
파일: models.py 프로젝트: si618/pi-time
class GPIOLayout(django_settings.db.Model):
    value = models.PositiveSmallIntegerField(max_length=2,
        choices=settings.RPI_GPIO_LAYOUT)

    class Meta:
        abstract = True


class UnitOfMeasurement(django_settings.db.Model):
    value = models.CharField(max_length=2,
        choices=settings.UNIT_OF_MEASUREMENT)

    class Meta:
        abstract = True

django_settings.register(Boolean)
django_settings.register(GPIOLayout)
django_settings.register(UnitOfMeasurement)


# Django data models (users/groups/roles already handled by Django)

class CommonBase(models.Model):
    '''Abstract base class for Django data models.'''

    modified = models.DateTimeField()
    '''Records when model object was last modified.'''

    class Meta:
        abstract = True
예제 #2
0
    value = models.PositiveSmallIntegerField(max_length=2,
                                             choices=settings.RPI_GPIO_LAYOUT)

    class Meta:
        abstract = True


class UnitOfMeasurement(django_settings.db.Model):
    value = models.CharField(max_length=2,
                             choices=settings.UNIT_OF_MEASUREMENT)

    class Meta:
        abstract = True


django_settings.register(Boolean)
django_settings.register(GPIOLayout)
django_settings.register(UnitOfMeasurement)

# Django data models (users/groups/roles already handled by Django)


class CommonBase(models.Model):
    '''Abstract base class for Django data models.'''

    modified = models.DateTimeField()
    '''Records when model object was last modified.'''
    class Meta:
        abstract = True

    def save(self, *args, **kwargs):
예제 #3
0
 def before_database_setup(self):
     django_settings.register(settingsmodels.MyString)
예제 #4
0
파일: models.py 프로젝트: SLOBYYYY/vetco
        processors=[ResizeToFill(104,156)],
        format='JPEG',
        options={'quality': 60},
        help_text='A kép amennyiben meghaladja a 104 x 156-os méretet, akkor le lesz kicsinyítve akkorára'
    )
    area = models.CharField(
        max_length=50
    )
    mobile = models.CharField(
        max_length=50
    )
    email = models.EmailField(
        max_length=100
    )

    def __unicode__(self):
        return self.name

    class Meta:
        verbose_name = 'Üzletkötő'
        verbose_name_plural = 'Üzletkötők'


class Text(django_settings.db.Model):
    value = models.TextField()

    class Meta:
        abstract = True

django_settings.register(Text)
예제 #5
0
# -*- coding: utf-8 -*-
from django.db import models
import django_settings


class Text(django_settings.db.Model):
    value = models.TextField()

    class Meta:
        abstract = True


django_settings.register(Text)
예제 #6
0
파일: models.py 프로젝트: j0die/gifgal
            func=gen_gif,
            args=(self.pk,),
            timeout=1200,
            result_ttl=86400)  # result expires after 1 day

    def calc_price(self, view_count):
        P1 = self.minimum_price
        V1 = self.first_inflection_point
        V2 = self.second_inflection_point
        P2 = self.price_at_second_inflection_point
        S = self.rate_of_growth

        if view_count < V1:
            price = P1
        elif view_count >= V1 and view_count < V2:
            price = P1 + ((P2 - P1)/(V2 - V1)) * (view_count - V1)
        else:
            price = P2 + S * (view_count - V2)

        return price


class Float(django_settings.db.Model):
    value = models.FloatField()

    class Meta:
        abstract = True   # it's IMPORTANT - it need to be abstract


django_settings.register(Float)
예제 #7
0
 def before_database_setup(self):
     django_settings.register(settingsmodels.MyString)