Answer the question
In order to leave comments, you need to log in
How to do event handling in Django Template?
How can I add a user to a group by clicking on a button, yes it should be request.user and group.add () in the view
from django.contrib.auth.models import Group
group = Group.objects.get(name='groupname')
user.groups.add(group)
<li>Также вы можете <a>cтать тренером</a>, и получить дополнительные возможности.</li>
Answer the question
In order to leave comments, you need to log in
If you're seriously asking a question (I'm asking because it's trivial, as commenters have pointed out before), then keep in mind that links generate a GET request. GET requests should not change the state of the application (for a variety of reasons, for example, because the link may be preloaded by a browser, or a browser extension, or a search engine).
Therefore, if you really need a link, then you need to create a form with the POST method, and when you click the link, send this particular form (for example, using javascript).
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question