-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add common model so we can inherit timestamped model wherever we want…
…, DRY
- Loading branch information
Showing
3 changed files
with
25 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
from django.db import models | ||
|
||
|
||
class TimeStampedModel(models.Model): | ||
created_at = models.DateTimeField(auto_now_add=True) | ||
modified_at = models.DateTimeField(auto_now=True) | ||
|
||
class Meta: | ||
abstract = True |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
from django.contrib.auth import get_user_model | ||
|
||
from config import celery_app | ||
|
||
from .models import FileModel | ||
|
||
User = get_user_model() | ||
|
||
|
||
@celery_app.task() | ||
def get_users_count(): | ||
"""A pointless Celery task to demonstrate usage.""" | ||
return User.objects.count() |