Adds status tests
This commit is contained in:
parent
4ec64c02f4
commit
6c80b128a4
7 changed files with 252 additions and 171 deletions
|
@ -54,9 +54,11 @@ class CreateStatus(View):
|
|||
''' get posting '''
|
||||
def post(self, request, status_type):
|
||||
''' create status of whatever type '''
|
||||
if status_type not in models.status_models:
|
||||
status_type = status_type[0].upper() + status_type[1:]
|
||||
try:
|
||||
form = getattr(forms, '%sForm' % status_type)(request.POST)
|
||||
except AttributeError:
|
||||
return HttpResponseBadRequest()
|
||||
form = forms.get_attr(status_type)(request.POST)
|
||||
if not form.is_valid():
|
||||
return redirect(request.headers.get('Referer', '/'))
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue