Commit 531f839a4741b606efc6b6a97b6c87c362ca58be
1 parent
9fa6c02c
Exists in
master
and in
5 other branches
Send form error in form #211
Showing
1 changed file
with
7 additions
and
5 deletions
Show diff stats
app/views.py
| ... | ... | @@ -75,11 +75,13 @@ class AmadeusSettings(LoginRequiredMixin, HasRoleMixin, generic.CreateView): |
| 75 | 75 | |
| 76 | 76 | def get_context_data(self, **kwargs): |
| 77 | 77 | context = super(AmadeusSettings, self).get_context_data(**kwargs) |
| 78 | - try: | |
| 79 | - setting = EmailBackend.objects.latest('id') | |
| 80 | - context['form'] = EmailBackendForm(instance = setting) | |
| 81 | - except: | |
| 82 | - pass | |
| 78 | + if not self.request.method == 'POST': | |
| 79 | + try: | |
| 80 | + setting = EmailBackend.objects.latest('id') | |
| 81 | + context['form'] = EmailBackendForm(instance = setting) | |
| 82 | + except: | |
| 83 | + pass | |
| 84 | + print(context['form']) | |
| 83 | 85 | return context |
| 84 | 86 | |
| 85 | 87 | ... | ... |