Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
e244074b81
|
@ -213,3 +213,6 @@ class AppVersion(models.Model):
|
|||
version = models.IntegerField('version', default=1)
|
||||
added = models.DateTimeField(auto_now_add=True)
|
||||
updated = models.DateTimeField(auto_now=True)
|
||||
|
||||
class Meta:
|
||||
ordering = ["-version"]
|
||||
|
|
|
@ -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')
|
||||
]
|
||||
|
|
|
@ -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
|
||||
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -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})
|
Loading…
Reference in New Issue