Commit 026773b5 by Arthur Barrett

fix pep8 warnings and add empty message to notes tab

parent 996b3513
from django.contrib.auth.decorators import login_required from django.contrib.auth.decorators import login_required
from django.http import HttpResponse, Http404 from django.http import HttpResponse, Http404
from django.core.exceptions import ValidationError from django.core.exceptions import ValidationError
from notes.models import Note from notes.models import Note
from notes.utils import notes_enabled_for_course from notes.utils import notes_enabled_for_course
......
...@@ -12,9 +12,9 @@ class Note(models.Model): ...@@ -12,9 +12,9 @@ class Note(models.Model):
uri = models.CharField(max_length=1024, db_index=True) uri = models.CharField(max_length=1024, db_index=True)
text = models.TextField(default="") text = models.TextField(default="")
quote = models.TextField(default="") quote = models.TextField(default="")
range_start = models.CharField(max_length=2048) # xpath string range_start = models.CharField(max_length=2048) # xpath string
range_start_offset = models.IntegerField() range_start_offset = models.IntegerField()
range_end = models.CharField(max_length=2048) # xpath string range_end = models.CharField(max_length=2048) # xpath string
range_end_offset = models.IntegerField() range_end_offset = models.IntegerField()
tags = models.TextField(default="") # comma-separated string tags = models.TextField(default="") # comma-separated string
created = models.DateTimeField(auto_now_add=True, null=True, db_index=True) created = models.DateTimeField(auto_now_add=True, null=True, db_index=True)
......
...@@ -16,11 +16,9 @@ def notes(request, course_id): ...@@ -16,11 +16,9 @@ def notes(request, course_id):
raise Http404 raise Http404
notes = Note.objects.filter(course_id=course_id, user=request.user).order_by('-created', 'uri') notes = Note.objects.filter(course_id=course_id, user=request.user).order_by('-created', 'uri')
json_notes = json.dumps([n.as_dict() for n in notes])
context = { context = {
'course': course, 'course': course,
'notes': notes, 'notes': notes
'json_notes': json_notes
} }
return render_to_response('notes.html', context) return render_to_response('notes.html', context)
<%namespace name='static' file='static_content.html'/> <%namespace name='static' file='static_content.html'/>
<%inherit file="main.html" /> <%inherit file="main.html" />
<%!
from django.core.urlresolvers import reverse
%>
<%block name="headextra"> <%block name="headextra">
<%static:css group='course'/> <%static:css group='course'/>
...@@ -52,7 +55,7 @@ ...@@ -52,7 +55,7 @@
<section class="container"> <section class="container">
<div class="notes-wrapper"> <div class="notes-wrapper">
<h2>My Notes</h2> <h1>My Notes</h1>
% for note in notes: % for note in notes:
<div class="note"> <div class="note">
<blockquote>${note.quote|h}</blockquote> <blockquote>${note.quote|h}</blockquote>
...@@ -67,6 +70,9 @@ ...@@ -67,6 +70,9 @@
</ul> </ul>
</div> </div>
% endfor % endfor
% if notes is UNDEFINED or len(notes) == 0:
<p>You do not have any notes.</p>
% endif
</div> </div>
</section> </section>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment