Exemplo n.º 1
0
 def inner(request, slug, *args, **kwargs):
     try:
         #search in personal SLUG
         url = Url.objects.get(personal_slug=slug)
     except Url.DoesNotExist:
         id_url = url_decode(slug)
         url = get_object_or_404(Url,id=id_url)
     if SHORTY_MODERATE == True:
         #start moderation
         if url.is_banned:
             return HttpResponseRedirect(SHORTY_BANNED)
         #pending link
         if url.is_pending:
             return HttpResponseRedirect(SHORTY_PENDING)
         #refused link
         if url.is_refused:
             return HttpResponseRedirect(SHORTY_REFUSED)
     return view(request,url,*args,**kwargs)
Exemplo n.º 2
0
 def inner(request, slug, *args, **kwargs):
     try:
         #search in personal SLUG
         url = Url.objects.get(personal_slug=slug)
     except Url.DoesNotExist:
         id_url = url_decode(slug)
         url = get_object_or_404(Url, id=id_url)
     if SHORTY_MODERATE == True:
         #start moderation
         if url.is_banned:
             return HttpResponseRedirect(SHORTY_BANNED)
         #pending link
         if url.is_pending:
             return HttpResponseRedirect(SHORTY_PENDING)
         #refused link
         if url.is_refused:
             return HttpResponseRedirect(SHORTY_REFUSED)
     return view(request, url, *args, **kwargs)
Exemplo n.º 3
0
    def clean(self):
        cleaned_data = super(Private_Form, self).clean()
        slug = cleaned_data.get("cpdr_slg")
        type_slug = cleaned_data.get("cpdr_slg_d")
        p_password = cleaned_data.get("private_password")
        if type_slug == "1":

            try:
                url = Url.objects.get(personal_slug=slug)
            except Url.DoesNotExist:
                raise forms.ValidationError("Ops, something goes wrong ")

        else:

            try:
                url = Url.objects.get(id=url_decode(slug))
            except Url.DoesNotExist:
                raise forms.ValidationError("Ops, something goes wrong ")

        if p_password != url.private_password:
            raise forms.ValidationError("Wrong Password ")

        return cleaned_data
Exemplo n.º 4
0
 def clean(self):
     cleaned_data = super(Private_Form,self).clean()
     slug = cleaned_data.get("cpdr_slg")
     type_slug = cleaned_data.get("cpdr_slg_d")
     p_password = cleaned_data.get("private_password")
     if type_slug == "1":
         
         try:
             url = Url.objects.get(personal_slug=slug)
         except Url.DoesNotExist:
             raise forms.ValidationError("Ops, something goes wrong ")
     
     else:
         
         try:
             url = Url.objects.get(id=url_decode(slug))
         except Url.DoesNotExist:
             raise forms.ValidationError("Ops, something goes wrong ")
         
     if p_password != url.private_password:
         raise forms.ValidationError("Wrong Password ")
     
     return cleaned_data