Answer the question
In order to leave comments, you need to log in
How to make an anchor to a part of a django page?
There is a link to contacts (they are on the main page at the bottom) and I need to transfer the user to the specified part of the page by clicking
<li class="menu__item menu__item_footer">
<a href="{% url 'main:index' %}" class="menu__link">Контакты</a>
</li>
class ContactView(SuccessMessageMixin, FormView):
template_name = 'main/index.html'
form_class = EmailForm
success_url = 'main/index.html'
success_message = "Письмо успешно отправлено"
def form_valid(self, form):
email = form.cleaned_data['email']
send_mail('Caparol_Center_Spb',
'Теперь вы будете получать лучшие предложения шоу-рума',
settings.EMAIL_HOST_USER,
[email, ],
fail_silently=False,)
success_message = self.get_success_message(form.cleaned_data)
if success_message:
messages.success(self.request, success_message)
if not Subscriber.objects.filter(email=email).exists():
Subscriber.objects.create(email=email)
return redirect(reverse('main:index'))
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question