From 7c3bd62cbbcdbe8ef54ef4ee84f607ae8e5a2c65 Mon Sep 17 00:00:00 2001 From: tkupek Date: Sat, 5 Mar 2016 11:40:40 +0100 Subject: [PATCH] make token and last seen date in backend readonly --- db.sqlite3 | Bin 107520 -> 107520 bytes tkupek_elearning/elearning/admin.py | 5 +++++ tkupek_elearning/elearning/models.py | 2 +- 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/db.sqlite3 b/db.sqlite3 index 08a2f874a74ab717f4cc022987240cc06ac53d40..3203e0478df6903fd530affa8c2436e35c826b71 100644 GIT binary patch delta 948 zcmZ{iO=uHQ6ou#An>I~SDXG;WZJ|&V(=;#dXZ|vF6QnNGO&5YLtX49bsS+_wQBY_> zx>6xBOTlFk6p983Sfxw5b1EjcXS;+j=aNjcgbI@1$Qcgjc=(FWfZU-#%t$Bdf*Q}!pnFX$1nxE zumiu~Cwzx5u&w9;O!pumNuiZ%Wm@xEsn(pS|{~MCQRSkQKa24et&id^O(U2 zg&D>)rci-lS0SE)E(jU{8nJhx5ug#E5ug!}4NIG+8nX{RPWQrR*o4=r%5yk*xHWdC z&UC)$XBnnr`7pLI(=VAPBrUj1IEBW=jrB{T{bbd^cesEq_Q6+p2~{XUn*1Pd$*My5 zWH~Dm#=sGBh>)UFQ|rVe2*&LklR0LMbLN@M<1Q7JWXxeaGAE9;&Bap5FVSuZNu_jb zX=d5K@@BX4%bs*SQ&Oj3O2%nkxkq#}*7d4Ce=FGEPutHdY38Z&k7>WX=NJ11Pyr#R zC2cOHnTrB?fL35RsEO`VNXL^lbzNaOLQX|}=~%n314E)fxhtgWX0iz*J)oQ8?!4On z|9h3TXGvN%ZQF7sos7I1puDZxT>_>}3%0PC$ug>;)`!q*J)j%Q6O3}n)zw@WCND0; ZjDWmX|I3x;`VBHmnn8)2g|#x7{tG&XypR9@ delta 238 zcmZoT!PansZGtqT&qNt#MxTud+u1qyFgr3YW1he~VY47hH`Cfq@%{ zL16QJZq*EC4Q9c~>?L08&CHR^*37a%n|3ly7A*e^lrWvlUJ(csxXU!TV86`f!0Np= zK;Ac|$t=5Fd5lc0j1Bcn%?->g%{GVbULV21#GJ*zyp=f%s3wkidzLukJRcUO^$eMl Y1zBRZ?@DEKW7?jX!WhW7EQ8So0CLDhP5=M^ diff --git a/tkupek_elearning/elearning/admin.py b/tkupek_elearning/elearning/admin.py index 996a8b3..5adec31 100644 --- a/tkupek_elearning/elearning/admin.py +++ b/tkupek_elearning/elearning/admin.py @@ -22,6 +22,11 @@ class UserAdmin(admin.ModelAdmin): UserAnswerInline, ] + def get_readonly_fields(self, request, obj=None): + + return self.readonly_fields + ('token', 'last_seen') + + admin.site.register(Question, QuestionAdmin) admin.site.register(Setting), admin.site.register(User, UserAdmin) diff --git a/tkupek_elearning/elearning/models.py b/tkupek_elearning/elearning/models.py index 44defd0..155c696 100644 --- a/tkupek_elearning/elearning/models.py +++ b/tkupek_elearning/elearning/models.py @@ -50,7 +50,7 @@ class User(models.Model): token = models.CharField(max_length=40, null=True, default=gen_token) 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): return self.name