Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fixed support for users with no logs.

  • Loading branch information...
commit a658c9da0a5bbd7ac32922104ab78a33cea8e883 1 parent 1bfd1ba
Johan authored
View
42 apps/log/views.py
@@ -15,23 +15,31 @@ def latest(request):
data = []
for user in users:
- entry = user.log_entries.all()[0]
- latest_checkin_entry = user.log_entries.filter(on_illutron=True)[0]
-
- if user.first_name and user.last_name:
- name = user.first_name + user.last_name
- else:
- name = user.username
-
- data.append({
- 'member': name,
- 'on_illutron': entry.on_illutron,
- 'latest_checkin_time': latest_checkin_entry.time.isoformat(),
- #'last_log_entry': entry.time.isoformat(),
- #'latitude': entry.latitude,
- #'longitude': entry.longitude,
-
- })
+ try:
+ entry = user.log_entries.all()[0]
+
+ try:
+ latest_checkin_entry = user.log_entries.filter(on_illutron=True)[0].time.isoformat()
+ except:
+ latest_checkin_entry = False
+
+ if user.first_name and user.last_name:
+ name = user.first_name + " " + user.last_name
+ else:
+ name = user.username
+
+ data.append({
+ 'member': name,
+ 'on_illutron': entry.on_illutron,
+ 'latest_checkin_time': latest_checkin_entry,
+ #'last_log_entry': entry.time.isoformat(),
+ #'latitude': entry.latitude,
+ #'longitude': entry.longitude,
+ })
+
+ except:
+ pass
+
return HttpResponse(simplejson.dumps(data))
View
4 settings.py
@@ -23,8 +23,8 @@
STATIC_URL = '/static/'
else:
DEBUG = False
- MEDIA_URL = 'http://media.illutronlog.johan.cc/'
- STATIC_URL = 'http://static.illutronlog.johan.cc/'
+ MEDIA_URL = 'http://media.illutrondashboard.johan.cc/'
+ STATIC_URL = 'http://static.illutrondashboard.johan.cc/'
ADMIN_MEDIA_PREFIX = STATIC_URL + 'admin/'
CACHES = {
'default': {
View
17 templates/index.html → templates/dashboard.html
@@ -3,13 +3,13 @@
<head>
<title>Illutron Checkin</title>
- <link href="stylesheets/screen.css" media="all" rel="stylesheet" type="text/css"/>
- <script src="vendor/json/json2.js"></script>
- <script src="vendor/jquery-1.6.4.min.js"></script>
- <script src="vendor/underscore-min.js"></script>
- <script src="vendor/backbone-min.js"></script>
- <!-- <script src="vendor/backbone-localstorage.js"></script> -->
- <script src="javascripts/main.js"></script>
+ <link href="{{ STATIC_URL }}stylesheets/screen.css" media="all" rel="stylesheet" type="text/css"/>
+ <script src="{{ STATIC_URL }}vendor/json/json2.js"></script>
+ <script src="{{ STATIC_URL }}vendor/jquery-1.6.4.min.js"></script>
+ <script src="{{ STATIC_URL }}vendor/underscore-min.js"></script>
+ <script src="{{ STATIC_URL }}vendor/backbone-min.js"></script>
+ <!-- <script src="{{ STATIC_URL }}vendor/backbone-localstorage.js"></script> -->
+ <script src="{{ STATIC_URL }}javascripts/main.js"></script>
</head>
<body>
@@ -19,9 +19,6 @@
</div>
-
-
-
<!-- Templates -->
<script type="text/template" id="person-template">
View
BIN  test.db
Binary file not shown
View
4 urls.py
@@ -4,10 +4,14 @@
admin.autodiscover()
urlpatterns = patterns('',
+
+ url(r'^$', 'views.dashboard', name='dashboard'),
+
url(r'^api/', include('log.urls')),
# Uncomment the admin/doc line below to enable admin documentation:
# url(r'^admin/doc/', include('django.contrib.admindocs.urls')),
url(r'^admin/', include(admin.site.urls)),
+
)
View
4 views.py
@@ -0,0 +1,4 @@
+from django.shortcuts import render
+
+def dashboard(request):
+ return render(request, "dashboard.html")
Please sign in to comment.
Something went wrong with that request. Please try again.