Skip to content

Commit

Permalink
Merge pull request #63 from bilbeyt/content_management
Browse files Browse the repository at this point in the history
Content management for issue #27
  • Loading branch information
alperkesen authored Oct 2, 2017
2 parents 5b9bbcf + 3bca293 commit 9c7c8f5
Show file tree
Hide file tree
Showing 1,322 changed files with 68,297 additions and 228 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -55,5 +55,6 @@ target/

# ITURO
ituro/ituro/local_settings.py
ituro/media
ituro/db.sqlite3
public/
Empty file.
77 changes: 77 additions & 0 deletions ituro/content_management/admin.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
from django.contrib import admin
from django.db import models
from django.contrib.flatpages.models import FlatPage
from content_management.models import Photo, Gallery, \
CategoryPage, NewsPage, HomePage, AboutPage, SponsorshipPage, CommonPage
from ckeditor.widgets import CKEditorWidget


class CustomPageAdmin(admin.ModelAdmin):
list_display = ["title", "language", "is_public", "uid", "created_at"]
search_fields = ["title", "content"]
list_filter = ["created_at", "language"]
fields = [
"title", "language", "uid", "order", "is_public",
"is_divided", "enable_comments", "registration_required",
"content", "template_name", "url", "sites"
]
formfield_overrides = {
models.TextField: {'widget': CKEditorWidget}
}


class PhotoAdmin(admin.ModelAdmin):
list_display = ["title", "preview", "is_important", "created_at"]
list_filter = ["created_at"]
search_fields = ["title"]
exclude = ["thumbnail", "slug"]


class GalleryAdmin(admin.ModelAdmin):
list_display = ["title", "language", "uid", "order", "created_at"]
list_filter = ["created_at"]
search_fields = ["title"]
exclude = ["slug"]


class CategoryPageAdmin(CustomPageAdmin):
def get_fieldsets(self, request, obj=None):
fieldsets = list(
super(CustomPageAdmin, self).get_fieldsets(request, obj)
)
fieldsets.append(
(None, {'fields': ["document", "video_url", "gallery"]})
)
return fieldsets


class NewsPageAdmin(CustomPageAdmin):
def get_fieldsets(self, request, obj=None):
fieldsets = list(
super(CustomPageAdmin, self).get_fieldsets(request, obj)
)
fieldsets.append(
(None, {'fields': ["short_description", "url_content",
"types", "image"]})
)
return fieldsets


class HomePageAdmin(CustomPageAdmin):
def get_fieldsets(self, request, obj=None):
fieldsets = list(
super(CustomPageAdmin, self).get_fieldsets(request, obj)
)
fieldsets.append((None, {'fields': ["video_url"]}))
return fieldsets


admin.site.register(AboutPage, CustomPageAdmin)
admin.site.register(SponsorshipPage, CustomPageAdmin)
admin.site.register(CommonPage, CustomPageAdmin)
admin.site.register(HomePage, HomePageAdmin)
admin.site.register(CategoryPage, CategoryPageAdmin)
admin.site.register(NewsPage, NewsPageAdmin)
admin.site.register(Photo, PhotoAdmin)
admin.site.register(Gallery, GalleryAdmin)
admin.site.unregister(FlatPage)
160 changes: 160 additions & 0 deletions ituro/content_management/migrations/0001_initial.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,160 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals

from django.db import models, migrations
import content_management.models


class Migration(migrations.Migration):

dependencies = [
('flatpages', '0001_initial'),
]

operations = [
migrations.CreateModel(
name='AboutPage',
fields=[
('flatpage_ptr', models.OneToOneField(parent_link=True, auto_created=True, primary_key=True, serialize=False, to='flatpages.FlatPage')),
('uid', models.PositiveIntegerField()),
('language', models.CharField(max_length=5, choices=[(b'tr', 'Turkish'), (b'en', 'English')])),
('page_type', models.CharField(blank=True, max_length=10, null=True, choices=[(b'about', 'About'), (b'sponsorship', 'Sponsorship')])),
('order', models.PositiveIntegerField()),
('is_public', models.BooleanField(default=False)),
('is_right', models.BooleanField(default=False)),
('is_divided', models.BooleanField(default=False)),
('created_at', models.DateTimeField(auto_now_add=True)),
],
options={
'abstract': False,
},
bases=('flatpages.flatpage',),
),
migrations.CreateModel(
name='CategoryPage',
fields=[
('flatpage_ptr', models.OneToOneField(parent_link=True, auto_created=True, primary_key=True, serialize=False, to='flatpages.FlatPage')),
('uid', models.PositiveIntegerField()),
('language', models.CharField(max_length=5, choices=[(b'tr', 'Turkish'), (b'en', 'English')])),
('page_type', models.CharField(blank=True, max_length=10, null=True, choices=[(b'about', 'About'), (b'sponsorship', 'Sponsorship')])),
('order', models.PositiveIntegerField()),
('is_public', models.BooleanField(default=False)),
('is_right', models.BooleanField(default=False)),
('is_divided', models.BooleanField(default=False)),
('created_at', models.DateTimeField(auto_now_add=True)),
('document', models.FileField(upload_to=content_management.models.get_document_upload_path)),
('video_url', models.URLField()),
],
options={
'abstract': False,
},
bases=('flatpages.flatpage',),
),
migrations.CreateModel(
name='Gallery',
fields=[
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
('title', models.CharField(max_length=100)),
('language', models.CharField(max_length=5, choices=[(b'tr', 'Turkish'), (b'en', 'English')])),
('uid', models.PositiveIntegerField()),
('order', models.PositiveIntegerField()),
('is_public', models.BooleanField(default=False)),
('slug', models.SlugField(max_length=100)),
('created_at', models.DateTimeField(auto_now_add=True)),
],
options={
'ordering': ('order',),
},
bases=(models.Model,),
),
migrations.CreateModel(
name='HomePage',
fields=[
('flatpage_ptr', models.OneToOneField(parent_link=True, auto_created=True, primary_key=True, serialize=False, to='flatpages.FlatPage')),
('uid', models.PositiveIntegerField()),
('language', models.CharField(max_length=5, choices=[(b'tr', 'Turkish'), (b'en', 'English')])),
('page_type', models.CharField(blank=True, max_length=10, null=True, choices=[(b'about', 'About'), (b'sponsorship', 'Sponsorship')])),
('order', models.PositiveIntegerField()),
('is_public', models.BooleanField(default=False)),
('is_right', models.BooleanField(default=False)),
('is_divided', models.BooleanField(default=False)),
('created_at', models.DateTimeField(auto_now_add=True)),
('video_url', models.URLField()),
],
options={
'abstract': False,
},
bases=('flatpages.flatpage',),
),
migrations.CreateModel(
name='NewsPage',
fields=[
('flatpage_ptr', models.OneToOneField(parent_link=True, auto_created=True, primary_key=True, serialize=False, to='flatpages.FlatPage')),
('uid', models.PositiveIntegerField()),
('language', models.CharField(max_length=5, choices=[(b'tr', 'Turkish'), (b'en', 'English')])),
('page_type', models.CharField(blank=True, max_length=10, null=True, choices=[(b'about', 'About'), (b'sponsorship', 'Sponsorship')])),
('order', models.PositiveIntegerField()),
('is_public', models.BooleanField(default=False)),
('is_right', models.BooleanField(default=False)),
('is_divided', models.BooleanField(default=False)),
('created_at', models.DateTimeField(auto_now_add=True)),
('short_description', models.CharField(max_length=100)),
('types', models.CharField(max_length=50, choices=[(b'danger', 'Hot!'), (b'info', 'Information'), (b'primary', 'Important')])),
],
options={
'abstract': False,
},
bases=('flatpages.flatpage',),
),
migrations.CreateModel(
name='Photo',
fields=[
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
('title', models.CharField(max_length=100)),
('image', models.ImageField(upload_to=content_management.models.get_image_upload_path)),
('thumbnail', models.ImageField(upload_to=content_management.models.get_thumbnail_upload_path)),
('slug', models.SlugField(max_length=100)),
('is_important', models.BooleanField(default=False)),
('created_at', models.DateTimeField(auto_now_add=True)),
],
options={
},
bases=(models.Model,),
),
migrations.CreateModel(
name='SponsorshipPage',
fields=[
('flatpage_ptr', models.OneToOneField(parent_link=True, auto_created=True, primary_key=True, serialize=False, to='flatpages.FlatPage')),
('uid', models.PositiveIntegerField()),
('language', models.CharField(max_length=5, choices=[(b'tr', 'Turkish'), (b'en', 'English')])),
('page_type', models.CharField(blank=True, max_length=10, null=True, choices=[(b'about', 'About'), (b'sponsorship', 'Sponsorship')])),
('order', models.PositiveIntegerField()),
('is_public', models.BooleanField(default=False)),
('is_right', models.BooleanField(default=False)),
('is_divided', models.BooleanField(default=False)),
('created_at', models.DateTimeField(auto_now_add=True)),
],
options={
'abstract': False,
},
bases=('flatpages.flatpage',),
),
migrations.AddField(
model_name='newspage',
name='image',
field=models.ForeignKey(to='content_management.Photo'),
preserve_default=True,
),
migrations.AddField(
model_name='gallery',
name='photos',
field=models.ManyToManyField(to='content_management.Photo'),
preserve_default=True,
),
migrations.AddField(
model_name='categorypage',
name='gallery',
field=models.ForeignKey(to='content_management.Gallery'),
preserve_default=True,
),
]
52 changes: 52 additions & 0 deletions ituro/content_management/migrations/0002_auto_20170624_0955.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals

from django.db import models, migrations


class Migration(migrations.Migration):

dependencies = [
('flatpages', '0001_initial'),
('content_management', '0001_initial'),
]

operations = [
migrations.CreateModel(
name='CommonPage',
fields=[
('flatpage_ptr', models.OneToOneField(parent_link=True, auto_created=True, primary_key=True, serialize=False, to='flatpages.FlatPage')),
('uid', models.PositiveIntegerField()),
('language', models.CharField(max_length=5, choices=[(b'tr', 'Turkish'), (b'en', 'English')])),
('page_type', models.CharField(blank=True, max_length=10, null=True, choices=[(b'about', 'About'), (b'sponsorship', 'Sponsorship')])),
('order', models.PositiveIntegerField()),
('is_public', models.BooleanField(default=False)),
('is_divided', models.BooleanField(default=False)),
('created_at', models.DateTimeField(auto_now_add=True)),
],
options={
'abstract': False,
},
bases=('flatpages.flatpage',),
),
migrations.RemoveField(
model_name='aboutpage',
name='is_right',
),
migrations.RemoveField(
model_name='categorypage',
name='is_right',
),
migrations.RemoveField(
model_name='homepage',
name='is_right',
),
migrations.RemoveField(
model_name='newspage',
name='is_right',
),
migrations.RemoveField(
model_name='sponsorshippage',
name='is_right',
),
]
38 changes: 38 additions & 0 deletions ituro/content_management/migrations/0003_auto_20170624_0957.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals

from django.db import models, migrations


class Migration(migrations.Migration):

dependencies = [
('content_management', '0002_auto_20170624_0955'),
]

operations = [
migrations.RemoveField(
model_name='aboutpage',
name='page_type',
),
migrations.RemoveField(
model_name='categorypage',
name='page_type',
),
migrations.RemoveField(
model_name='commonpage',
name='page_type',
),
migrations.RemoveField(
model_name='homepage',
name='page_type',
),
migrations.RemoveField(
model_name='newspage',
name='page_type',
),
migrations.RemoveField(
model_name='sponsorshippage',
name='page_type',
),
]
20 changes: 20 additions & 0 deletions ituro/content_management/migrations/0004_newspage_url_content.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals

from django.db import models, migrations


class Migration(migrations.Migration):

dependencies = [
('content_management', '0003_auto_20170624_0957'),
]

operations = [
migrations.AddField(
model_name='newspage',
name='url_content',
field=models.TextField(default=1),
preserve_default=False,
),
]
Loading

0 comments on commit 9c7c8f5

Please sign in to comment.