Skip to content

Commit

Permalink
Create default primary key for django 3.2
Browse files Browse the repository at this point in the history
FixDaily Stat django check warning
  • Loading branch information
mrchrisadams committed Oct 19, 2023
1 parent 575daf2 commit 99f046e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion apps/accounts/models/hosting.py
Original file line number Diff line number Diff line change
Expand Up @@ -846,7 +846,7 @@ class Meta:


class HostingproviderStats(models.Model):
hostingprovider = models.ForeignKey(
hostingprovider = models.OneToOneField(
Hostingprovider,
on_delete=models.CASCADE,
db_column="id_hp",
Expand Down
8 changes: 6 additions & 2 deletions apps/greencheck/models/stats.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,12 @@

logger = logging.getLogger(__name__)

now = timezone.now()
yesterday = now - relativedelta(days=1)
def yesterday():
"""Return the the day before today.
Used as default value for date fields.
"""
now = timezone.now()
return now - relativedelta(days=1)


class Stats(models.Model):
Expand Down

0 comments on commit 99f046e

Please sign in to comment.