mirror of
git://git.yoctoproject.org/layerindex-web.git
synced 2025-07-19 12:39:02 +02:00
Add basic change history page
Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
This commit is contained in:
parent
6ec84fb7f5
commit
ce1775db31
|
@ -8,7 +8,7 @@ from django.conf.urls.defaults import *
|
|||
from django.views.generic import TemplateView, DetailView, ListView
|
||||
from django.views.defaults import page_not_found
|
||||
from layerindex.models import LayerItem, Recipe
|
||||
from layerindex.views import LayerListView, LayerReviewListView, LayerReviewDetailView, RecipeSearchView, MachineSearchView, PlainTextListView, LayerDetailView, edit_layer_view, delete_layer_view, edit_layernote_view, delete_layernote_view, switch_branch_view
|
||||
from layerindex.views import LayerListView, LayerReviewListView, LayerReviewDetailView, RecipeSearchView, MachineSearchView, PlainTextListView, LayerDetailView, edit_layer_view, delete_layer_view, edit_layernote_view, delete_layernote_view, switch_branch_view, HistoryListView
|
||||
|
||||
urlpatterns = patterns('',
|
||||
url(r'^$',
|
||||
|
@ -67,6 +67,10 @@ urlpatterns = patterns('',
|
|||
context_object_name='recipe_list',
|
||||
template_name='layerindex/rawrecipes.txt'),
|
||||
name='recipe_list_raw'),
|
||||
url(r'^history/$',
|
||||
HistoryListView.as_view(
|
||||
template_name='layerindex/history.html'),
|
||||
name='history_list'),
|
||||
url(r'^about$',
|
||||
TemplateView.as_view(
|
||||
template_name='layerindex/about.html'),
|
||||
|
|
|
@ -21,6 +21,7 @@ from django.template.loader import get_template
|
|||
from django.template import Context
|
||||
from django.utils.decorators import method_decorator
|
||||
from django.contrib.auth.decorators import login_required
|
||||
from reversion.models import Revision
|
||||
import simplesearch
|
||||
import settings
|
||||
|
||||
|
@ -310,3 +311,10 @@ class PlainTextListView(ListView):
|
|||
template = get_template(self.template_name)
|
||||
return HttpResponse(template.render(Context(context)),
|
||||
content_type='text/plain')
|
||||
|
||||
class HistoryListView(ListView):
|
||||
context_object_name = "revisions"
|
||||
paginate_by = 50
|
||||
|
||||
def get_queryset(self):
|
||||
return Revision.objects.all().order_by('-date_created')
|
||||
|
|
63
templates/layerindex/history.html
Normal file
63
templates/layerindex/history.html
Normal file
|
@ -0,0 +1,63 @@
|
|||
{% extends "base.html" %}
|
||||
{% load i18n %}
|
||||
{% load static %}
|
||||
|
||||
{% comment %}
|
||||
|
||||
layerindex-web - history list page template
|
||||
|
||||
Copyright (C) 2013 Intel Corporation
|
||||
Licensed under the MIT license, see COPYING.MIT for details
|
||||
|
||||
{% endcomment %}
|
||||
|
||||
|
||||
<!--
|
||||
{% block title_append %} - history{% endblock %}
|
||||
-->
|
||||
|
||||
{% block content %}
|
||||
{% autoescape on %}
|
||||
|
||||
<h2>Change history</h2>
|
||||
|
||||
<table class="table table-striped table-bordered layerstable">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Date/time</th>
|
||||
<th>User</th>
|
||||
<th>Change</th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<tbody>
|
||||
{% for revision in revisions %}
|
||||
<tr>
|
||||
<td>{{ revision.date_created|timesince }} ago</td>
|
||||
<td>{{ revision.user }}</td>
|
||||
<td>
|
||||
{% for version in revision.version_set.all %}
|
||||
{% if version.type = 0 %}
|
||||
Added
|
||||
{% elif version.type = 1 %}
|
||||
Changed
|
||||
{% elif version.type = 2 %}
|
||||
Deleted
|
||||
{% endif %}
|
||||
{{ version.content_type.name.lower }}: {{ version.object_repr }}
|
||||
<br>
|
||||
{% endfor %}
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
{% if is_paginated %}
|
||||
{% load pagination %}
|
||||
{% pagination page_obj %}
|
||||
{% endif %}
|
||||
|
||||
|
||||
{% endautoescape %}
|
||||
{% endblock %}
|
Loading…
Reference in New Issue
Block a user