Skip to content

Commit

Permalink
Cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
raphodn committed Jul 22, 2024
1 parent d2d0300 commit 0ccac3d
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 9 deletions.
4 changes: 2 additions & 2 deletions open_prices/locations/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@


class Location(models.Model):
osm_id = models.BigIntegerField(blank=True, null=True)
osm_id = models.PositiveBigIntegerField(blank=True, null=True)
osm_type = models.CharField(
max_length=10, choices=location_constants.OSM_TYPE_CHOICES
)
Expand All @@ -25,7 +25,7 @@ class Location(models.Model):
max_digits=11, decimal_places=7, blank=True, null=True
)

price_count = models.IntegerField()
price_count = models.PositiveIntegerField(blank=True, null=True)

created = models.DateTimeField(default=timezone.now)
updated = models.DateTimeField(auto_now=True)
Expand Down
2 changes: 1 addition & 1 deletion open_prices/prices/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class Price(models.Model):
max_length=3, choices=constants.CURRENCY_CHOICES, blank=True, null=True
)

location_osm_id = models.BigIntegerField(blank=True, null=True)
location_osm_id = models.PositiveBigIntegerField(blank=True, null=True)
location_osm_type = models.CharField(
max_length=10,
choices=location_constants.OSM_TYPE_CHOICES,
Expand Down
6 changes: 3 additions & 3 deletions open_prices/products/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@ class Product(models.Model):

nutriscore_grade = models.CharField(blank=True, null=True)
ecoscore_grade = models.CharField(blank=True, null=True)
nova_group = models.IntegerField(blank=True, null=True)
unique_scans_n = models.IntegerField()
nova_group = models.PositiveIntegerField(blank=True, null=True)
unique_scans_n = models.PositiveIntegerField(blank=True, null=True)

price_count = models.IntegerField()
price_count = models.PositiveIntegerField(blank=True, null=True)

created = models.DateTimeField(default=timezone.now)
updated = models.DateTimeField(auto_now=True)
Expand Down
9 changes: 6 additions & 3 deletions open_prices/proofs/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,12 @@ class Proof(models.Model):
mimetype = models.CharField(blank=True, null=True)
type = models.CharField(max_length=20, choices=proof_constants.TYPE_CHOICES)

location_osm_id = models.BigIntegerField(blank=True, null=True)
location_osm_id = models.PositiveBigIntegerField(blank=True, null=True)
location_osm_type = models.CharField(
max_length=10, choices=location_constants.OSM_TYPE_CHOICES, blank=True, null=True
max_length=10,
choices=location_constants.OSM_TYPE_CHOICES,
blank=True,
null=True,
)
location = models.ForeignKey(
"locations.Location",
Expand All @@ -27,7 +30,7 @@ class Proof(models.Model):
max_length=3, choices=constants.CURRENCY_CHOICES, blank=True, null=True
)

price_count = models.IntegerField()
price_count = models.PositiveIntegerField(blank=True, null=True)

owner = models.CharField(blank=True, null=True)
source = models.CharField(blank=True, null=True)
Expand Down
19 changes: 19 additions & 0 deletions open_prices/users/models.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
from django.db import models
from django.utils import timezone


class User(models.Model):
user_id = models.CharField(primary_key=True)

is_moderator = models.BooleanField(default=False)

price_count = models.PositiveIntegerField(blank=True, null=True)

created = models.DateTimeField(default=timezone.now)
# updated = models.DateTimeField(auto_now=True)

class Meta:
managed = False
db_table = "users"
verbose_name = "User"
verbose_name_plural = "Users"

0 comments on commit 0ccac3d

Please sign in to comment.