fix pep8 warnings and add empty message to notes tab
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
from django.contrib.auth.decorators import login_required
|
||||
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.utils import notes_enabled_for_course
|
||||
|
||||
@@ -12,9 +12,9 @@ class Note(models.Model):
|
||||
uri = models.CharField(max_length=1024, db_index=True)
|
||||
text = 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_end = models.CharField(max_length=2048) # xpath string
|
||||
range_end = models.CharField(max_length=2048) # xpath string
|
||||
range_end_offset = models.IntegerField()
|
||||
tags = models.TextField(default="") # comma-separated string
|
||||
created = models.DateTimeField(auto_now_add=True, null=True, db_index=True)
|
||||
|
||||
@@ -16,11 +16,9 @@ def notes(request, course_id):
|
||||
raise Http404
|
||||
|
||||
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 = {
|
||||
'course': course,
|
||||
'notes': notes,
|
||||
'json_notes': json_notes
|
||||
'notes': notes
|
||||
}
|
||||
|
||||
return render_to_response('notes.html', context)
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
<%namespace name='static' file='static_content.html'/>
|
||||
<%inherit file="main.html" />
|
||||
<%!
|
||||
from django.core.urlresolvers import reverse
|
||||
%>
|
||||
|
||||
<%block name="headextra">
|
||||
<%static:css group='course'/>
|
||||
@@ -52,7 +55,7 @@
|
||||
|
||||
<section class="container">
|
||||
<div class="notes-wrapper">
|
||||
<h2>My Notes</h2>
|
||||
<h1>My Notes</h1>
|
||||
% for note in notes:
|
||||
<div class="note">
|
||||
<blockquote>${note.quote|h}</blockquote>
|
||||
@@ -67,6 +70,9 @@
|
||||
</ul>
|
||||
</div>
|
||||
% endfor
|
||||
% if notes is UNDEFINED or len(notes) == 0:
|
||||
<p>You do not have any notes.</p>
|
||||
% endif
|
||||
</div>
|
||||
</section>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user