def get_Objecttype(self): Objecttype, created = Objecttype.objects.get_or_create( title=self.Objecttype_title, slug=slugify(self.Objecttype_title)[:255]) if created: Objecttype.save() return Objecttype
def get_Objecttype(self): Objecttype, created = Objecttype.objects.get_or_create( title=self.Objecttype_title, slug=slugify(self.Objecttype_title)[:255] ) if created: Objecttype.save() return Objecttype
def test_gbobjects_published(self): Objecttype = self.objecttypes[0] self.assertEqual(Objecttype.gbobjects_published().count(), 0) self.gbobject.status = PUBLISHED self.gbobject.save() self.assertEqual(Objecttype.gbobjects_published().count(), 1) params = {'title': 'My second gbobject', 'content': 'My second content', 'tags': 'objectapp, test', 'status': PUBLISHED, 'slug': 'my-second-gbobject'} new_gbobject = Gbobject.objects.create(**params) new_gbobject.sites.add(self.site) new_gbobject.objecttypes.add(self.objecttypes[0]) self.assertEqual(self.objecttypes[0].gbobjects_published().count(), 2) self.assertEqual(self.objecttypes[1].gbobjects_published().count(), 1)
def get_nodes(self, request): """Return menu's node for objecttypes""" nodes = [] nodes.append(NavigationNode(_('Objecttypes'), reverse('objectapp_Objecttype_list'), 'objecttypes')) for Objecttype in Objecttype.objects.all(): nodes.append(NavigationNode(Objecttype.title, Objecttype.get_absolute_url(), Objecttype.pk, 'objecttypes')) return nodes
def Objecttype_detail(request, path, page=None, **kwargs): """Display the gbobjects of a Objecttype""" extra_context = kwargs.pop("extra_context", {}) Objecttype = get_Objecttype_or_404(path) if not kwargs.get("template_name"): kwargs["template_name"] = template_name_for_gbobject_queryset_filtered("Objecttype", Objecttype.slug) extra_context.update({"Objecttype": Objecttype}) kwargs["extra_context"] = extra_context return object_list(request, queryset=Objecttype.gbobjects_published(), paginate_by=PAGINATION, page=page, **kwargs)
def Objecttype_structure(Objecttype, site): """A Objecttype structure""" return { "description": Objecttype.title, "htmlUrl": "%s://%s%s" % (PROTOCOL, site.domain, Objecttype.get_absolute_url()), "rssUrl": "%s://%s%s" % (PROTOCOL, site.domain, reverse("objectapp_Objecttype_feed", args=[Objecttype.tree_path])), # Useful Wordpress Extensions "ObjecttypeId": Objecttype.pk, "parentId": Objecttype.parent and Objecttype.parent.pk or 0, "ObjecttypeDescription": Objecttype.description, "ObjecttypeName": Objecttype.title, }
def Objecttype_structure(Objecttype, site): """A Objecttype structure""" return {'description': Objecttype.title, 'htmlUrl': '%s://%s%s' % ( PROTOCOL, site.domain, Objecttype.get_absolute_url()), 'rssUrl': '%s://%s%s' % ( PROTOCOL, site.domain, reverse('objectapp_Objecttype_feed', args=[Objecttype.tree_path])), # Useful Wordpress Extensions 'ObjecttypeId': Objecttype.pk, 'parentId': Objecttype.parent and Objecttype.parent.pk or 0, 'ObjecttypeDescription': Objecttype.description, 'ObjecttypeName': Objecttype.title}
def Objecttype_detail(request, path, page=None, **kwargs): """Display the gbobjects of a Objecttype""" extra_context = kwargs.pop('extra_context', {}) Objecttype = get_Objecttype_or_404(path) if not kwargs.get('template_name'): kwargs['template_name'] = template_name_for_gbobject_queryset_filtered( 'Objecttype', Objecttype.slug) extra_context.update({'Objecttype': Objecttype}) kwargs['extra_context'] = extra_context return object_list(request, queryset=Objecttype.gbobjects_published(), paginate_by=PAGINATION, page=page, **kwargs)