-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #63 from bilbeyt/content_management
Content management for issue #27
- Loading branch information
Showing
1,322 changed files
with
68,297 additions
and
228 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -55,5 +55,6 @@ target/ | |
|
||
# ITURO | ||
ituro/ituro/local_settings.py | ||
ituro/media | ||
ituro/db.sqlite3 | ||
public/ |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
52
ituro/content_management/migrations/0002_auto_20170624_0955.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
38
ituro/content_management/migrations/0003_auto_20170624_0957.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
20
ituro/content_management/migrations/0004_newspage_url_content.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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, | ||
), | ||
] |
Oops, something went wrong.