Tomas Gavenciak
10 years ago
6 changed files with 52 additions and 8 deletions
@ -0,0 +1,24 @@ |
|||||
|
from django.contrib import admin |
||||
|
from django.contrib.flatpages.models import FlatPage |
||||
|
|
||||
|
# Note: we are renaming the original Admin and Form as we import them! |
||||
|
from django.contrib.flatpages.admin import FlatPageAdmin as FlatPageAdminOld |
||||
|
from django.contrib.flatpages.admin import FlatpageForm as FlatpageFormOld |
||||
|
|
||||
|
from django import forms |
||||
|
from ckeditor.widgets import CKEditorWidget |
||||
|
|
||||
|
class FlatpageForm(FlatpageFormOld): |
||||
|
content = forms.CharField(widget=CKEditorWidget()) |
||||
|
class Meta: |
||||
|
model = FlatPage # this is not automatically inherited from FlatpageFormOld |
||||
|
exclude = [] |
||||
|
|
||||
|
|
||||
|
class FlatPageAdmin(FlatPageAdminOld): |
||||
|
form = FlatpageForm |
||||
|
|
||||
|
|
||||
|
# We have to unregister the normal admin, and then reregister ours |
||||
|
admin.site.unregister(FlatPage) |
||||
|
admin.site.register(FlatPage, FlatPageAdmin) |
@ -0,0 +1,11 @@ |
|||||
|
{% extends "base.html" %} |
||||
|
|
||||
|
{% block title %}{{ flatpage.title }}{% endblock title %} |
||||
|
|
||||
|
{% block content %} |
||||
|
<h2>{{ flatpage.title }}</h2> |
||||
|
<div> |
||||
|
{{ flatpage.content }} |
||||
|
</div> |
||||
|
{% endblock content %} |
||||
|
|
@ -1,9 +1,13 @@ |
|||||
{% extends "base.html" %} |
{% extends "base.html" %} |
||||
|
|
||||
|
{% block title %}{{ flatpage.title }}{% endblock title %} |
||||
|
|
||||
{% block content %} |
{% block content %} |
||||
<div> |
<div>Toto je stránka podle šablony "home.html"</div> |
||||
<h2>Vítejte na testwebu MaM!</h2> |
|
||||
<p><a href='{% url 'admin:index' %}'>Administrátorské rozhraní</a> (admin/admin) |
<p><a href='{% url 'admin:index' %}'>Administrátorské rozhraní</a> (admin/admin) |
||||
|
<h2>{{ flatpage.title }}</h2> |
||||
|
<div> |
||||
|
{{ flatpage.content }} |
||||
</div> |
</div> |
||||
{% endblock content %} |
{% endblock content %} |
||||
|
|
||||
|
Loading…
Reference in new issue