sending email from admin to user in django - Printable Version +- Python Forum (https://python-forum.io) +-- Forum: Python Coding (https://python-forum.io/forum-7.html) +--- Forum: Web Scraping & Web Development (https://python-forum.io/forum-13.html) +--- Thread: sending email from admin to user in django (/thread-18942.html) |
sending email from admin to user in django - anjana - Jun-07-2019 i want to send email from admin to user .my code get no reverse match error. views.py def emails(request,id): subject = 'leave confirmation' message = ' your leav application approved' email_from = settings.EMAIL_HOST_USER x=leavdb11.objects.all() for i in x: if i.id==int(id): recipient_list = [i.email,] send_mail( subject, message, email_from,recipient_list) return HttpResponse("send") urls.py url(r'^emails/(\d+)/',emails,name='emails'), html <body> <a href="{% url 'emails' %} ">send mail</a> </body> forms.py class ButtonWidget(forms.Widget): template_name = 'auth_button_widget.html' def renders(self, name, value, attrs=None): context = { 'url': '/', } return mark_safe(render_to_string(self.template_name, context)) class leavapprv(forms.ModelForm): button = forms.CharField(widget=ButtonWidget) class Meta: model = leavdb11 fields = "__all__" |