From 137149fd3d80d904372458afa448910be5c591e7 Mon Sep 17 00:00:00 2001 From: baoliang Date: Tue, 27 Oct 2020 21:02:08 +0800 Subject: [PATCH] add message --- polls/models.py | 5 ++++- polls/urls.py | 3 ++- polls/views/__init__.py | 2 +- .../views/__pycache__/__init__.cpython-38.pyc | Bin 1584 -> 1605 bytes polls/views/__pycache__/app.cpython-38.pyc | Bin 0 -> 1277 bytes .../views/__pycache__/download.cpython-38.pyc | Bin 898 -> 1275 bytes polls/views/{app.py => download.py} | 4 ++-- 7 files changed, 9 insertions(+), 5 deletions(-) create mode 100644 polls/views/__pycache__/app.cpython-38.pyc rename polls/views/{app.py => download.py} (90%) diff --git a/polls/models.py b/polls/models.py index 6cac1ef..e4f3d41 100644 --- a/polls/models.py +++ b/polls/models.py @@ -212,4 +212,7 @@ class AppVersion(models.Model): id = models.UUIDField('id', primary_key=True, default=uuid.uuid4) version = models.IntegerField('version', default=1) added = models.DateTimeField(auto_now_add=True) - updated = models.DateTimeField(auto_now=True) \ No newline at end of file + updated = models.DateTimeField(auto_now=True) + + class Meta: + ordering = ["-version"] diff --git a/polls/urls.py b/polls/urls.py index df27fe8..1e51507 100644 --- a/polls/urls.py +++ b/polls/urls.py @@ -71,5 +71,6 @@ urlpatterns = [ path('messages/read/', views.read_message, name='polls_message_read'), path('app/intro.html', views.app_intro, name='polls_app_intro'), - path('app/download/', views.download, name='polls_app_download') + path('app/download/', views.download, name='polls_app_download'), + path('app/has/update/', views.has_update, name='polls_app_has_update') ] diff --git a/polls/views/__init__.py b/polls/views/__init__.py index 6879918..5f45fd7 100644 --- a/polls/views/__init__.py +++ b/polls/views/__init__.py @@ -8,4 +8,4 @@ from .group import groups, room, is_level1_or_leve2, group_member, group_manager from .compartment import compartments from .organizations import organizations, organization_level from .message import last_messages, send_text_message, is_read_message, read_message -from .app import download, app_intro +from .download import download, app_intro, has_update diff --git a/polls/views/__pycache__/__init__.cpython-38.pyc b/polls/views/__pycache__/__init__.cpython-38.pyc index 103621d681d94be7fc7d9160cd21c82da8458e61..552b9a2b3ae626f457902f4e06d1dd6a9f146b42 100644 GIT binary patch delta 99 zcmdnMbCicSl$V!_0SNphXT+bG$Scceuu)r+ktNqQ%64-I;}<4X=35*o`Q>>z`H3mF zI1>vB;xqF~it=x9Wh55ImlmWXmZbV=+HFo`@n+;JG6Nd4lA*{RNEO*n-pX1H0Jw1; ADF6Tf delta 77 zcmX@gvw?>zi7B@@6AKFB fGxJJ{^8GYzHy5&aGjgtED6#|UEV7$?inSU5Oi33E diff --git a/polls/views/__pycache__/app.cpython-38.pyc b/polls/views/__pycache__/app.cpython-38.pyc new file mode 100644 index 0000000000000000000000000000000000000000..aff7a9e42fb8aa51d569e845769710839af8a624 GIT binary patch literal 1277 zcmY*Y&5s*36t_K}nM}gApduk8xBwc7O}16x00mLC6;O$-*tUQoq{xZAo0*-l2iw`D zQF7^WMI5{yzOHKSCq>spU#+m05d zsZ|Uoz+0mDPfM=N3#8ng{~nH?YH&WDQCXK%9F1EgD?T@Rd~5I4-nfyovgTvKPaDok z+DK6vsi2f`=l-PRr(KZtne9QaX(^17smsYBjj+l=zLL1h#KrcBKL^F23U3L+=Xiq| zS>q}=#5d4}n6Qeru}P|QP0qE*Gf^Bf`9t%Az&zI z!#`WSey=;Qd%pzYb?JN-uPKL@P2|iYZ^N2uqXuq`NNvNGnuQH3SqkMawb?fh?tguE zdhqDc6C3lNOKsqgY`IXO+YS|{%%(G{eNg3^q=;3|?FCSaO)vAYJ*Q2*e{#66sk&%K z-y5CiyK5glp&)bO`pN4q{ncnBq`_dzR$ z>N-re&nkE)as*T#c6?l}EZ{+Vv^@_#sNK0Ztrt?6`O;{WfRjn?pUtDh zw?6{L7qIk?AQ)n}LPNKc3fE*vu+xJosKa4cN5iO&hq3<`R!N->Q?Ex=r_P2M=rK!v zLBlRfSqJuLo!vXTMJ>l=#S6htYtBkq zOHmrBV3cB${-ormx?u8DRFbkm^U`*p;;0lx$<#IG;6_;GAm8cUwc{G_-M<3GpgCTX zbF{(?w|E{*@eQ;hCY(p>*d+6`CFf)nc)QaE=UBZkSsO5NMt=Kr6`F1vuJd!Cj)lLH zRm39ix#c`>qBdgjeULvOg6^U3&>{L0J@NZ>**cT^)4X9vBmM|xs9MdDdL)Bzfo^Zf5pGaZ2FeCG_;mfO~s7k><`)~^A30m_9 z%lGy+4m*!Zpj?+OXa9q33fE<_dy_>;T&(n$}zz)B5z_saP}r8H?aBu&fg*1wcvX5WPc1wi{@wz zL^DS!He?>GL!h3Rhy^Wa@iEZ&2RU=EDB4$7A;RKMY@!#F3D>$$Y^)763vH7cY+#}v z+u+N`Pi=6-jmK17fgrW*L9`xX0F-Q+pdI(;u;3;5A=^uo$?Hj5~vYXCKD3k;t zdKC%#1rj{!YZ6`%;btS#G zv%PbJRb+Hd+ARO{HyWJBY0~J+skZJ0j4FG0`X%DH6}~DOKh!yT``-zfeef+mn=v@Z za3x%jg@kJ{$J%eqaE<27MKdJvRs4887f#N^O09tc3crhaK#f`%d*x%81r+re4?#SG zSMULb@DuiHJ_6TVAhDOo!L^(e<8n`A_@MkPwx0$(K@}REQl-vPtMhcMjh`_Ijbti& z!RD@F!_*LaxuW7K9~CM2f7lKKU>93_yZ8_vp?SiQq-oma$FMi7x|F5)Me)*pDvUdy hI&1ub>dn;3zm@;*(H|Ey9qBiIch)yjb^Vr5;XROEY3cv~ diff --git a/polls/views/app.py b/polls/views/download.py similarity index 90% rename from polls/views/app.py rename to polls/views/download.py index ee58de1..54077f6 100644 --- a/polls/views/app.py +++ b/polls/views/download.py @@ -10,7 +10,7 @@ def app_intro(request): def download(request): - app = AppVersion.objects.last('version') + app = AppVersion.objects.first() filename = 'app-%s.apk' % (app.version,) file_path = os.path.join(settings.MEDIA_ROOT, filename) if os.path.exists(file_path): @@ -25,5 +25,5 @@ def download(request): def has_update(request): version = request.GET.get('version', '1') - last = AppVersion.objects.last('version') + last = AppVersion.objects.first() return JsonResponse({'status': 'success', 'message': last != version})