Adds status tests

This commit is contained in:
Mouse Reeve
2021-01-12 14:02:38 -08:00
parent 4ec64c02f4
commit 6c80b128a4
7 changed files with 252 additions and 171 deletions

View File

@ -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', '/'))