diff --git a/bin/simplecms b/bin/simplecms index d3c71c9..159fb27 100755 --- a/bin/simplecms +++ b/bin/simplecms @@ -1,9 +1,8 @@ #!/bin/bash -e test -z $1 && echo "Please provide a project name!" && exit 1 -test -d $dev/$1 && echo "That project already exists!" && exit 1 -mkdir $1 && cd $1 +mkdir -p $1 && cd $1 pip3 freeze > requirements.txt example_dir=$(python3 -c 'import os,example;print(os.path.dirname(example.__file__))') cp -r $example_dir/{project,app,manage.py} . diff --git a/cms/migrations/0001_initial.py b/cms/migrations/0001_initial.py index d6079c4..55507d9 100644 --- a/cms/migrations/0001_initial.py +++ b/cms/migrations/0001_initial.py @@ -22,7 +22,7 @@ class Migration(migrations.Migration): fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('number', models.PositiveIntegerField(blank=True, verbose_name='number')), - ('title', cms.models.VarCharField(verbose_name='title')), + ('title', cms.models.VarCharField(verbose_name='page')), ('slug', models.SlugField(blank=True, unique=True, verbose_name='slug')), ('menu', models.BooleanField(default=True, verbose_name='visible in menu')), ], @@ -39,13 +39,13 @@ class Migration(migrations.Migration): name='Section', fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('type', cms.models.VarCharField(blank=True, verbose_name='type')), + ('type', cms.models.VarCharField(verbose_name='type')), ('number', models.PositiveIntegerField(blank=True, verbose_name='number')), - ('title', cms.models.VarCharField(blank=True, verbose_name='title')), + ('title', cms.models.VarCharField(verbose_name='section')), ('content', models.TextField(blank=True, verbose_name='content')), ('image', models.ImageField(blank=True, upload_to='', verbose_name='image')), ('video', embed_video.fields.EmbedVideoField(blank=True, help_text='Paste a YouTube, Vimeo, or SoundCloud link', verbose_name='video')), - ('href', cms.models.VarCharField(blank=True, verbose_name='button link')), + ('href', cms.models.VarCharField(blank=True, verbose_name='link')), ('page', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='sections', to=settings.CMS_PAGE_MODEL, verbose_name='page')), ('polymorphic_ctype', models.ForeignKey(editable=False, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='polymorphic_cms.section_set+', to='contenttypes.ContentType')), ], diff --git a/cms/views.py b/cms/views.py index f4badf9..5ae017a 100644 --- a/cms/views.py +++ b/cms/views.py @@ -137,7 +137,8 @@ class EditPage(UserPassesTestMixin, edit.ModelFormMixin, base.TemplateResponseMi template_name = 'cms/edit.html' def test_func(self): - return self.request.user.has_perm('cms_page_change') + app, model = swapper.get_model_name('cms', 'page').lower().split('.') + return self.request.user.has_perm('f{app}_{model}_change') def setup(self, *args, slug='', **kwargs): '''Supply a default argument for slug'''