"""Views for Gstudio objecttypes""" from django.shortcuts import redirect from django.shortcuts import get_object_or_404 from django.views.generic.list_detail import object_list from django.views.generic.date_based import archive_year from django.views.generic.date_based import archive_month from django.views.generic.date_based import archive_day from django.views.generic.date_based import object_detail from gstudio.models import Objecttype from gstudio.views.decorators import protect_objecttype from gstudio.views.decorators import update_queryset objecttype_index = update_queryset(object_list, Objecttype.published.all) objecttype_year = update_queryset(archive_year, Objecttype.published.all) objecttype_month = update_queryset(archive_month, Objecttype.published.all) objecttype_day = update_queryset(archive_day, Objecttype.published.all) objecttype_detail = protect_objecttype(object_detail) def objecttype_shortlink(request, object_id): """ Redirect to the 'get_absolute_url' of an Objecttype, accordingly to 'object_id' argument """ objecttype = get_object_or_404(Objecttype, pk=object_id)
# but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. """Views for Gstudio authors""" from django.shortcuts import get_object_or_404 from django.views.generic.list_detail import object_list from gstudio.models import Author from gstudio.settings import PAGINATION from gstudio.views.decorators import update_queryset from gstudio.views.decorators import template_name_for_nodetype_queryset_filtered author_list = update_queryset(object_list, Author.published.all) def author_detail(request, username, page=None, **kwargs): """Display the nodetypes of an author""" extra_context = kwargs.pop('extra_context', {}) author = get_object_or_404(Author, username=username) if not kwargs.get('template_name'): kwargs['template_name'] = template_name_for_nodetype_queryset_filtered( 'author', author.username) extra_context.update({'author': author}) kwargs['extra_context'] = extra_context return object_list(request,
from django.views.generic.list_detail import object_list from django.views.generic.date_based import archive_year from django.views.generic.date_based import archive_month from django.views.generic.date_based import archive_day from django.views.generic.date_based import object_detail from gstudio.methods import * from demo.settings import PYSCRIPT_URL_GSTUDIO from demo.settings import FILE_URL from gstudio.models import Nodetype from gstudio.views.decorators import protect_nodetype from gstudio.views.decorators import update_queryset nodetype_index = update_queryset(object_list, System.objects.all) nodetype_year = update_queryset(archive_year, Nodetype.published.all) nodetype_month = update_queryset(archive_month, Nodetype.published.all) nodetype_day = update_queryset(archive_day, Nodetype.published.all) nodetype_detail = protect_nodetype(object_detail) def nodetype_shortlink(request, object_id): """ Redirect to the 'get_absolute_url' of a nodetype, accordingly to 'object_id' argument """
"""Views for Gstudio nodetypes""" from django.shortcuts import redirect from django.shortcuts import get_object_or_404 from django.views.generic.list_detail import object_list from django.views.generic.date_based import archive_year from django.views.generic.date_based import archive_month from django.views.generic.date_based import archive_day from django.views.generic.date_based import object_detail from gstudio.models import Nodetype from gstudio.views.decorators import protect_nodetype from gstudio.views.decorators import update_queryset nodetype_index = update_queryset(object_list, Nodetype.published.all) nodetype_year = update_queryset(archive_year, Nodetype.published.all) nodetype_month = update_queryset(archive_month, Nodetype.published.all) nodetype_day = update_queryset(archive_day, Nodetype.published.all) nodetype_detail = protect_nodetype(object_detail) def nodetype_shortlink(request, object_id): """ Redirect to the 'get_absolute_url' of a nodetype, accordingly to 'object_id' argument """ nodetype = get_object_or_404(Nodetype, pk=object_id) return redirect(nodetype, permanent=True)
# You should have received a copy of the GNU Affero General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. """Views for Gstudio authors""" from django.shortcuts import get_object_or_404 from django.views.generic.list_detail import object_list from gstudio.models import Author from gstudio.settings import PAGINATION from gstudio.views.decorators import update_queryset from gstudio.views.decorators import template_name_for_nodetype_queryset_filtered author_list = update_queryset(object_list, Author.published.all) def author_detail(request, username, page=None, **kwargs): """Display the nodetypes of an author""" extra_context = kwargs.pop('extra_context', {}) author = get_object_or_404(Author, username=username) if not kwargs.get('template_name'): kwargs['template_name'] = template_name_for_nodetype_queryset_filtered( 'author', author.username) extra_context.update({'author': author}) kwargs['extra_context'] = extra_context return object_list(request, queryset=author.nodetypes_published(),