add message
This commit is contained in:
parent
8583b5c5a7
commit
137149fd3d
|
@ -212,4 +212,7 @@ class AppVersion(models.Model):
|
||||||
id = models.UUIDField('id', primary_key=True, default=uuid.uuid4)
|
id = models.UUIDField('id', primary_key=True, default=uuid.uuid4)
|
||||||
version = models.IntegerField('version', default=1)
|
version = models.IntegerField('version', default=1)
|
||||||
added = models.DateTimeField(auto_now_add=True)
|
added = models.DateTimeField(auto_now_add=True)
|
||||||
updated = models.DateTimeField(auto_now=True)
|
updated = models.DateTimeField(auto_now=True)
|
||||||
|
|
||||||
|
class Meta:
|
||||||
|
ordering = ["-version"]
|
||||||
|
|
|
@ -71,5 +71,6 @@ urlpatterns = [
|
||||||
path('messages/read/', views.read_message,
|
path('messages/read/', views.read_message,
|
||||||
name='polls_message_read'),
|
name='polls_message_read'),
|
||||||
path('app/intro.html', views.app_intro, name='polls_app_intro'),
|
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 .compartment import compartments
|
||||||
from .organizations import organizations, organization_level
|
from .organizations import organizations, organization_level
|
||||||
from .message import last_messages, send_text_message, is_read_message, read_message
|
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):
|
def download(request):
|
||||||
app = AppVersion.objects.last('version')
|
app = AppVersion.objects.first()
|
||||||
filename = 'app-%s.apk' % (app.version,)
|
filename = 'app-%s.apk' % (app.version,)
|
||||||
file_path = os.path.join(settings.MEDIA_ROOT, filename)
|
file_path = os.path.join(settings.MEDIA_ROOT, filename)
|
||||||
if os.path.exists(file_path):
|
if os.path.exists(file_path):
|
||||||
|
@ -25,5 +25,5 @@ def download(request):
|
||||||
|
|
||||||
def has_update(request):
|
def has_update(request):
|
||||||
version = request.GET.get('version', '1')
|
version = request.GET.get('version', '1')
|
||||||
last = AppVersion.objects.last('version')
|
last = AppVersion.objects.first()
|
||||||
return JsonResponse({'status': 'success', 'message': last != version})
|
return JsonResponse({'status': 'success', 'message': last != version})
|
Loading…
Reference in New Issue