Skip to content

Commit

Permalink
Add page data
Browse files Browse the repository at this point in the history
  • Loading branch information
mdhash committed Jun 11, 2017
1 parent f5e0207 commit 240d42a
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 17 deletions.
22 changes: 11 additions & 11 deletions ahmia/ahmia/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,17 @@ class Meta:
model = HiddenWebsite
fields = ('onion',)

def send_new_onion(self):
"""Send a new onion request by email."""
if settings.DEBUG:
return
subject = "Hidden service add onion request"
message = "User requests to add the following onion url {0}".format(
self.cleaned_data['onion']
)
send_mail(subject, message,
settings.DEFAULT_FROM_EMAIL, settings.RECIPIENT_LIST,
fail_silently=False)
# def send_new_onion(self):
# """Send a new onion request by email."""
# if settings.DEBUG:
# return
# subject = "Hidden service add onion request"
# message = "User requests to add the following onion url {0}".format(
# self.cleaned_data['onion']
# )
# send_mail(subject, message,
# settings.DEFAULT_FROM_EMAIL, settings.RECIPIENT_LIST,
# fail_silently=False)

class ReportOnionForm(forms.Form):
"""Request to add an onion domain."""
Expand Down
17 changes: 11 additions & 6 deletions ahmia/ahmia/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ class AddView(TemplateView):
"""Add form for a new .onion address."""
form_class = AddOnionForm
success_url = "/add/success/"
success_template = "add_success.html"
template_name = "add.html"
# if request.POST:
# onion = AddOnionForm(request.POST)
Expand All @@ -73,12 +74,16 @@ class AddView(TemplateView):
# except ValidationError as error:
# print "Invalid data: %s" % error
def post(self, request):
domain = AddOnionForm(request.POST)
if domain.is_valid():
domain.save()
#text=domain.cleaned_data('')
#domain=AddOnionForm()
return redirect('/add/success')
domain = AddOnionForm()
if request.method=="POST":
domain = AddOnionForm(request.POST)
print domain
if domain.is_valid():
onion = request.POST.get('onion','')
onion_add = HiddenWebsite(onion = onion)
print onion_add.onion
onion_add.save()
return redirect('/add/success')

#args = {'domain':domain, 'text':text}
return render(request,self.template_name)
Expand Down

0 comments on commit 240d42a

Please sign in to comment.