kopia lustrzana https://github.com/rtts/django-simplecms
don’t require titles and some css tweaks
rodzic
d4e1b92fbb
commit
5ad04df8fb
|
@ -0,0 +1,15 @@
|
|||
from django.db import migrations, models
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('cms', '0001_initial'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name='section',
|
||||
name='title',
|
||||
field=models.CharField(blank=True, max_length=255, verbose_name='title'),
|
||||
),
|
||||
]
|
|
@ -73,13 +73,13 @@ class Page(NumberedModel):
|
|||
class Section(NumberedModel):
|
||||
page = models.ForeignKey(Page, verbose_name=_('page'), related_name='sections', on_delete=models.PROTECT)
|
||||
position = models.PositiveIntegerField(_('position'), blank=True)
|
||||
title = models.CharField(_('title'), max_length=255)
|
||||
title = models.CharField(_('title'), max_length=255, blank=True)
|
||||
type = models.CharField(_('section type'), max_length=16, default=settings.SECTION_TYPES[0][0], choices=settings.SECTION_TYPES)
|
||||
color = models.PositiveIntegerField(_('color'), default=1, choices=settings.SECTION_COLORS)
|
||||
|
||||
content = RichTextField(_('content'), blank=True)
|
||||
image = models.ImageField(_('image'), blank=True)
|
||||
video = EmbedVideoField(_('video'), blank=True, help_text='Paste a YouTube, Vimeo, or SoundCloud link')
|
||||
video = EmbedVideoField(_('video'), blank=True, help_text=_('Paste a YouTube, Vimeo, or SoundCloud link'))
|
||||
button_text = models.CharField(_('button text'), max_length=255, blank=True)
|
||||
button_link = models.CharField(_('button link'), max_length=255, blank=True)
|
||||
|
||||
|
@ -87,7 +87,13 @@ class Section(NumberedModel):
|
|||
return self.page.sections.all()
|
||||
|
||||
def __str__(self):
|
||||
return '{}. {}'.format(self.position, self.title)
|
||||
if not self.position:
|
||||
title = _('New section')
|
||||
elif not self.title:
|
||||
title = '{}. {}'.format(self.position, _('Untitled'))
|
||||
else:
|
||||
title = '{}. {}'.format(self.position, self.title)
|
||||
return str(title)
|
||||
|
||||
class Meta:
|
||||
verbose_name = _('section')
|
||||
|
|
|
@ -10,6 +10,7 @@ html, body {
|
|||
div.wrapper {
|
||||
max-width: 700px;
|
||||
margin: auto;
|
||||
padding: 0 1em;
|
||||
}
|
||||
|
||||
header, section, footer {
|
||||
|
@ -93,7 +94,6 @@ nav {
|
|||
a {
|
||||
color: black;
|
||||
text-decoration: none;
|
||||
font-size: 34px;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -5,7 +5,8 @@ html, body {
|
|||
|
||||
div.wrapper {
|
||||
max-width: 700px;
|
||||
margin: auto; }
|
||||
margin: auto;
|
||||
padding: 0 1em; }
|
||||
|
||||
header, section, footer {
|
||||
padding: 1rem; }
|
||||
|
@ -69,8 +70,7 @@ header, section, footer {
|
|||
text-align: center; }
|
||||
nav ul#menu li a {
|
||||
color: black;
|
||||
text-decoration: none;
|
||||
font-size: 34px; }
|
||||
text-decoration: none; }
|
||||
nav ul#menu.visible {
|
||||
transform: translatex(0); } }
|
||||
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -25,7 +25,7 @@
|
|||
{% endfor %}
|
||||
<section>
|
||||
<div class="wrapper">
|
||||
<h1>{% trans 'Section' %}: {{form.instance.title}}</h1>
|
||||
<h1>{% trans 'Section' %}: {{form.instance}}</h1>
|
||||
{% for field in form.visible_fields %}
|
||||
{% include 'cms/formfield.html' with field=field %}
|
||||
{% endfor %}
|
||||
|
|
2
setup.py
2
setup.py
|
@ -3,7 +3,7 @@ from setuptools import setup, find_packages
|
|||
|
||||
setup(
|
||||
name = 'django-simplecms',
|
||||
version = '0.0.6',
|
||||
version = '0.0.7',
|
||||
url = 'https://github.com/rtts/django-simplecms',
|
||||
author = 'Jaap Joris Vens',
|
||||
author_email = 'jj@rtts.eu',
|
||||
|
|
Ładowanie…
Reference in New Issue