-
Notifications
You must be signed in to change notification settings - Fork 41
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Hooked up views, templates, and models
- Loading branch information
Bri Lance
authored and
Bri Lance
committed
Feb 25, 2011
1 parent
2cf0025
commit d81d37a
Showing
17 changed files
with
70 additions
and
32 deletions.
There are no files selected for viewing
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,47 @@ | ||
# Create your views here. | ||
from django.http import HttpResponse | ||
from phillyleg.models import Subscription,Keyword | ||
from django.template import Context, loader | ||
|
||
def index(request): | ||
return HttpResponse("this is the index") | ||
t = loader.get_template('subscribe.html') | ||
c = Context() | ||
return HttpResponse(t.render(c)) | ||
|
||
def create(request): | ||
return HttpResponse("this is the create page") | ||
emailvar = request.POST['email'] | ||
s = Subscription(email = emailvar) | ||
s.save() | ||
keywords = request.POST['keywords'] | ||
keylist = keywords.split(",") | ||
for word in keylist: | ||
k = Keyword(keyword = word, subscription = s) | ||
k.save() | ||
members = request.POST.getlist('council') | ||
for mem in members: | ||
k = Keyword(keyword = mem, subscription = s) | ||
k.save() | ||
t = loader.get_template('received.html') | ||
c = Context({ | ||
'emailvar': emailvar, | ||
'keylist': keylist, | ||
'members': members | ||
}) | ||
return HttpResponse(t.render(c)) | ||
|
||
def edit(request, subscription_id): | ||
return HttpResponse("this is the update page for %s" % subscription_idi ) | ||
def unsubscribe(request): | ||
t = loader.get_template('editsubscribe.html') | ||
c = Context() | ||
return HttpResponse(t.render(c)) | ||
|
||
def delete(request): | ||
return HttpResponse("this is the delete page") | ||
t = loader.get_template('unsubscribed.html') | ||
emailvar = request.POST['email'] | ||
s = Subscription.objects.filter(email = emailvar) | ||
for item in s: | ||
item.delete() | ||
c = Context({ | ||
'email': emailvar | ||
}) | ||
return HttpResponse(t.render(c)) | ||
|
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters