summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--app/posts/templates/posts/post_list.html84
-rw-r--r--app/posts/urls.py13
-rw-r--r--app/posts/views.py44
-rw-r--r--config/base_urls.py1
-rw-r--r--templates/base.html11
5 files changed, 145 insertions, 8 deletions
diff --git a/app/posts/templates/posts/post_list.html b/app/posts/templates/posts/post_list.html
new file mode 100644
index 0000000..4c54f62
--- /dev/null
+++ b/app/posts/templates/posts/post_list.html
@@ -0,0 +1,84 @@
+{% extends 'base.html' %}
+{%block extrahead%}
+<link href="/media/sortable.min.css" rel="stylesheet" />
+{%endblock%}
+{% block primary %}
+<div class="results">
+<table class="sortable" id="result_list">
+<thead>
+<tr>
+
+<th scope="col" class="action-checkbox-column">
+
+ <div class="text"><span><input type="checkbox" id="action-toggle"></span></div>
+ <div class="clear"></div>
+</th>
+<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"><a href="">Post type</a></div>
+ <div class="clear"></div>
+</th>
+<th scope="col" class="sortable column-update_frequency">
+
+
+
+ <div class="text"><a href="?o=6.4">Update frequency</a></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 %}
+<tr>
+ <td class="action-checkbox">
+ <input type="checkbox" name="_selected_action" value="349" class="action-select">
+ </td>
+ <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}}
+ </a>
+ </td>
+ <td class="field-date_last_pub nowrap">{{object.date_last_pub}}</td>
+ <td class="field-post_type">{{object.post_type}}</td>
+ <td class="field-update_frequency">{{object.update_frequency}}</td>
+ <td class="field-needs_update">{% if object.needs_update %}
+ <span class="hide">1</span><img src="/static/admin/img/icon-yes.svg" alt="True">{%else%}
+ <span class="hide">0</span><img src="/static/admin/img/icon-no.svg" alt="False">{%endif%}
+ </td>
+ <td class="field-days_overdue">{{object.days_overdue}}</td></tr>
+</tr>
+{% endfor %}
+
+
+</tbody>
+</table>
+</div>
+{% endblock %}
+ {% block js %}
+<script src="/media/sortable.min.js"></script>
+ {% endblock%}
diff --git a/app/posts/urls.py b/app/posts/urls.py
new file mode 100644
index 0000000..ea96e92
--- /dev/null
+++ b/app/posts/urls.py
@@ -0,0 +1,13 @@
+from django.urls import path, re_path
+
+from . import views
+
+app_name = "posts"
+
+urlpatterns = [
+ path(
+ r'',
+ views.PostListView.as_view(),
+ name="list"
+ ),
+]
diff --git a/app/posts/views.py b/app/posts/views.py
new file mode 100644
index 0000000..2048f28
--- /dev/null
+++ b/app/posts/views.py
@@ -0,0 +1,44 @@
+from django.views.generic import UpdateView, DetailView, ListView
+from django.utils.decorators import method_decorator
+from django.contrib.auth.decorators import login_required
+
+from .models import Post
+
+
+class PostListView(ListView):
+ model = Post
+
+ @method_decorator(login_required)
+ def dispatch(self, *args, **kwargs):
+ return super(PostListView, self).dispatch(*args, **kwargs)
+
+ def get_queryset(self):
+ return Post.objects.filter(user=self.request.user).order_by("-needs_update")
+
+
+'''
+
+class UpdateViewWithUser(UpdateView):
+
+ def get_form_kwargs(self, **kwargs):
+ kwargs = super().get_form_kwargs(**kwargs)
+ kwargs.update({'user': self.request.user})
+ return kwargs
+
+
+class ProfileView(UpdateViewWithUser):
+ model = UserProfile
+ form_class = ProfileForm
+ template_name = "accounts/change-settings.html"
+
+ def get_object(self):
+ return self.request.user.profile
+
+
+class SettingsListView(DetailView):
+ model = UserProfile
+ template_name = "accounts/profile.html"
+
+ def get_object(self):
+ return self.request.user.profile
+'''
diff --git a/config/base_urls.py b/config/base_urls.py
index ec1b30e..4d3a58d 100644
--- a/config/base_urls.py
+++ b/config/base_urls.py
@@ -13,6 +13,7 @@ AdminSite.site_title = "Sorting"
urlpatterns = [
path(r'admin/', admin.site.urls),
path(r'code/', include('deals.urls', namespace='deals')),
+ path(r'posts/', include('posts.urls', namespace='posts')),
] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT) + static(settings.STATIC_URL, document_root=settings.STATIC_ROOT)
diff --git a/templates/base.html b/templates/base.html
index 2e24177..80afbff 100644
--- a/templates/base.html
+++ b/templates/base.html
@@ -7,7 +7,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description"
content="{% block metadescription %}{% endblock %}">
- <meta name="author" content="Corrinne Gilbertson">
+ <meta name="author" content="luxagraf">
{%block stylesheet%}<link rel="stylesheet"
href="/media/screenv1.css{%comment%}?{% now "u" %}{%endcomment%}"
media="screen">{%endblock%}
@@ -17,15 +17,10 @@
<body {%block bodyid%}{%endblock%}{%block bodyevents%}{%endblock%}>
<header class="header-wrapper">
<div id="logo">
- <a class="logo-link" href="/" title="Home">Cumulus<span>Learning</span></a>
+ <a class="logo-link" href="/" title="Home">Wired Guide Tool</span></a>
</div>
<nav>
- <a class="nav-item" href="/about" title="About Corrinne">About</a>
- <a class="nav-item" href="/private-tutoring" title="Work with me">Work With Me</a>
- <a class="nav-item" href="/faq" title="Frequently asked questions">FAQ</a>
- {%comment %}<a class="nav-item" href="/what-is-structured-word-inquiry" title="How structured word inquiry helps children learn to read">What Is SWI?</a>
- <a class="nav-item" href="/resources/" title="Resources for parents and teachers">Resources</a>{% endcomment%}
- <a class="nav-item" href="/contact/" title="Contact Corrinne">Contact</a>
+ <a class="nav-item" href="/posts" title="View Guides">Guides</a>
</nav>
</header>
{% block breadcrumbs %}{% endblock %}