class TagApplication(views.Application,TagMixedIn): search = views.SearchView() tag0 = views.SearchView('tags/', has_plugins = False) tag1 = TagView('<tag1>/', parent_view = 'tag0', has_plugins = False) def tagurl(self, request, *tags): return tagurl(self, request, *tags) def object_content(self, djp, obj): c = super(TagApplication,self).object_content(djp, obj) return add_tags(self, c, djp, obj)
class AdminApplicationSimple(views.Application): pagination = html.Pagination(('__str__',)) has_plugins = False search = views.SearchView() delete_all = views.DeleteAllView() view = views.ViewView() delete = views.DeleteView()
class UserAppBase(views.Application): '''Base class for user applications. Defines several utility methods for dealing with users and user data.''' name = 'accounts' userpage = False exclude_links = ('login', 'logout') # home = views.SearchView() login = LoginView(in_nav=0) logout = LogoutView(in_nav=0) add = views.AddView(in_nav=0, form=HtmlAddUserForm, force_redirect=True) register = views.AddView('/register', in_nav=0, linkname=lambda r: 'register', form=HtmlRegisterForm, force_redirect=True) def userhomeurl(self, request): '''The user home page url''' user = getattr(request, 'user', None) if user and user.is_authenticated(): if self.userpage: view = self.getview('userhome') else: view = self.getview('home') if view: djp = view(request, instance=user) return djp.url def on_bound(self): '''Set the user model in the application site''' self.root.internals['User'] = self.mapper
class GroupApplication(views.Application): '''An application group. NOT YET READ NOR TESTED''' home = views.View() search = views.SearchView('<group>') add = views.AddView() view = views.ViewView() change = views.ChangeView() delete = views.DeleteView()
class DesignApplication(views.Application): pagination = html.Pagination(('id', 'timestamp')) home = views.SearchView() add = views.AddView(form=AddThemeHtml, has_plugins=True, name='Add theme') view = views.ViewView() forms_view = views.View('/forms') def render_instance_default(self, request, instance, **kwargs): return get_form(request, ThemeInputsHtml)
class AdminApplication(views.Application): has_plugins = False views_ordering = {'description': 0, 'change': 1} pagination = html.Pagination(('__str__',)) home = views.SearchView() add = views.AddView() delete_all = views.DeleteAllView() view = TabView(in_nav=0) description = views.ObjectView('/description', in_nav=0, parent_view='view', renderer=lambda r, **kwargs:\ r.appmodel.render_instance(r, **kwargs)) change = views.ChangeView(force_redirect=False) delete = views.DeleteView()
class SiteMapApplication(views.Application): '''Application to use for admin sitemaps''' has_plugins = False form = HtmlPageForm description = 'Site-map' pagination = Pagination( ('url', 'view', 'layout', 'inner_template', 'in_navigation', table_header('doc_type', attrname='doctype'), 'soft_root'), bulk_actions=[views.bulk_delete]) list_display_links = ('id', 'url', 'page') home = SiteMapView() pages = views.SearchView('pages/', icon='th-list', title=lambda r: 'Pages', linkname=lambda r: 'pages') add = views.AddView(force_redirect=True, linkname=lambda r: 'add page') view = views.ViewView() change = PageChangeView(force_redirect=True, title=lambda djp: 'editing', linkname=lambda djp: 'edit page', body_class='editable') delete = views.DeleteView() def on_bound(self): self.root.internals['Page'] = self.mapper def view_for_instance(self, request, instance): return self.views['change'] def instance_field_value(self, request, page, field_name, val=''): if field_name == 'view': node = request.tree.get(page.url) view = node.view if not isinstance(view, pageview): return view.code else: return '' else: return escape(val)
class ContentApplication(views.Application): '''AJAX enabled :class:`djpcms.views.Application` for changing content in a content block.''' form = ContentBlockHtmlForm has_plugins = False pop_up = False url_bits_mapping = {'contentblock': 'id'} search = views.SearchView() view = views.ViewView('<int:contentblock>/') change = ChangeContentView() delete = DeleteContentView() def on_bound(self): self.root.internals['BlockContent'] = self.mapper def submit(self, *args, **kwargs): return [html.Widget('input:submit', value="save", name='_save')] def remove_instance(self, instance): bid = instance.htmlid() instance.delete() return bid
class Application(views.Application): search = views.SearchView() add = views.AddView() view = views.ViewView() change = views.ChangeView() delete = views.DeleteView()