Added API view for server time.
This commit is contained in:
parent
9599e4c022
commit
30e390dcfb
@ -34,9 +34,6 @@ class Clock(ProjectorElement):
|
||||
"""
|
||||
name = 'core/clock'
|
||||
|
||||
def get_context(self):
|
||||
return {'server_time': now().timestamp()}
|
||||
|
||||
|
||||
class Countdown(ProjectorElement):
|
||||
"""
|
||||
@ -80,7 +77,6 @@ class Countdown(ProjectorElement):
|
||||
|
||||
def get_context(self):
|
||||
self.validate_config(self.config_entry)
|
||||
return {'server_time': now().timestamp()}
|
||||
|
||||
@classmethod
|
||||
def validate_config(cls, config_data):
|
||||
|
@ -8,6 +8,10 @@ urlpatterns = patterns(
|
||||
views.UrlPatternsView.as_view(),
|
||||
name='core_url_patterns'),
|
||||
|
||||
url(r'^core/servertime/$',
|
||||
views.ServerTime.as_view(),
|
||||
name='core_servertime'),
|
||||
|
||||
url(r'^core/version/$',
|
||||
views.VersionView.as_view(),
|
||||
name='core_version'),
|
||||
|
@ -9,6 +9,7 @@ from django.contrib.staticfiles import finders
|
||||
from django.core.urlresolvers import get_resolver
|
||||
from django.db.models import F
|
||||
from django.http import Http404, HttpResponse
|
||||
from django.utils.timezone import now
|
||||
|
||||
from openslides import __version__ as version
|
||||
from openslides.utils import views as utils_views
|
||||
@ -529,6 +530,16 @@ class UrlPatternsView(utils_views.APIView):
|
||||
return result
|
||||
|
||||
|
||||
class ServerTime(utils_views.APIView):
|
||||
"""
|
||||
Returns the server time as UNIX timestamp.
|
||||
"""
|
||||
http_method_names = ['get']
|
||||
|
||||
def get_context_data(self, **context):
|
||||
return now().timestamp()
|
||||
|
||||
|
||||
class VersionView(utils_views.APIView):
|
||||
"""
|
||||
Returns a dictionary with the OpenSlides version and the version of all
|
||||
|
Loading…
Reference in New Issue
Block a user