How to use perform_after_save method in autotest

Best Python code snippet using autotest_python

feedbackfeed_admin.py

Source: feedbackfeed_admin.py Github

copy

Full Screen

...68 comment = super(AdminPublicDiscussView, self).save_object(form=form)69 comment.visibility = group_models.GroupComment.VISIBILITY_VISIBLE_TO_EVERYONE70 comment.published_datetime = timezone.now()71 return super(AdminPublicDiscussView, self).save_object(form=form, commit=True)72 def perform_after_save(self, comment):73 self.__send_comment_email(comment=comment)74 def get_success_url(self):75 return str(self.request.cradmin_app.reverse_appindexurl())76class AdminWithExaminersDiscussView(AdminBaseFeedbackFeedView):77 """78 Admin view for between admins and examiners.79 Discussing with admins and examiners only on the80 :class:`~.devilry.apps.core.models.AssignmentGroup`.81 """82 template_name = 'devilry_group/​feedbackfeed_admin/​feedbackfeed_admin_examiner_admin_discuss.django.html'83 def get_form_heading_text_template_name(self):84 return 'devilry_group/​include/​admin_commentform_discuss_examiner_headingtext.django.html'85 def get_buttons(self):86 buttons = super(AdminWithExaminersDiscussView, self).get_buttons()87 buttons.extend([88 PrimarySubmit(89 'admin_add_comment_for_examiners_and_admins',90 gettext_lazy('Add note'))91 ])92 return buttons93 def __send_email_to_examiners(self, comment):94 comment_email.bulk_send_comment_email_to_examiners(95 comment_id=comment.id,96 domain_url_start=self.request.build_absolute_uri('/​'))97 def save_object(self, form, commit=False):98 comment = super(AdminWithExaminersDiscussView, self).save_object(form=form)99 comment.visibility = group_models.GroupComment.VISIBILITY_VISIBLE_TO_EXAMINER_AND_ADMINS100 comment.published_datetime = timezone.now()101 return super(AdminWithExaminersDiscussView, self).save_object(form=form, commit=True)102 def perform_after_save(self, comment):103 self.__send_email_to_examiners(comment=comment)104 def get_success_url(self):105 return str(self.request.cradmin_app.reverse_appurl(viewname='admin-examiner-discuss'))106class AdminEditGroupCommentView(EditGroupCommentBase):107 """108 """109class App(crapp.App):110 appurls = [111 crapp.Url(112 r'^$',113 ensure_csrf_cookie(AdminPublicDiscussView.as_view()),114 name=crapp.INDEXVIEW_NAME115 ),116 crapp.Url(...

Full Screen

Full Screen

admin.py

Source: admin.py Github

copy

Full Screen

...90 super(AclGroupAdmin, self).save_model(request, obj, form, change)91 _orig_save_m2m = form.save_m2m92 def save_m2m():93 _orig_save_m2m()94 obj.perform_after_save(change)95 form.save_m2m = save_m2m96admin.site.register(models.AclGroup, AclGroupAdmin)97class DroneSetForm(forms.ModelForm):98 def __init__(self, *args, **kwargs):99 super(DroneSetForm, self).__init__(*args, **kwargs)100 drone_ids_used = set()101 for drone_set in models.DroneSet.objects.exclude(id=self.instance.id):102 drone_ids_used.update(drone_set.drones.values_list('id', flat=True))103 available_drones = models.Drone.objects.exclude(id__in=drone_ids_used)104 self.fields['drones'].widget.choices = [(drone.id, drone.hostname)105 for drone in available_drones]106class DroneSetAdmin(SiteAdmin):107 filter_horizontal = ('drones',)108 form = DroneSetForm...

Full Screen

Full Screen

feedbackfeed_student.py

Source: feedbackfeed_student.py Github

copy

Full Screen

...47 comment_id=comment.id,48 from_student_poster=True)49 def save_object(self, form, commit=False):50 return super(StudentFeedbackFeedView, self).save_object(form, commit=True)51 def perform_after_save(self, comment):52 self.__send_comment_email(comment=comment)53class StudentEditGroupComment(EditGroupCommentBase):54 def dispatch(self, request, *args, **kwargs):55 if not settings.DEVILRY_COMMENT_STUDENTS_CAN_EDIT:56 raise Http404()57 return super(StudentEditGroupComment, self).dispatch(request, *args, **kwargs)58class App(crapp.App):59 appurls = [60 crapp.Url(61 r'^$',62 ensure_csrf_cookie(StudentFeedbackFeedView.as_view()),63 name=crapp.INDEXVIEW_NAME),64 crapp.Url(65 r'^groupcomment-edit/​(?P<pk>\d+)$',...

Full Screen

Full Screen

Blogs

Check out the latest blogs from LambdaTest on this topic:

Scala Testing: A Comprehensive Guide

Before we discuss Scala testing, let us understand the fundamentals of Scala and how this programming language is a preferred choice for your development requirements.The popularity and usage of Scala are rapidly rising, evident by the ever-increasing open positions for Scala developers.

What Agile Testing (Actually) Is

So, now that the first installment of this two fold article has been published (hence you might have an idea of what Agile Testing is not in my opinion), I’ve started feeling the pressure to explain what Agile Testing actually means to me.

How To Choose The Right Mobile App Testing Tools

Did you know that according to Statista, the number of smartphone users will reach 18.22 billion by 2025? Let’s face it, digital transformation is skyrocketing and will continue to do so. This swamps the mobile app development market with various options and gives rise to the need for the best mobile app testing tools

A Complete Guide To CSS Houdini

As a developer, checking the cross browser compatibility of your CSS properties is of utmost importance when building your website. I have often found myself excited to use a CSS feature only to discover that it’s still not supported on all browsers. Even if it is supported, the feature might be experimental and not work consistently across all browsers. Ask any front-end developer about using a CSS feature whose support is still in the experimental phase in most prominent web browsers. ????

Appium Testing Tutorial For Mobile Applications

The count of mobile users is on a steep rise. According to the research, by 2025, it is expected to reach 7.49 billion users worldwide. 70% of all US digital media time comes from mobile apps, and to your surprise, the average smartphone owner uses ten apps per day and 30 apps each month.

Automation Testing Tutorials

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.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run autotest automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful