Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @method_decorator(login_required, name='dispatch')
- class ImmatriculationCreate(CreateView):
- model = Immatriculation
- template_name = 'vol/immatriculation_add.html'
- fields = ['immatriculation',
- 'type_avion']
- success_url = '/immatriculation_add/list'
- # template_name_suffix = '_add'
- def get_context_data(self, **kwargs):
- context = super(ImmatriculationCreate, self).get_context_data(**kwargs)
- data = Immatriculation.objects.all()
- context['data'] = data
- return context
- def form_valid(self, form):
- form.instance.user_id = self.request.user
- return super(ImmatriculationCreate, self).form_valid(form)
- def dispatch(self, *args, **kwargs):
- return super().dispatch(*args, **kwargs)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement