forked from rc/aircox
		
	RelatedPost: mapping['thread'] now manage relation between thread and parent of related object
This commit is contained in:
		@ -17,6 +17,7 @@ class Episode (RelatedPost):
 | 
			
		||||
        related_model = programs.Episode
 | 
			
		||||
        bind_mapping = True
 | 
			
		||||
        mapping = {
 | 
			
		||||
            'thread': 'program',
 | 
			
		||||
            'title': 'name',
 | 
			
		||||
            'content': 'description',
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
@ -4,42 +4,10 @@ from website.models import *
 | 
			
		||||
from website.views import *
 | 
			
		||||
 | 
			
		||||
from aircox_cms.models import Article
 | 
			
		||||
from aircox_cms.views import Menu, Section, Sections, ViewSet
 | 
			
		||||
from aircox_cms.views import Menu, Section, Sections
 | 
			
		||||
from aircox_cms.routes import *
 | 
			
		||||
from aircox_cms.website import Website
 | 
			
		||||
 | 
			
		||||
class ProgramSet (ViewSet):
 | 
			
		||||
    model = Program
 | 
			
		||||
    list_routes = [
 | 
			
		||||
        AllRoute,
 | 
			
		||||
        ThreadRoute,
 | 
			
		||||
        SearchRoute,
 | 
			
		||||
        DateRoute,
 | 
			
		||||
    ]
 | 
			
		||||
 | 
			
		||||
    detail_sections = ViewSet.detail_sections + [
 | 
			
		||||
        ScheduleSection(),
 | 
			
		||||
        EpisodesSection(),
 | 
			
		||||
    ]
 | 
			
		||||
 | 
			
		||||
class EpisodeSet (ViewSet):
 | 
			
		||||
    model = Episode
 | 
			
		||||
    list_routes = [
 | 
			
		||||
        AllRoute,
 | 
			
		||||
        ThreadRoute,
 | 
			
		||||
        SearchRoute,
 | 
			
		||||
        DateRoute,
 | 
			
		||||
    ]
 | 
			
		||||
 | 
			
		||||
class ArticleSet (ViewSet):
 | 
			
		||||
    model = Article
 | 
			
		||||
    list_routes = [
 | 
			
		||||
        AllRoute,
 | 
			
		||||
        ThreadRoute,
 | 
			
		||||
        SearchRoute,
 | 
			
		||||
        DateRoute,
 | 
			
		||||
    ]
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
website = Website(
 | 
			
		||||
    name = 'RadioCampus',
 | 
			
		||||
@ -70,8 +38,40 @@ website = Website(
 | 
			
		||||
    ],
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
website.register_set(ProgramSet)
 | 
			
		||||
website.register_set(EpisodeSet)
 | 
			
		||||
website.register_set(ArticleSet)
 | 
			
		||||
base_sections = [
 | 
			
		||||
    Sections.PostContent(),
 | 
			
		||||
    Sections.PostImage(),
 | 
			
		||||
]
 | 
			
		||||
 | 
			
		||||
base_routes =  [
 | 
			
		||||
    AllRoute,
 | 
			
		||||
    ThreadRoute,
 | 
			
		||||
    SearchRoute,
 | 
			
		||||
    DateRoute,
 | 
			
		||||
]
 | 
			
		||||
 | 
			
		||||
website.register(
 | 
			
		||||
    'article',
 | 
			
		||||
    Article,
 | 
			
		||||
    sections = base_sections,
 | 
			
		||||
    routes = base_routes
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
website.register(
 | 
			
		||||
    'program',
 | 
			
		||||
    Program,
 | 
			
		||||
    sections = base_sections + [
 | 
			
		||||
        ScheduleSection(),
 | 
			
		||||
        EpisodesSection(),
 | 
			
		||||
    ],
 | 
			
		||||
    routes = base_routes,
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
website.register (
 | 
			
		||||
    'episode',
 | 
			
		||||
    Episode,
 | 
			
		||||
    sections = base_sections,
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
urlpatterns = website.urls
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
		Reference in New Issue
	
	Block a user