def entry_list(request, type_db=None, category_slug=None): lang = request.LANGUAGE_CODE templates = ["migdal/entry/entry_list.html"] if type_db: if app_settings.TYPES_ON_MAIN == (type_db,): return redirect('migdal_main') entry_type = app_settings.TYPES_DICT[type_db] templates = ["migdal/entry/%s/entry_list.html" % type_db] + templates submit = type_db == app_settings.TYPE_SUBMIT else: submit = app_settings.TYPES_ON_MAIN == (app_settings.TYPE_SUBMIT,) entry_type = None if category_slug: category = get_object_or_404(Category, **{'slug_%s' % lang: category_slug}) else: category = None if category: set_current_object(request, category) promobox = 5 if entry_type is None and category is None else None object_list = api.entry_list(entry_type=entry_type, category=category, promobox=promobox) return render(request, templates, { 'object_list': object_list, 'category': category, 'entry_type': entry_type, 'submit': submit, })
def items(self, obj): return api.entry_list(for_feed=True, **obj)