class ProductVote(models.Model):
    product = models.ForeignKey(Product, on_delete=models.CASCADE)
    user_id = models.IntegerField()
    submitted = DateTimeUTCField(auto_now_add=True)

    def __str__(self):
        return self.product
예제 #2
0
class HourAggregationBase(models.Model):
    id = models.AutoField(primary_key=True)
    passage_at_timestamp = DateTimeUTCField()
    passage_at_date = models.DateField()
    passage_at_year = models.IntegerField()
    passage_at_month = models.IntegerField()
    passage_at_day = models.IntegerField()
    passage_at_week = models.IntegerField()
    passage_at_day_of_week = models.CharField(max_length=20)
    passage_at_hour = models.IntegerField(db_index=True)

    order_kaart = models.IntegerField(null=True,
                                      blank=True)  # in sheet: volgorde
    order_naam = models.CharField(max_length=255, null=True,
                                  blank=True)  # in sheet: straatnaam
    cordon = models.CharField(max_length=255,
                              db_index=True,
                              null=True,
                              blank=True)
    richting = models.CharField(max_length=3, null=True, blank=True)
    location = models.PointField(srid=4326, null=True, blank=True)
    geom = models.CharField(max_length=255, null=True, blank=True)
    azimuth = models.FloatField(null=True, blank=True)

    kenteken_land = models.TextField()
    intensiteit = models.IntegerField(null=True, blank=True)

    class Meta:
        abstract = True
예제 #3
0
class create_question(models.Model):

    L = 'low'
    H = 'high'
    M = 'medium'

    _TYPES = ((L, 'Low'), (H, 'High'), (M, 'Medium'))

    ques_type = models.CharField(max_length=100)
    importance = models.IntegerField(default=0)
    #current_version_id          = models.IntegerField(null=True,blank=True)
    created_at = DateTimeUTCField(auto_now_add=True)
    updated_at = DateTimeUTCField(auto_now=True)
    active = models.BooleanField(default=True, null=True, blank=True)

    def __str__(self):
        return str(self.ques_type)
class Sale(models.Model):
    # store the stripe charge id for this sale
    charge_id = models.CharField(max_length=128)
    price_in_cents = models.IntegerField()
    user_id = models.IntegerField()
    submitted = DateTimeUTCField(auto_now_add=True)

    def __str__(self):
        return self.charge_id
class ProductTimeAssigned(models.Model):
    product = models.ForeignKey(Product, on_delete=models.CASCADE)
    submitted = DateTimeUTCField(auto_now_add=True)
    time_minutes = models.IntegerField(default=0)

    @property
    def total_time(self):
        return self.productvote_set.count()

    def __str__(self):
        return self.product
예제 #6
0
class User(models.Model):
    user_id = models.AutoField(primary_key=True, blank=True, default=None)
    email = models.CharField(max_length=128, unique=True, null=False)
    username = models.CharField(max_length=50, null=False)
    password = models.CharField(max_length=50, null=False, db_column='pass')
    firstname = models.CharField(max_length=50, null=False)
    animal = models.CharField(max_length=50, null=False)
    created_on = DateTimeUTCField(auto_now_add=True)

    class Meta:
        db_table = "user"
예제 #7
0
class Event(models.Model):
    title = models.CharField(max_length=200)
    description = models.TextField()
    start_time = models.DateTimeField()
    end_time = models.DateTimeField()
    created = DateTimeUTCField(auto_now_add=True)
    # start_time = DateTimeUTCField()
    # end_time = DateTimeUTCField()

    def to_dict(self):
        dict_self = model_to_dict(self)
        return dict_self

    @property
    def get_html_url(self):
        url = reverse('cal:event_edit', args=(self.id,))
        return f'<a href="{url}"> {self.title} </a>'
예제 #8
0
class Passage(models.Model):
    """Passage measurement.

    Each passing of a vehicle with a license plate passes into
    an environment zone which passes an environment camera
    should result in a record here.
    """

    id = models.UUIDField(primary_key=True, unique=True, default=uuid.uuid4)
    passage_id = models.UUIDField(null=False, blank=False)
    passage_at = DateTimeUTCField(db_index=True, null=False)
    created_at = DateTimeUTCField(db_index=True,
                                  auto_now_add=True,
                                  editable=False)
    volgnummer = models.PositiveIntegerField(default=1,
                                             null=False,
                                             blank=False)

    version = models.CharField(max_length=20)

    # camera properties
    straat = models.CharField(max_length=255, null=True, blank=True)
    rijrichting = models.SmallIntegerField(null=True, blank=True)
    rijstrook = models.SmallIntegerField(null=True, blank=True)
    camera_id = models.CharField(max_length=255, null=True, blank=True)
    camera_naam = models.CharField(max_length=255, null=True, blank=True)
    camera_kijkrichting = models.FloatField(null=True, blank=True)
    camera_locatie = models.PointField(srid=4326, null=True, blank=True)

    # car properties
    kenteken_land = models.CharField(max_length=2, null=True, blank=True)
    kenteken_nummer_betrouwbaarheid = models.SmallIntegerField(
        validators=[MaxValueValidator(1000),
                    MinValueValidator(0)],
        null=True,
        blank=True)
    kenteken_land_betrouwbaarheid = models.SmallIntegerField(
        validators=[MaxValueValidator(1000),
                    MinValueValidator(0)],
        null=True,
        blank=True)
    kenteken_karakters_betrouwbaarheid = models.JSONField(null=True,
                                                          blank=True)
    indicatie_snelheid = models.FloatField(null=True, blank=True)
    automatisch_verwerkbaar = models.BooleanField(null=True, blank=True)
    voertuig_soort = models.CharField(max_length=64, null=True, blank=True)
    merk = models.CharField(max_length=255, null=True, blank=True)
    inrichting = models.CharField(max_length=255, null=True, blank=True)
    datum_eerste_toelating = models.DateField(null=True, blank=True)
    datum_tenaamstelling = models.DateField(null=True, blank=True)
    toegestane_maximum_massa_voertuig = models.IntegerField(null=True,
                                                            blank=True)
    europese_voertuigcategorie = models.CharField(max_length=2,
                                                  null=True,
                                                  blank=True)
    europese_voertuigcategorie_toevoeging = models.CharField(max_length=1,
                                                             null=True,
                                                             blank=True)
    taxi_indicator = models.BooleanField(null=True, blank=True)
    maximale_constructie_snelheid_bromsnorfiets = models.SmallIntegerField(
        null=True, blank=True)

    # fuel properties
    brandstoffen = models.JSONField(null=True, blank=True)
    extra_data = models.JSONField(null=True, blank=True)
    diesel = models.SmallIntegerField(null=True, blank=True)
    gasoline = models.SmallIntegerField(null=True, blank=True)
    electric = models.SmallIntegerField(null=True, blank=True)

    # TNO Versit klasse.
    # Zie ook: https://www.tno.nl/media/2451/lowres_tno_versit.pdf
    versit_klasse = models.CharField(null=True, blank=True, max_length=255)

    kenteken_hash = models.CharField(max_length=255, null=True, blank=True)
    massa_ledig_voertuig = models.IntegerField(null=True, blank=True)
    aantal_assen = models.SmallIntegerField(null=True, blank=True)
    aantal_staanplaatsen = models.SmallIntegerField(null=True, blank=True)
    aantal_wielen = models.SmallIntegerField(null=True, blank=True)
    aantal_zitplaatsen = models.SmallIntegerField(null=True, blank=True)
    handelsbenaming = models.CharField(max_length=255, null=True, blank=True)
    lengte = models.SmallIntegerField(null=True, blank=True)
    breedte = models.SmallIntegerField(null=True, blank=True)
    maximum_massa_trekken_ongeremd = models.IntegerField(null=True, blank=True)
    maximum_massa_trekken_geremd = models.IntegerField(null=True, blank=True)
    co2_uitstoot_gecombineerd = models.FloatField(null=True, blank=True)
    co2_uitstoot_gewogen = models.FloatField(null=True, blank=True)
    milieuklasse_eg_goedkeuring_zwaar = models.CharField(max_length=255,
                                                         null=True,
                                                         blank=True)

    class Meta:
        # create a unique index for (passage_id, volgnummer).
        # passage_at is included as it is required; it is used to partition
        unique_together = ('passage_id', 'volgnummer', 'passage_at')
예제 #9
0
class TestModel(models.Model):
    name = models.CharField(max_length=100)
    time_auto_added = DateTimeUTCField(auto_now_add=True)
    time_auto_updated = DateTimeUTCField(auto_now=True)
    time_set_manually = DateTimeUTCField(null=True)
예제 #10
0
class Migration(migrations.Migration):

    dependencies = [
        ('passage', '0013_remove_passage_privacy_check'),
    ]

    operations = [
        CreateExtension('postgis'),
        migrations.CreateModel(
            name='ZoneZwaarVerkeer',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('passage_at_timestamp', DateTimeUTCField()),
                ('passage_at_date', models.DateField()),
                ('passage_at_year', models.IntegerField()),
                ('passage_at_month', models.IntegerField()),
                ('passage_at_day', models.IntegerField()),
                ('passage_at_week', models.IntegerField()),
                ('passage_at_day_of_week', models.CharField(max_length=20)),
                ('passage_at_hour', models.IntegerField()),
                ('order_kaart', models.IntegerField(blank=True, null=True)),
                ('order_naam',
                 models.CharField(blank=True, max_length=255, null=True)),
                ('cordon',
                 models.CharField(blank=True,
                                  db_index=True,
                                  max_length=255,
                                  null=True)),
                ('richting',
                 models.CharField(blank=True, max_length=3, null=True)),
                ('location',
                 django.contrib.gis.db.models.fields.PointField(blank=True,
                                                                null=True,
                                                                srid=4326)),
                ('geom', models.CharField(blank=True,
                                          max_length=255,
                                          null=True)),
                ('azimuth', models.FloatField()),
                ('kenteken_land', models.TextField()),
                ('voertuig_soort', models.CharField(max_length=25, null=True)),
                ('inrichting', models.CharField(max_length=255, null=True)),
                ('voertuig_klasse_toegestaan_gewicht',
                 models.CharField(blank=True, max_length=255, null=True)),
                ('intensiteit', models.IntegerField(blank=True, null=True)),
            ],
        ),
        migrations.CreateModel(
            name='ZwaarVerkeerHelperTable',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('camera_naam', models.CharField(db_index=True,
                                                 max_length=255)),
                ('rijrichting',
                 models.IntegerField(blank=True, db_index=True, null=True)),
                ('camera_kijkrichting',
                 models.FloatField(blank=True, db_index=True, null=True)),
                ('order_kaart', models.IntegerField(blank=True, null=True)),
                ('order_naam',
                 models.CharField(blank=True, max_length=255, null=True)),
                ('cordon',
                 models.CharField(blank=True,
                                  db_index=True,
                                  max_length=255,
                                  null=True)),
                ('richting',
                 models.CharField(blank=True, max_length=10, null=True)),
                ('location',
                 django.contrib.gis.db.models.fields.PointField(blank=True,
                                                                null=True,
                                                                srid=4326)),
                ('geom', models.CharField(blank=True,
                                          max_length=255,
                                          null=True)),
                ('azimuth', models.FloatField(blank=True, null=True)),
            ],
        ),
    ]
예제 #11
0
class Mensaje(models.Model):
    fecha = DateTimeUTCField()
    mensaje = encrypt(models.TextField())
    paciente = models.ForeignKey(Paciente, on_delete=models.CASCADE)
    paciente_emisor = models.IntegerField()
    notificado_email = models.BooleanField()
예제 #12
0
class Auditoria(models.Model):
    fecha = DateTimeUTCField()
    descripcion = models.CharField(max_length=250)
    direccion_ip = models.CharField(max_length=50)
    correo_usuario = models.CharField(max_length=50)
    tipo_usuario = models.CharField(max_length=50)