-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
61 additions
and
31 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
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 |
---|---|---|
@@ -1,6 +1,6 @@ | ||
[project] | ||
name = "DjangoAsyncAdmin" | ||
version = "6.6.0" | ||
version = "6.7.0" | ||
authors = [ | ||
{ name = "Sadam·Sadik", email = "[email protected]" }, | ||
] | ||
|
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,26 @@ | ||
from django.db import models | ||
from simplepro.editor import fields | ||
|
||
|
||
class BaseModel(models.Model): | ||
# id = models.IntegerField(primary_key=True, null=False, auto_created=True, editable=False) | ||
createdAt = models.DateTimeField(auto_created=True, auto_now_add=True, verbose_name="创建时间", null=True, | ||
editable=False, db_index=True) | ||
updatedAt = models.DateTimeField(auto_now=True, verbose_name="最近更新时间", null=True, editable=False, db_index=True) | ||
deletedAt = models.DateTimeField(verbose_name="被删除时间", null=True, editable=False, db_index=True) | ||
info = fields.UETextField(verbose_name='说明', null=True, blank=True) | ||
|
||
class Meta: | ||
abstract = True | ||
ordering = ['-updatedAt'] | ||
|
||
|
||
class BaseModelWithShowRate(BaseModel): | ||
showTimes = models.IntegerField(verbose_name="被观看次数", default=0, editable=False) | ||
|
||
def show(self): | ||
self.showTimes += 1 | ||
self.save() | ||
|
||
class Meta: | ||
abstract = True |