How to insert new string to DB by button Django
How to insert new string to DB by button Django and get id new record
<a href="{% url "main:create_bd_line" %}"><button type="button" class="btn btn-secondary">Начать</button></a>
def create_bd_line(request):
user_group = request.user.groups.values_list()
university = user_group[0][1]
I do this and its work
num = Answers.objects.all().count() # number of strings in table
new_user_answer = num + 1
new_line = Answers(id=new_user_answer)
new_line.save()