Commits

Alexandre Beaulieu committed f5a3ecc

Added missing views stubs. Fixed syncdb failing due to Category default value. Added navigation and partial styling to base template.

Comments (0)

Files changed (9)

achievements/models.py

     points   = models.IntegerField(default=0)
     icon     = models.FileField('Icon File', max_length=50, upload_to='achievements', blank=True, null=True, default=None) # Must be in PNG
     # --
-    category =  models.ForeignKey(Category, default=Category.objects.get(pk=1))
+    category =  models.ForeignKey(Category)
     users    =  models.ManyToManyField(User, through='Award', related_name='awards')
 
     def __unicode__(self):

achievements/views.py

 from django.shortcuts import render, redirect
 from django.contrib.auth.models import User
 
-from achievements.models import Achievement, Award
+from achievements.models import Achievement, Award, Category
 from achievements.forms import ImportForm
 from hard import utils
 
         return render(request, 'achievements/index.html', {'username': user.username,'achievements': achievements})
     else:
         return render(request, 'achievements/index.html', {'achievements': Achievement.objects.all()})
+        
+def list_honors(request, username=None):
+    # TODO: Filter achievements that are in Honors category and flesh out view.
+    return render(request, 'achievements/index.html', {'achievements': Achievement.objects.all()})
 
 def import_list(request):
     if request.method == 'POST':
-# Create your views here.
+def list(request, username=None):
+    pass
+    
+def new(request):
+    pass
+
+def delete(request):
+    pass
+    
+def statisfy(request):
+    pass

hard/static/css/monitor.css

 body { width: 100%; font-family: "Helvetica", sans-serif; font-size: 100%; color: #525252; }
 #container { margin: 0px auto; width: 850px; }
 
-#header { text-align: center; font-size: 4em; margin-bottom: 1em; }
+#header { text-align: center; }
+#header h1 { font-size: 4em; margin-bottom: 0.6em; }
+nav ul li {display: inline-block; padding: 0 15px; }
 h1, h2 { color: #0173A0; }
 
 #content h2 { font-size: 2em; }

hard/templates/base.html

       <div id="header">
         <header>
           <h1>H.A.R.D.</h1>
+          <nav>
+            <ul>
+              {% if user.is_authenticated %}<li><a title="Profile" href="/">{{ user.username }}</a></li>{% else %}<li><a title="Login" href="/login">Login</a></li>{% endif %}
+              <li><a title="Honors" href="/honors">Honors</a></li>
+              <li><a title="Achievements" href="/achievements">Achievements</a></li>
+              <li><a title="Responsibilities" href="/responsibilities">Responsibilities</a></li>
+              <li><a title="Desires" href="/desires">Desires</a></li>
+              {% if user.is_authenticated %}<li><a title="Logout" href="/logout">Logout</a></li>{% endif %}
+            </ul>
+          </nav>
         </header>
         
       </div>

hard/templates/hard/profile.html

+{% extends 'base.html' %}
+{% load url from future %}
+{% block title %}Home{% endblock %}{% block view_title %}{% endblock %}
+{% block content %}
+{% endblock %}
 urlpatterns = patterns('',
     url(r'^$', 'hard.views.profile', name='profile'),
     url(r'^login/$', 'django.contrib.auth.views.login', name='login'),
+    url(r'^logout/$', 'django.contrib.auth.views.logout', name='logout'),
     url(r'^register/$', 'hard.views.register', name='register'),
     url(r'^register/success/$', 'hard.views.register_success', name='register_success'),
+    # Honors &c.
+    url(r'^honors/$', 'achievements.views.list_honors', name='honors list'),
+    url(r'^honors/user/(?P<username>[a-z]+)/$', 'achievements.views.list_honors', name='user honors'),
 )
-# Create your views here.
+def list(request, username=None):
+    pass
+
+def claim(request, task_id):
+    pass
+
+def drop(request, task_id):
+    pass
 urlpatterns = patterns('',
     url(r'^', include('HARD.hard.urls'), name='index'),
     url(r'^achievements/', include('HARD.achievements.urls'), name='achievements'),
+    url(r'^responsibilities/', include('HARD.tasks.urls'), name='responsibilities'),
+    url(r'^desires/', include('HARD.desires.urls'), name='desires'),
     url(r'^admin/', include(admin.site.urls)),
 )