Best Python code snippet using Kiwi_python
views.py
Source:views.py
...111 for field in formset.form.base_fields.values():112 update_form_field(field, self.owner_ref, self.owner_ref_obj)113 return formset114class ListView(EasyCrudMixin, DjangoListView):115 def get_template_names(self):116 names = super(ListView, self).get_template_names()117 names.append("easycrud/list.html")118 return names119class CreateView(EasyCrudMixin, DjangoCreateView):120 def get_template_names(self):121 names = super(CreateView, self).get_template_names()122 names.append("easycrud/createupdate.html")123 return names124class DetailView(EasyCrudMixin, DjangoDetailView):125 def get_template_names(self):126 names = super(DetailView, self).get_template_names()127 names.append("easycrud/detail.html")128 return names129class UpdateView(EasyCrudMixin, DjangoUpdateView):130 def get_template_names(self):131 names = super(UpdateView, self).get_template_names()132 names.append("easycrud/createupdate.html")133 return names134class DeleteView(EasyCrudMixin, DjangoDeleteView):135 def get_template_names(self):136 names = super(DeleteView, self).get_template_names()137 names.append("easycrud/delete.html")138 return names139 def get_success_url(self):140 if 'success_url' in self.request.POST and self.request.POST['success_url']:141 return self.request.POST['success_url']142 if self.success_url:143 return self.success_url144 name = self.model.model_name.replace(' ', '')145 return reverse('%s_list' % name)146if extra_views_available:147 class CreateWithInlinesView(EasyCrudMixin, StandardCreateWithInlinesView):148 def get_template_names(self):149 names = super(CreateWithInlinesView, self).get_template_names()150 names.append("easycrud/createupdatewithinlines.html")151 return names152 class UpdateWithInlinesView(EasyCrudMixin, StandardUpdateWithInlinesView):153 def get_template_names(self):154 names = super(UpdateWithInlinesView, self).get_template_names()155 names.append("easycrud/createupdatewithinlines.html")...
view_mixins.py
Source:view_mixins.py
...13class EasyUIDatagridView(MenuPositionMixin, EasyUIListMixin, ListView):14 """15 å
å«datagridçé»è®¤åæ°å¤çï¼èåçä½ç½®ç16 """17 def get_template_names(self):18 """19 datagridçé»è®¤æ¨¡æ¿20 """21 names = super(EasyUIDatagridView, self).get_template_names()22 names.append('easyui/datagrid.html')23 return names24class EasyUICreateView(EasyUIFormMixin, CsrfExemptMixin, SingleObjectMixin, EasyUIGetVarMixin, CreateView):25 """26 EasyUIçCreateView27 """28 success_url = reverse_lazy('easyui:success')29 def get_template_names(self):30 """31 datagridçé»è®¤æ¨¡æ¿32 """33 names = super(EasyUICreateView, self).get_template_names()34 names.append('easyui/form.html')35 return names36class EasyUIUpdateView(EasyUIFormMixin, CsrfExemptMixin, SingleObjectMixin, EasyUIGetVarMixin, UpdateView):37 """38 EasyUIçUpdateView39 """40 success_url = reverse_lazy('easyui:success')41 def get_template_names(self):42 """43 datagridçé»è®¤æ¨¡æ¿44 """45 names = super(EasyUIUpdateView, self).get_template_names()46 names.append('easyui/form.html')47 return names48class EasyUIDeleteView( SingleObjectMixin, EasyUIGetVarMixin, DeleteView):49 """50 EasyUIçDeleteView51 """52 # è¿ä¸ªurlä¸åå¨ç53 success_url = reverse_lazy('easyui:success')54 def get_template_names(self):55 """56 datagridçé»è®¤æ¨¡æ¿57 """58 names = super(EasyUIDeleteView, self).get_template_names()59 names.append('easyui/confirm_delete.html')60 return names61class CommandDatagridView(MenuPositionMixin, EasyUIListMixin, ListView):62 """63 éæ©datagridçé项ï¼ç¶åæ¯è¡åç¬æ§è¡æä½64 """65 single_select = False66 def get_template_names(self):67 """68 datagridçé»è®¤æ¨¡æ¿69 """70 names = super(CommandDatagridView, self).get_template_names()71 names.append('easyui/command_datagrid.html')...
Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!