summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
Diffstat (limited to 'app')
-rw-r--r--app/notes/forms.py5
-rw-r--r--app/notes/templates/notes/note_form.html1
-rw-r--r--app/notes/templates/notes/note_list.html3
-rw-r--r--app/posts/templates/posts/post_list.html20
4 files changed, 10 insertions, 19 deletions
diff --git a/app/notes/forms.py b/app/notes/forms.py
index 5cde108..4342b89 100644
--- a/app/notes/forms.py
+++ b/app/notes/forms.py
@@ -7,9 +7,14 @@ class NoteCreateForm(ModelForm):
def __init__(self,*args,**kwargs):
user = kwargs.pop('user')
+ self.user = user
super(NoteCreateForm,self).__init__(*args,**kwargs)
self.fields['post'].queryset = Post.objects.filter(user=user).order_by("title")
+ def save(self, commit=True):
+ self.instance.user = self.user
+ return super().save(commit=commit)
+
class Meta:
model = Note
fields = ['title', 'url', 'body_markdown', 'post']
diff --git a/app/notes/templates/notes/note_form.html b/app/notes/templates/notes/note_form.html
index 10d81ac..48ccde1 100644
--- a/app/notes/templates/notes/note_form.html
+++ b/app/notes/templates/notes/note_form.html
@@ -4,7 +4,6 @@
<form action="" method="post" class="comment-form">{% csrf_token %}
{% for field in form %}
<fieldset>
-
{%if field.name == "post" or field.name == "status" %}<span class="selector">{{field.label_tag}}</span>{%else%}{{field.label_tag}}{%endif%}
{%if field.name == "body_markdown"%}<div class="textarea-rounded">{{ field }}</div>{%else%}{{field}}{%endif%}
</fieldset>
diff --git a/app/notes/templates/notes/note_list.html b/app/notes/templates/notes/note_list.html
index c4d287c..2c74335 100644
--- a/app/notes/templates/notes/note_list.html
+++ b/app/notes/templates/notes/note_list.html
@@ -1,6 +1,9 @@
{% extends 'base.html' %}
{% block primary %}
<main class="post-detail">
+ <div class="post-header">
+ <a href="/notes/create" class="btn">New Note</a>
+ </div>
<div class="note-list">{% for object in object_list %}<article>
<h2>{%if object.url%}<a href="{{object.url}}">{{object.title}}</a>{%else%}{{object.title}}{%endif%}<span class="note-edit"><a href="{{object.get_absolute_url}}">edit</a></span></h2>
<p>{{object.body_markdown}}</p>
diff --git a/app/posts/templates/posts/post_list.html b/app/posts/templates/posts/post_list.html
index f2e9e7a..1abd65c 100644
--- a/app/posts/templates/posts/post_list.html
+++ b/app/posts/templates/posts/post_list.html
@@ -9,50 +9,36 @@
<thead>
<tr>
<th scope="col" class="sortable column-title">
-
<div class="text"><span>Title</span></div>
- <div class="clear"></div>
</th>
<th scope="col" class="column-admin_url">
-
<div class="text"><span>URL</span></div>
- <div class="clear"></div>
</th>
<th scope="col" class="sortable column-date_last_pub sorted ascending">
Date last pub
</th>
<th scope="col" class="sortable column-post_type">
<div class="text">Post type</div>
- <div class="clear"></div>
</th>
<th scope="col" class="sortable column-update_frequency">
-
-
-
<div class="text">Update frequency</div>
- <div class="clear"></div>
</th>
<th scope="col" class="sortable column-needs_update">
<div class="text">Needs update</div>
- <div class="clear"></div>
</th>
<th scope="col" class="column-days_overdue">
<div class="text"><span>Days overdue</span></div>
- <div class="clear"></div>
</th>
</tr>
</thead>
-<tbody>
-
-
-{% for object in object_list %}
+<tbody>{% for object in object_list %}
<tr>
<td class="field-title">
<a href="/post/{{object.id}}/notes">{{object.title}}</a>
</td>
<td class="field-admin_url">
<a target="_blank" href="{{object.url}}">
- {{object.url|truncatechars:45}}
+ {{object.url|truncatechars:55}}
</a>
</td>
<td class="field-date_last_pub nowrap">{{object.date_last_pub}}</td>
@@ -65,8 +51,6 @@ Date last pub
<td class="field-days_overdue">{{object.days_overdue}}</td></tr>
</tr>
{% endfor %}
-
-
</tbody>
</table>
</div>