Esempio n. 1
0
File: views.py Progetto: relique/crm
 def post(self, request, *args, **kwargs):
     self.object = None
     form_class = self.get_form_class()
     form = self.get_form(form_class)
     amount_form = AmountFormSet(request.POST)
     if form.is_valid() and amount_form.is_valid():
         return self.form_valid(form, amount_form)
     else:
         return self.form_invalid(form, amount_form)
Esempio n. 2
0
File: views.py Progetto: relique/crm
 def post(self, request, *args, **kwargs):
     self.object = None
     form_class = self.get_form_class()
     form = self.get_form(form_class)
     amount_form = AmountFormSet(request.POST)
     if form.is_valid() and amount_form.is_valid():
         return self.form_valid(form, amount_form)
     else:
         return self.form_invalid(form, amount_form)
Esempio n. 3
0
File: views.py Progetto: relique/crm
    def post(self, request, *args, **kwargs):
        self.object = self.get_object()
        # Users cannot update customers that do not belong to them.
        if request.user != self.object.user:
            return http.HttpResponseForbidden()

        form_class = self.get_form_class()
        form = self.get_form(form_class)
        amount_form = AmountFormSet(request.POST)
        if form.is_valid() and amount_form.is_valid():
            return self.form_valid(form, amount_form)
        else:
            return self.form_invalid(form, amount_form)
Esempio n. 4
0
File: views.py Progetto: relique/crm
    def post(self, request, *args, **kwargs):
        self.object = self.get_object()
        # Users cannot update customers that do not belong to them.
        if request.user != self.object.user:
            return http.HttpResponseForbidden()

        form_class = self.get_form_class()
        form = self.get_form(form_class)
        amount_form = AmountFormSet(request.POST)
        if form.is_valid() and amount_form.is_valid():
            return self.form_valid(form, amount_form)
        else:
            return self.form_invalid(form, amount_form)
Esempio n. 5
0
File: views.py Progetto: relique/crm
 def get_context_data(self, **kwargs):
     ctx = super(CustomerUpdate, self).get_context_data(**kwargs)
     ctx['amount_form'] = AmountFormSet()
     vname = Customer._meta.verbose_name
     if self.request.user == self.object.user:
         ctx['title'] = "Edit {}".format(vname)
     else:
         ctx['title'] = "View {}".format(vname)
     ctx['title_icon'] = 'user'
     return ctx
Esempio n. 6
0
File: views.py Progetto: relique/crm
 def get_context_data(self, **kwargs):
     ctx = super(CustomerCreate, self).get_context_data(**kwargs)
     ctx['amount_form'] = AmountFormSet()
     ctx['title_icon'] = 'user'
     ctx['title'] = "Create new {}".format(Customer._meta.verbose_name)
     return ctx