remove old project dir that seemed to come back with the merge commit
This commit is contained in:
parent
0430f166fe
commit
3bed4f03c1
6 changed files with 0 additions and 122 deletions
|
@ -1,12 +0,0 @@
|
|||
from django.contrib import admin
|
||||
|
||||
from mptt.admin import MPTTModelAdmin
|
||||
|
||||
from cms.models import Page
|
||||
|
||||
|
||||
class PageAdmin(MPTTModelAdmin):
|
||||
prepopulated_fields = {"slug": ("title",)}
|
||||
list_display = ("title", "published", "status")
|
||||
|
||||
admin.site.register(Page, PageAdmin)
|
|
@ -1,65 +0,0 @@
|
|||
from datetime import datetime
|
||||
|
||||
from django.db import models
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
|
||||
from markitup.fields import MarkupField
|
||||
|
||||
from taggit.managers import TaggableManager
|
||||
|
||||
from mptt.models import MPTTModel, TreeForeignKey
|
||||
from mptt.utils import drilldown_tree_for_node
|
||||
|
||||
import reversion
|
||||
|
||||
|
||||
class ContentBase(models.Model):
|
||||
|
||||
STATUS_CHOICES = (
|
||||
(1, _("Draft")),
|
||||
(2, _("Public")),
|
||||
)
|
||||
|
||||
title = models.CharField(max_length=100)
|
||||
slug = models.CharField(max_length=100, blank=True, null=True)
|
||||
body = MarkupField()
|
||||
|
||||
tags = TaggableManager(blank=True)
|
||||
|
||||
status = models.IntegerField(choices=STATUS_CHOICES, default=2)
|
||||
published = models.DateTimeField(default=datetime.now)
|
||||
created = models.DateTimeField(editable=False, default=datetime.now)
|
||||
updated = models.DateTimeField(editable=False, default=datetime.now)
|
||||
|
||||
class Meta:
|
||||
abstract = True
|
||||
|
||||
|
||||
class Page(MPTTModel, ContentBase):
|
||||
|
||||
parent = TreeForeignKey("self", null=True, blank=True, related_name="children")
|
||||
ordering = models.PositiveIntegerField(default=1)
|
||||
path = models.TextField(blank=True, editable=False)
|
||||
|
||||
def __unicode__(self):
|
||||
return self.title
|
||||
|
||||
def save(self, calculate_path=True, *args, **kwargs):
|
||||
super(Page, self).save(*args, **kwargs)
|
||||
if calculate_path:
|
||||
self.calculate_path()
|
||||
|
||||
def calculate_path(self):
|
||||
self.path = ""
|
||||
for page in drilldown_tree_for_node(self):
|
||||
if page == self:
|
||||
self.path += page.slug
|
||||
break
|
||||
else:
|
||||
self.path += "%s/" % page.slug
|
||||
self.save(calculate_path=False)
|
||||
|
||||
class MPTTMeta:
|
||||
order_insertion_by = ["ordering", "title"]
|
||||
|
||||
reversion.register(Page)
|
|
@ -1,15 +0,0 @@
|
|||
from django.shortcuts import render_to_response, get_object_or_404
|
||||
from django.template import RequestContext
|
||||
|
||||
from cms.models import Page
|
||||
|
||||
|
||||
def page(request, slug):
|
||||
|
||||
page = get_object_or_404(Page, path=slug)
|
||||
siblings = page.get_siblings(include_self=True)
|
||||
|
||||
return render_to_response("cms/page_detail.html", {
|
||||
"page": page,
|
||||
"siblings": siblings,
|
||||
}, context_instance=RequestContext(request))
|
|
@ -1,19 +0,0 @@
|
|||
{% extends "subnav_base.html" %}
|
||||
|
||||
{% block subnav %}
|
||||
<ul class="nav nav-list">
|
||||
<li class="nav-header">{{ page.parent }}</li>
|
||||
{% for sibling in siblings %}
|
||||
{% if sibling == page %}
|
||||
<li>{{ sibling }}</li>
|
||||
{% else %}
|
||||
<li><a href="{% url cms_page sibling.path %}">{{ sibling }}</a>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
</ul>
|
||||
{% endblock %}
|
||||
|
||||
{% block body %}
|
||||
<h1>{{ page.title }}</h1>
|
||||
{{ page.body }}
|
||||
{% endblock %}
|
|
@ -1,11 +0,0 @@
|
|||
{% load sitetree %}
|
||||
<ul class="nav">
|
||||
{% for item in sitetree_items %}
|
||||
<li class="{{ item.is_current|yesno:"active ," }}">
|
||||
<a href="{% sitetree_url for item %}" title="{{ item.hint|default:"" }}">{{ item.title_resolved }}</a>
|
||||
{% if item.has_children %}
|
||||
{% sitetree_children of item for menu template "sitetree/menu.html" %}
|
||||
{% endif %}
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ul>
|
Loading…
Reference in a new issue