Self hosted FLOSS fitness/workout, nutrition and weight tracker
Remove set_author and send_email methods
Roland Geiderc77651cbdd3f
diff --git a/wger/exercises/models/exercise.py b/wger/exercises/models/exercise.pyindex 43119261b..063da006c 100644--- a/wger/exercises/models/exercise.py+++ b/wger/exercises/models/exercise.py@@ -215,52 +215,3 @@ class Exercise(AbstractLicenseModel, models.Model):Exercise has no owner information"""return False-- def send_email(self, request):- """- Sends an email after being successfully added to the database (for user- submitted exercises only)- """- try:- user = User.objects.get(username=self.license_author)- except User.DoesNotExist:- return- if self.license_author and user.email:- translation.activate(user.userprofile.notification_language.short_name)- url = request.build_absolute_uri(self.get_absolute_url())- subject = _('Exercise was successfully added to the general database')- context = {- 'exercise': self.name,- 'url': url,- 'site': Site.objects.get_current().domain,- }- message = render_to_string('exercise/email_new.tpl', context)- mail.send_mail(- subject,- message,- settings.WGER_SETTINGS['EMAIL_FROM'], [user.email],- fail_silently=True- )-- def set_author(self, request):- """- Set author- This is only used when creating exercises (via web or API)- """-- if request.user.has_perm('exercises.add_exercise'):- if not self.license_author:- self.license_author = request.get_host().split(':')[0]- else:- if not self.license_author:- self.license_author = request.user.username-- subject = _('New user submitted exercise')-- message = _('The user {0} submitted a new exercise "{1}".'- ).format(request.user.username, self.name)- mail.mail_admins(- str(subject),- str(message),- fail_silently=True,- )diff --git a/wger/exercises/models/image.py b/wger/exercises/models/image.pyindex 9bfd20982..e072d10f7 100644--- a/wger/exercises/models/image.py+++ b/wger/exercises/models/image.py@@ -167,26 +167,3 @@ class ExerciseImage(AbstractSubmissionModel, AbstractLicenseModel, models.Model)Image has no owner information"""return False-- def set_author(self, request):- """- Set author and status- This is only used when creating images (via web or API)- """- if request.user.has_perm('exercises.add_exerciseimage'):- self.status = self.STATUS_ACCEPTED- if not self.license_author:- self.license_author = request.get_host().split(':')[0]-- else:- if not self.license_author:- self.license_author = request.user.username-- subject = _('New user submitted image')- message = _('The user {0} submitted a new image "{1}" for exercise {2}.'- ).format(request.user.username, self.name, self.exercise)- mail.mail_admins(- str(subject),- str(message),- fail_silently=True,- )diff --git a/wger/exercises/views/images.py b/wger/exercises/views/images.pyindex 145dddd96..3d1a67788 100644--- a/wger/exercises/views/images.py+++ b/wger/exercises/views/images.py@@ -98,7 +98,6 @@ class ExerciseImageAddView("""Set the exercise base and the author"""exercise = get_object_or_404(Exercise, pk=self.kwargs['exercise_pk'])form.instance.exercise_base = exercise.exercise_base- form.instance.set_author(self.request)return super(ExerciseImageAddView, self).form_valid(form)def get_success_url(self):