コード例 #1
0
ファイル: views.py プロジェクト: LibraryOfCongress/viewshare
    def generate_context(self, request, form, *args, **kwargs):
        exhibit_slug = form.cleaned_data.get("exhibit_slug")
        exhibit_owner = form.cleaned_data.get("exhibit_owner")
        # get Exhibit associated with this augmentation issue
        exhibit = DraftExhibit.objects.get(slug=exhibit_slug, owner__username=exhibit_owner)
        # check that current user has access to this exhibit
        if exhibit.owner.username != request.user.username:
            return HttpResponseBadRequest()
        # copy the exhibit for the support user
        support = get_user(settings.SUPPORT_USER)
        new_slug = str(uuid.uuid4())
        exhibit.pk = None
        exhibit.id = None
        exhibit.parent = None
        exhibit.owner = support
        exhibit.slug = new_slug
        exhibit.save()
        old_exhibit = DraftExhibit.objects.get(slug=exhibit_slug)
        old_exhibit.duplicate_properties(exhibit)

        augmented_field_label = form.cleaned_data.get("label")
        augmented_field_type = form.cleaned_data.get("type")
        augmented_field_composite = form.cleaned_data.get("composite")

        c = super(AugmentationIssueView, self).generate_context(request, form)
        return dict(
            c,
            **{
                "augmented_field_label": augmented_field_label,
                "augmented_field_type": augmented_field_type,
                "augmented_field_composite": augmented_field_composite,
                "exhibit_url": reverse("exhibit_property_editor", kwargs={"owner": support.username, "slug": new_slug}),
            }
        )
コード例 #2
0
    def generate_context(self, request, form, *args, **kwargs):
        exhibit_slug = form.cleaned_data.get("exhibit_slug")
        exhibit_owner = form.cleaned_data.get("exhibit_owner")
        # get Exhibit associated with this augmentation issue
        exhibit = DraftExhibit.objects.get(slug=exhibit_slug,
                                           owner__username=exhibit_owner)
        # check that current user has access to this exhibit
        if exhibit.owner.username != request.user.username:
            return HttpResponseBadRequest()
        # copy the exhibit for the support user
        support = get_user(settings.SUPPORT_USER)
        new_slug = str(uuid.uuid4())
        exhibit.pk = None
        exhibit.id = None
        exhibit.parent = None
        exhibit.owner = support
        exhibit.slug = new_slug
        exhibit.save()
        old_exhibit = DraftExhibit.objects.get(slug=exhibit_slug)
        old_exhibit.duplicate_properties(exhibit)

        augmented_field_label = form.cleaned_data.get("label")
        augmented_field_type = form.cleaned_data.get("type")
        augmented_field_composite = form.cleaned_data.get("composite")

        c = super(AugmentationIssueView, self).generate_context(request, form)
        return dict(
            c, **{
                "augmented_field_label":
                augmented_field_label,
                "augmented_field_type":
                augmented_field_type,
                "augmented_field_composite":
                augmented_field_composite,
                "exhibit_url":
                reverse('exhibit_property_editor',
                        kwargs={
                            'owner': support.username,
                            'slug': new_slug
                        })
            })
コード例 #3
0
ファイル: feeds.py プロジェクト: LibraryOfCongress/viewshare
    def get_object(self, request, owner=None):

        return get_user(username=owner)
コード例 #4
0
ファイル: views.py プロジェクト: LibraryOfCongress/viewshare
    def get_context_data(self,**kwargs):
        kwargs = super(ConnectionListByUserView, self).get_context_data(**kwargs)

        kwargs["other_user"] = get_user(self.kwargs.get("username"))
        return kwargs
コード例 #5
0
ファイル: views.py プロジェクト: LibraryOfCongress/viewshare
 def get_queryset(self):
     return Friendship.objects.friends_for_user(get_user(self.kwargs.get("username")))
コード例 #6
0
ファイル: feeds.py プロジェクト: sshyran/viewshare
    def get_object(self, request, owner=None):

        return get_user(username=owner)
コード例 #7
0
ファイル: views.py プロジェクト: sshyran/viewshare
    def get_context_data(self, **kwargs):
        kwargs = super(ConnectionListByUserView,
                       self).get_context_data(**kwargs)

        kwargs["other_user"] = get_user(self.kwargs.get("username"))
        return kwargs
コード例 #8
0
ファイル: views.py プロジェクト: sshyran/viewshare
 def get_queryset(self):
     return Friendship.objects.friends_for_user(
         get_user(self.kwargs.get("username")))