make token and last seen date in backend readonly
This commit is contained in:
parent
6c3aa0b7d5
commit
7c3bd62cbb
3 changed files with 6 additions and 1 deletions
BIN
db.sqlite3
BIN
db.sqlite3
Binary file not shown.
|
@ -22,6 +22,11 @@ class UserAdmin(admin.ModelAdmin):
|
||||||
UserAnswerInline,
|
UserAnswerInline,
|
||||||
]
|
]
|
||||||
|
|
||||||
|
def get_readonly_fields(self, request, obj=None):
|
||||||
|
|
||||||
|
return self.readonly_fields + ('token', 'last_seen')
|
||||||
|
|
||||||
|
|
||||||
admin.site.register(Question, QuestionAdmin)
|
admin.site.register(Question, QuestionAdmin)
|
||||||
admin.site.register(Setting),
|
admin.site.register(Setting),
|
||||||
admin.site.register(User, UserAdmin)
|
admin.site.register(User, UserAdmin)
|
||||||
|
|
|
@ -50,7 +50,7 @@ class User(models.Model):
|
||||||
|
|
||||||
token = models.CharField(max_length=40, null=True, default=gen_token)
|
token = models.CharField(max_length=40, null=True, default=gen_token)
|
||||||
name = models.CharField(max_length=100, null=False)
|
name = models.CharField(max_length=100, null=False)
|
||||||
last_seen = models.DateTimeField(null=True)
|
last_seen = models.DateTimeField(null=True, blank=True)
|
||||||
|
|
||||||
def __unicode__(self):
|
def __unicode__(self):
|
||||||
return self.name
|
return self.name
|
||||||
|
|
Loading…
Reference in a new issue