diff options
-rw-r--r-- | app/pages/admin.py | 2 | ||||
-rw-r--r-- | app/pages/build.py | 1 | ||||
-rw-r--r-- | app/pages/migrations/0009_page_site.py | 21 | ||||
-rw-r--r-- | app/pages/models.py | 2 | ||||
-rw-r--r-- | app/posts/admin.py | 4 | ||||
-rw-r--r-- | app/posts/migrations/0016_post_site.py | 21 | ||||
-rw-r--r-- | app/posts/models.py | 2 |
7 files changed, 50 insertions, 3 deletions
diff --git a/app/pages/admin.py b/app/pages/admin.py index 4b4dcce..c02d892 100644 --- a/app/pages/admin.py +++ b/app/pages/admin.py @@ -20,7 +20,7 @@ class PageEntryForm(forms.ModelForm): @admin.register(Page) class PageAdmin(admin.ModelAdmin): form = PageEntryForm - list_display = ('title', 'slug', 'path', 'app', 'build') + list_display = ('title', 'site', 'slug', 'path', 'app', 'build') search_fields = ['title', 'body_markdown'] prepopulated_fields = {"slug": ('title',)} fieldsets = ( diff --git a/app/pages/build.py b/app/pages/build.py index 80c32c3..fa380c1 100644 --- a/app/pages/build.py +++ b/app/pages/build.py @@ -7,6 +7,7 @@ from builder.base import BuildNew class BuildPages(BuildNew): + def build(self): self.build_detail_view() print("building pages") diff --git a/app/pages/migrations/0009_page_site.py b/app/pages/migrations/0009_page_site.py new file mode 100644 index 0000000..90f4a88 --- /dev/null +++ b/app/pages/migrations/0009_page_site.py @@ -0,0 +1,21 @@ +# Generated by Django 3.1 on 2020-11-15 15:40 + +from django.db import migrations, models +import django.db.models.deletion + + +class Migration(migrations.Migration): + + dependencies = [ + ('sites', '0002_alter_domain_unique'), + ('pages', '0008_auto_20201114_0934'), + ] + + operations = [ + migrations.AddField( + model_name='page', + name='site', + field=models.ForeignKey(default=1, on_delete=django.db.models.deletion.CASCADE, to='sites.site'), + preserve_default=False, + ), + ] diff --git a/app/pages/models.py b/app/pages/models.py index 8caa29e..fac815c 100644 --- a/app/pages/models.py +++ b/app/pages/models.py @@ -1,6 +1,7 @@ import re from django.db import models from django.contrib.sitemaps import Sitemap +from django.contrib.sites.models import Site from photos.models import LuxImage from posts.models import Post @@ -18,6 +19,7 @@ class Page(models.Model): app = models.CharField(max_length=50, blank=True) build = models.BooleanField(default=True) enable_comments = models.BooleanField(default=False) + site = models.ForeignKey(Site, on_delete=models.CASCADE) def __str__(self): return self.title diff --git a/app/posts/admin.py b/app/posts/admin.py index b2961cc..2143086 100644 --- a/app/posts/admin.py +++ b/app/posts/admin.py @@ -35,10 +35,10 @@ class PostAdmin(OSMGeoAdmin): field = super(PostAdmin, self).formfield_for_dbfield(db_field, **kwargs) return field - list_display = ('title', 'post_type', 'pub_date', 'template_name', 'status',) + list_display = ('title', 'site', 'post_type', 'pub_date', 'template_name', 'status',) search_fields = ['title', 'body_markdown'] prepopulated_fields = {"slug": ('title',)} - list_filter = ('post_type', 'pub_date', 'enable_comments', 'status') + list_filter = ('site', 'post_type', 'pub_date', 'enable_comments', 'status') filter_horizontal = ('related', 'books', 'field_notes') fieldsets = ( ('Entry', { diff --git a/app/posts/migrations/0016_post_site.py b/app/posts/migrations/0016_post_site.py new file mode 100644 index 0000000..f04eb28 --- /dev/null +++ b/app/posts/migrations/0016_post_site.py @@ -0,0 +1,21 @@ +# Generated by Django 3.1 on 2020-11-15 15:43 + +from django.db import migrations, models +import django.db.models.deletion + + +class Migration(migrations.Migration): + + dependencies = [ + ('sites', '0002_alter_domain_unique'), + ('posts', '0015_post_old_image'), + ] + + operations = [ + migrations.AddField( + model_name='post', + name='site', + field=models.ForeignKey(default=1, on_delete=django.db.models.deletion.CASCADE, to='sites.site'), + preserve_default=False, + ), + ] diff --git a/app/posts/models.py b/app/posts/models.py index d0e8c0b..25dfe10 100644 --- a/app/posts/models.py +++ b/app/posts/models.py @@ -6,6 +6,7 @@ from django.contrib.gis.db import models from django.db.models.signals import post_save from django.contrib.contenttypes.fields import GenericRelation, GenericForeignKey from django.contrib.contenttypes.models import ContentType +from django.contrib.sites.models import Site from django.urls import reverse from django.utils.functional import cached_property from django.apps import apps @@ -47,6 +48,7 @@ class PostType(models.IntegerChoices): class Post(models.Model): old_id = models.IntegerField(blank=True, null=True) + site = models.ForeignKey(Site, on_delete=models.CASCADE) title = models.CharField(max_length=200) short_title = models.CharField(max_length=200, blank=True, null=True) subtitle = models.CharField(max_length=200, blank=True) |