Mercurial > public > sg101
comparison news/views.py @ 997:19b86e684cc2
WIP on news v2.0.
Initial model changes and submit news functions.
author | Brian Neal <bgneal@gmail.com> |
---|---|
date | Tue, 17 Nov 2015 21:01:20 -0600 |
parents | 79a71b9d0a2a |
children | e2c3d7ecfa30 |
comparison
equal
deleted
inserted
replaced
996:ec28e9d1e82a | 997:19b86e684cc2 |
---|---|
140 @login_required | 140 @login_required |
141 def submit(request): | 141 def submit(request): |
142 if request.method == "POST": | 142 if request.method == "POST": |
143 add_form = AddNewsForm(request.POST) | 143 add_form = AddNewsForm(request.POST) |
144 if add_form.is_valid(): | 144 if add_form.is_valid(): |
145 pending_story = add_form.save(commit=False) | 145 add_form.save(request.user) |
146 pending_story.submitter = request.user | |
147 pending_story.short_text = _clean_html(pending_story.short_text) | |
148 pending_story.long_text = _clean_html(pending_story.long_text) | |
149 pending_story.save() | |
150 return HttpResponseRedirect(reverse('news.views.submit_thanks')) | 146 return HttpResponseRedirect(reverse('news.views.submit_thanks')) |
151 else: | 147 else: |
152 add_form = AddNewsForm() | 148 add_form = AddNewsForm() |
153 | 149 |
154 return render_to_response('news/submit_news.html', { | 150 return render_to_response('news/submit_news.html', { |