-
-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(stats): add to admin, cleanup (#479)
- Loading branch information
Showing
5 changed files
with
32 additions
and
5 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 |
---|---|---|
@@ -0,0 +1,16 @@ | ||
from django.contrib import admin | ||
from solo.admin import SingletonModelAdmin | ||
|
||
from open_prices.stats.models import TotalStats | ||
|
||
|
||
@admin.register(TotalStats) | ||
class TotalStatsAdmin(SingletonModelAdmin): | ||
EXCLUDED_FIELDS = ["id"] | ||
|
||
# to keep order | ||
def get_fields(self, request, obj=None): | ||
return [f.name for f in obj._meta.fields if f.name not in self.EXCLUDED_FIELDS] | ||
|
||
def get_readonly_fields(self, request, obj=None): | ||
return [f.name for f in obj._meta.fields] |
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
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