mirror of
https://github.com/nikdoof/test-auth.git
synced 2025-12-14 06:42:16 +00:00
Limit admin fields to User/Reddit User, stopping odd error messages
This commit is contained in:
@@ -5,4 +5,10 @@ class RedditAccountAdmin(admin.ModelAdmin):
|
||||
list_display = ('username', 'user', 'date_created', 'link_karma', 'comment_karma', 'last_update')
|
||||
search_fields = ['username', 'user']
|
||||
|
||||
fields = ('user', 'username')
|
||||
|
||||
def save_model(self, request, obj, form, change):
|
||||
obj.api_update()
|
||||
obj.save()
|
||||
|
||||
admin.site.register(RedditAccount, RedditAccountAdmin)
|
||||
|
||||
@@ -11,15 +11,15 @@ class RedditAccount(models.Model):
|
||||
|
||||
user = models.ForeignKey(User, blank=True, null=True)
|
||||
|
||||
username = models.CharField("Username", max_length=32, blank=False)
|
||||
reddit_id = models.CharField("Reddit ID", max_length=32, blank=True)
|
||||
username = models.CharField("Reddit Username", max_length=32, blank=False)
|
||||
reddit_id = models.CharField("Reddit ID", max_length=32)
|
||||
|
||||
date_created = models.DateTimeField("Date Created", blank=True)
|
||||
date_created = models.DateTimeField("Date Created")
|
||||
|
||||
link_karma = models.IntegerField("Link Karma", blank=True, null=True)
|
||||
comment_karma = models.IntegerField("Comment Karma", blank=True, null=True)
|
||||
link_karma = models.IntegerField("Link Karma")
|
||||
comment_karma = models.IntegerField("Comment Karma")
|
||||
|
||||
last_update = models.DateTimeField("Last Update from API", blank=False)
|
||||
last_update = models.DateTimeField("Last Update from API")
|
||||
|
||||
def api_update(self):
|
||||
try:
|
||||
|
||||
Reference in New Issue
Block a user