I got 2 divs, one with panel bootstrap class, another without, and I need to place this panel div below the regular one. Now it looks like this:
but when I place my panel div below regular one I get the following:
so the upper content is capured by panel div. The code is as follows:
<div class="container">
<div class="form_container" style="float:left;">
<div class="form-group col-md-12" style="margin-top: 20px;">
<div class="col-md-6">
<div class="input-group pull-left">
<input id="message" type="text" class="form-control" placeholder="Введите фразу и нажмите Enter" autofocus="" autocomplete="off">
<span class="input-group-btn">
<button class="btn btn-default btn-add" type="button" id="chat_send">Отправить</button>
</span>
</div>
</div>
<div class="form-group col-md-6">
<label for="server" class="col-xs-2 control-label" style="padding-left: 14%;padding-right: 10%;margin-top: 5px;">Сервер</label>
<div class="col-md-8">
<select class="form-control" id="server" name="server_field">
{% for server_addr in server_address %}
{% for k, v in server_addr %}
<option value="{{ v }}">{{ k }}</option>
{% endfor %}
{% endfor %}
</select>
</div>
</div>
</div>
</div>
<div class="panel panel-default" style="margin-top: 1%;" >
<div class="panel-body" style="padding-top: 0;padding-bottom: 0;">
<div class="form-group col-md-8" style="margin-top:12px;">
<label for="phrase_group" class="col-xs-3 control-label" style="margin-top: 5px;">Выберите группу</label>
<div class="col-md-8">
<select class="form-control" id="phrase_group" name="phrase_group" style="width:40%; float:left;">
<option value="{{ group.id }}">{{ group.phraseset }}</option>
{% for group in group_phrases %}
<option value="{{ group.id }}">{{ group.phraseset }}</option>
{% endfor %}
</select>
<button id="test_phraseset" class="btn btn-primary" style="margin-left: 10%;" data-id="2">Тест</button>
<button id="clear_phraseset" class="btn btn-primary" style="margin-left: 7%;" data-id="2">Очистить</button>
</div>
</div>
</div>
</div>
</div>
Any ideas how to fix that? thank you.
Related
I am having template that I got from one of mu front-end developers who is not familiar with python and Django. In order to keep the design as it is right now, I would liketo use only template and its view for objects modification, instead there is a way to use the same design by using forms.py.
For your information, I was able to use the same desing in the adding function but in the editing function it is not working.
How can I do it without having to change the front-design?
Temlapte.html
{% extends 'base.html' %}
{% load static %}
{% block title %}
<title>Liste des employés</title>
{% endblock title %}
{% block content %}
<!-- Main Wrapper -->
<div class="main-wrapper">
<div class="page-wrapper">
<!-- Page Content -->
<div class="content container-fluid">
<!-- Page Header -->
<div class="page-header">
<div class="row align-items-center">
<div class="col">
<h3 class="page-title">Employé</h3>
<ul class="breadcrumb">
<li class="breadcrumb-item">Tableau de bord</li>
<li class="breadcrumb-item active">Employé</li>
</ul>
</div>
<div class="col-auto float-end ms-auto">
<i class="fa fa-plus"></i> Ajouter un employé
<div class="view-icons">
<i class="fa fa-th"></i>
<i class="fa fa-bars"></i>
</div>
</div>
</div>
</div>
<!-- /Page Header -->
<!-- Search Filter -->
<div class="row filter-row">
<div class="col-sm-6 col-md-3">
<div class="form-group form-focus">
<input type="text" class="form-control floating">
<label class="focus-label">ID employé</label>
</div>
</div>
<div class="col-sm-6 col-md-3">
<div class="form-group form-focus">
<input type="text" class="form-control floating">
<label class="focus-label">Nom employé</label>
</div>
</div>
<div class="col-sm-6 col-md-3">
<div class="form-group form-focus select-focus">
<select class="select" name="service">
<option value="">Selectionner une grade</option>
{% for grade in listeGrade %}
<option value="{{ grade.id }}">{{ grade.niveau_grade }}</option>
{% endfor %}
</select>
<label class="focus-label">Grade</label>
</div>
</div>
<div class="col-sm-6 col-md-3">
<div class="d-grid">
Rechercher
</div>
</div>
</div>
<!-- Search Filter -->
<div class="row staff-grid-row">
{% for emp in listEmp %}
<div class="col-md-4 col-sm-6 col-12 col-lg-4 col-xl-3">
<div class="profile-widget">
{% if emp.photo %}
<div class="profile-img">
<img src="{{ emp.photo.url }}" alt="">
</div>
{% endif %}
<div class="dropdown profile-action">
<i class="material-icons">more_vert</i>
<div class="dropdown-menu dropdown-menu-right">
<a class="dropdown-item" href="{% url 'hr:edit-employee' emp.id %}" data-bs-toggle="modal" data-bs-target="#edit_employee"><i class="fa fa-pencil m-r-5"></i> Modifier</a>
<a class="dropdown-item" href="{% url 'hr:remove-employee' emp.id %}" data-bs-toggle="modal" data-bs-target="#delete_employee"><i class="fa fa-trash-o m-r-5"></i> Supprimer</a>
</div>
</div>
<h4 class="user-name m-t-10 mb-0 text-ellipsis">{{ emp.nom}} {{ emp.prenom}}</h4>
<div class="small text-muted">{{ emp.qualification }}</div>
</div>
</div>
{% endfor %}
</div>
<!-- /Page Content -->
<!-- Add Employee Modal -->
<div id="add_employee" class="modal custom-modal fade" role="dialog">
<div class="modal-dialog modal-dialog-centered modal-lg">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title">Ajouter une employé</h5>
<button type="button" class="close" data-bs-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>
<div class="modal-body">
<form action="" method="post" enctype="multipart/form-data"> {% csrf_token %}
<div class="row">
<div class="col-sm-6">
<div class="form-group">
<label class="col-form-label">ID employé <span class="text-danger">*</span></label>
<input class="form-control" type="text" name="id_Personnel">
</div>
</div>
<div class="col-sm-6">
<div class="form-group">
<label class="col-form-label">Prénom <span class="text-danger">*</span></label>
<input class="form-control" type="text", name="prenom">
</div>
</div>
<div class="col-sm-6">
<div class="form-group">
<label class="col-form-label">Nom</label>
<input class="form-control" type="text" name="nom">
</div>
</div>
<div class="col-sm-6">
<div class="form-group">
<label class="col-form-label">Date de naissance<span class="text-danger">*</span></label>
<div class="cal-icon"><input class="form-control" type="text" name="date_de_naissance" placeholder="YYYY-MM-DD"></div>
</div>
</div>
<div class="col-md-6">
<div class="form-group">
<label>Sexe <span class="text-danger">*</span></label>
<select class="select" name="sexe">
<option>Selectionner le sexe</option>
<option value="M">Masculin</option>
<option value="F">Féminin</option>
</select>
</div>
</div>
<div class="col-sm-6">
<div class="form-group">
<label class="col-form-label">CIN <span class="text-danger">*</span></label>
<input class="form-control" type="text" name="CIN">
</div>
</div>
<div class="col-sm-6">
<div class="form-group">
<label class="col-form-label">Photo</label>
<input class="form-control" type="file" name="photo">
</div>
</div>
<div class="col-sm-6">
<div class="form-group">
<label class="col-form-label">Téléphone <span class="text-danger">*</span></label>
<input class="form-control" type="text" name="telephone">
</div>
</div>
<div class="col-sm-6">
<div class="form-group">
<label class="col-form-label">Email</label>
<input class="form-control" type="email" name="email">
</div>
</div>
<div class="col-sm-6">
<div class="form-group">
<label class="col-form-label">Adresse actuelle<span class="text-danger">*</span></label>
<input class="form-control" type="text" name="adresse_actuelle">
</div>
</div>
<div class="col-sm-6">
<div class="form-group">
<label class="col-form-label">Adresse permanente<span class="text-danger">*</span></label>
<input type="text" class="form-control" name="adresse_permanente">
</div>
</div>
<div class="col-sm-6">
<div class="form-group">
<label class="col-form-label">Date d'embauche<span class="text-danger">*</span></label>
<div class="cal-icon"><input class="form-control" type="text" name="date_de_recrutement" placeholder="YYYY-MM-DD"></div>
</div>
</div>
<div class="col-md-6">
<div class="form-group">
<label>Service <span class="text-danger">*</span></label>
<select class="select" name="service">
<option value="">Selectionner un service</option>
{% for service in listeService %}
<option value="{{ service.id }}">{{ service.Service }}</option>
{% endfor %}
</select>
</div>
</div>
<div class="col-md-6">
<div class="form-group">
<label>Diplôme obtenu <span class="text-danger">*</span></label>
<select class="select" name="diplome_obtenu">
<option>Selectionner un diplôme</option>
<option value="DEUG">DEUG</option>
<option value="LICENCE">LICENCE</option>
<option value="MAITRISE">MAITRISE</option>
<option value="MASTER">MASTER</option>
<option value="DOCTORAT">DOCTORAT</option>
<option value="AUTRE">AUTRE</option>
</select>
</div>
</div>
<div class="col-sm-6">
<div class="form-group">
<label class="col-form-label">Qualification </label>
<input class="form-control" type="text" name="qualification">
</div>
</div>
<div class="col-md-6">
<div class="form-group">
<label>Grade</label>
<select class="select" name="grade">
<option value="">Selectionner une grade</option>
{% for grade in listeGrade %}
<option value="{{ grade.id }}">{{ grade.niveau_grade }}</option>
{% endfor %}
</select>
</div>
</div>
</div>
<div class="submit-section">
<button class="btn btn-primary submit-btn">Enrégistrer</button>
</div>
</form>
</div>
</div>
</div>
</div>
<!-- /Add Employee Modal -->
<!-- Edit Employee Modal -->
<div id="edit_employee" class="modal custom-modal fade" role="dialog">
<div class="modal-dialog modal-dialog-centered modal-lg" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title">Modifier un employé</h5>
<button type="button" class="close" data-bs-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>
<div class="modal-body">
<form action="" method="post" enctype="multipart/form-data">
{% csrf_token %}
<div class="row">
<div class="col-sm-6">
<div class="form-group">
<label class="col-form-label">ID employé <span class="text-danger">*</span></label>
<input class="form-control" type="text" name="id_Personnel" value="{{ emp_name.id_Personnel }}">
</div>
</div>
<div class="col-sm-6">
<div class="form-group">
<label class="col-form-label">Prénom <span class="text-danger">*</span></label>
<input class="form-control" type="text", name="prenom" value="{{ emp_name.prenom }}">
</div>
</div>
<div class="col-sm-6">
<div class="form-group">
<label class="col-form-label">Nom</label>
<input class="form-control" type="text" name="nom" value="{{ emp_name.nom }}">
</div>
</div>
<div class="col-sm-6">
<div class="form-group">
<label class="col-form-label">Date de naissance<span class="text-danger">*</span></label>
<div class="cal-icon"><input class="form-control datetimepicker" type="text" name="date_de_naissance" value="{{ emp_name.date_de_naissance }}"></div>
</div>
</div>
<div class="col-md-6">
<div class="form-group">
<label>Sexe <span class="text-danger">*</span></label>
<select class="select" name="sexe">
<option>Selectionner le sexe</option>
<option value="M" {% ifequal emp_name.sexe M %} selected="selected"{% endifequal %} >Masculin</option>
<option value="F" value="M" {% ifequal emp_name.sexe F %} selected="selected"{% endifequal %}>Féminin</option>
</select>
</div>
</div>
<div class="col-sm-6">
<div class="form-group">
<label class="col-form-label">CIN <span class="text-danger">*</span></label>
<input class="form-control" type="text" name="CIN" value="{{ emp_name.CIN }}">
</div>
</div>
<div class="col-sm-6">
<div class="form-group">
<label class="col-form-label">Photo</label>
<input class="form-control" type="file" name="photo" value="{{ emp_name.photo }}">
</div>
</div>
<div class="col-sm-6">
<div class="form-group">
<label class="col-form-label">Téléphone <span class="text-danger">*</span></label>
<input class="form-control" type="text" name="telephone">
</div>
</div>
<div class="col-sm-6">
<div class="form-group">
<label class="col-form-label">Email</label>
<input class="form-control" type="email" name="email" value="{{emp_name.email}}">
</div>
</div>
<div class="col-sm-6">
<div class="form-group">
<label class="col-form-label">Adresse actuelle<span class="text-danger">*</span></label>
<input class="form-control" type="text" name="adresse_actuelle" value="{{emp_name.adresse_actuelle}}">
</div>
</div>
<div class="col-sm-6">
<div class="form-group">
<label class="col-form-label">Adresse permanente<span class="text-danger">*</span></label>
<input type="text" class="form-control" name="adresse_permanente" value="{{emp_name.adresse_permanente}}">
</div>
</div>
<div class="col-sm-6">
<div class="form-group">
<label class="col-form-label">Date d'embauche<span class="text-danger">*</span></label>
<div class="cal-icon"><input class="form-control datetimepicker" type="text" name="date_de_recrutement" value="date_de_recrutement"></div>
</div>
</div>
<div class="col-md-6">
<div class="form-group">
<label>Service <span class="text-danger">*</span></label>
<select class="select" name="service">
<option value="">Selectionner un service</option>
{% for service in listeService %}
<option value="{{ service.id }}" value="emp_name.service">{{ service.Service }}</option>
{% endfor %}
</select>
</div>
</div>
<div class="col-md-6">
<div class="form-group">
<label>Diplôme obtenu <span class="text-danger">*</span></label>
<select class="select" name="diplome_obtenu">
<option>Selectionner un diplôme</option>
<option value="DEUG">DEUG</option>
<option value="LICENCE">LICENCE</option>
<option value="MAITRISE">MAITRISE</option>
<option value="MASTER">MASTER</option>
<option value="DOCTORAT">DOCTORAT</option>
<option value="AUTRE">AUTRE</option>
</select>
</div>
</div>
<div class="col-sm-6">
<div class="form-group">
<label class="col-form-label">Qualification </label>
<input class="form-control" type="text" name="qualification">
</div>
</div>
<div class="col-md-6">
<div class="form-group">
<label>Grade</label>
<select class="select" name="grade">
<option value="">Selectionner une grade</option>
{% for grade in listeGrade %}
<option value="{{ grade.id }}">{{ grade.niveau_grade }}</option>
{% endfor %}
</select>
</div>
</div>
</div>
<div class="submit-section">
<button class="btn btn-primary submit-btn">Enregistrer les modifications</button>
</div>
</form>
</div>
</div>
</div>
</div>
<!-- /Edit Employee Modal -->
</div>
<!-- /Page Wrapper -->
</div>
<!-- /Main Wrapper -->
{% endblock content %}
Adding views:
def ListEmployeeGrid(request):
template ='employees/employees.html'
listEmp=Personnel.objects.all()
listeGrade=Grades.objects.all()
listeService=Services.objects.all()
form = EmployeeAddForm(request.POST or None,request.FILES)
if request.method=='POST':
# if forms.is_valid():
Personnel.objects.create(
id_Personnel=request.POST["id_Personnel"],
photo = request.FILES["photo"],
prenom = request.POST["prenom"],
nom = request.POST["nom"],
sexe= request.POST["sexe"],
date_de_naissance= request.POST["date_de_naissance"],
CIN = request.POST['CIN'],
telephone =request.POST["telephone"],
email = request.POST["email"],
adresse_actuelle = request.POST["adresse_actuelle"],
adresse_permanente = request.POST["adresse_permanente"],
diplome_obtenu = request.POST["diplome_obtenu"],
qualification = request.POST["qualification"],
grade = Grades.objects.get(id=request.POST["grade"]),
date_de_recrutement = request.POST["date_de_recrutement"],
service = Services.objects.get(id=request.POST["service"]),
create_date = date.today(),
updateDate = date.today(),
)
# return redirect('hr:list_employee')
context={
'listEmp':listEmp,
'listeGrade':listeGrade,
'listeService':listeService
}
return render(request, template, context)
Employ edition view
def Edit_Employee(request, id):
emp_name=get_object_or_404(Personnel,id=id)
listEmp=Personnel.objects.all()
listeGrade=Grades.objects.all()
listeService=Services.objects.all()
Personnel.objects.update_or_create(
id_Personnel=request.POST["id_Personnel"],
photo = request.FILES["photo"],
prenom = request.POST["prenom"],
nom = request.POST["nom"],
sexe= request.POST["sexe"],
date_de_naissance= request.POST["date_de_naissance"],
CIN = request.POST['CIN'],
telephone =request.POST["telephone"],
email = request.POST["email"],
adresse_actuelle = request.POST["adresse_actuelle"],
adresse_permanente = request.POST["adresse_permanente"],
diplome_obtenu = request.POST["diplome_obtenu"],
qualification = request.POST["qualification"],
grade = Grades.objects.get(id=request.POST["grade"]),
date_de_recrutement = request.POST["date_de_recrutement"],
service = Services.objects.get(id=request.POST["service"]),
create_date = date.today(),
updateDate = date.today(),)
return render(request,'employees/employees.html',
{
"emp_name": emp_name,
"listEmp":listEmp,
"listeService":listeService,
"listeGrade":listeGrade,
}
)
I am using django framework. I embed the youtube video link in html, I want to know that the user spend how much time on the video and save the time in database with his deatils.
the details of the user is stored in cookies. like email.
here is my code.
<div id="request" class="modal fade" {% if request.session.email %} data-backdrop="static" {% endif %} role="dialog">
{% if 'email' not in request.session %}
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<span class="close" data-dismiss="modal" aria-label="Close">×</span>
<h2 class="modal-title">Get start</h2>
</div>
<div class="modal-body text-center">
<form class="form-request" action="" method="post">
{% csrf_token %}
<div class="row-fields row">
<div class="form-group col-field">
<input type="text" class="form-control" name="name" required placeholder="Name *" id="name">
</div>
<div class="form-group col-field">
<input type="email" class="form-control" name="email" required placeholder="Email *" id="email">
</div>
<div class="form-group col-field">
<input type="number" class="form-control" name="phone" required placeholder="Phone *" id="phone">
</div>
<div class="col-sm-12 buttons">
<button type="submit" class="bttn-hover color-1" data-text-hover="Submit">Send request</button>
</div>
</div>
</form>
</div>
</div>
</div>
{% elif request.session.email %} {% comment %} <a href="http://www.youtube.com/watch?v=ANwf8AE3_d0"> {% endcomment %}
<iframe class="embed-responsive-item set-style-of-iframe" src="https://www.youtube.com/embed/tgbNymZ7vqY/?autoplay=1;enablejsapi=1"
allowfullscreen style="height:50%; width:65%" id="myvideo-iframe"></iframe>
<button class="btn btn-close button-closing-style" aria-label="Close" onclick="my_video_pause();"
class="close" data-dismiss="modal">close</button>
<a href="http://cdn.onlinewebfonts.com/svg/img_414950.png" class="button-closing-style" onclick="my_video_pause();" data-dismiss="modal">
</a>
{% endif %}
</div>
</div>
I have a table with filters, and i want to download the rows as csv, filtered.
My function to get filters from form:
public function getFilters($request)
{
$filters = [
'stato' => $request->get('stato'),
'cliente' => $request->get('cliente'),
'registrar' => $request->get('registrar'),
'creazione_inizio' => $request->get('creazione_inizio'),
'creazione_fine' => $request->get('creazione_fine'),
'scadenza_inizio' => $request->get('scadenza_inizio'),
'scadenza_fine' => $request->get('scadenza_fine'),
'scadenza_pagamento_inizio' => $request->get('scadenza_pagamento_inizio'),
'scadenza_pagamento_fine' => $request->get('scadenza_pagamento_fine'),
];
return $filters;
}
On the page where the table is i have this code and it works fine:
/**
* #Route("/dashboard", name="dashboard")
*/
public function dashboard(Request $request, PaginatorInterface $paginator): Response
{
$filters = $this->getFilters($request);
}
But on the route to export csv i have this and $filters is always null:
/**
* #Route("/report/report.csv", name="domains_data_csv")
*/
public function exportDomainsDataCsvAction(Request $request)
{
$filters = $this->getFilters($request);
}
I have the filters form and the button to download csv on the dashboard page.
Any tips to make it work?
EDIT
My dashboard page is made like this:
<div class="mb-2">
<span class="h2">Dashboard</span>
</div>
<div class="mb-3">
{{ include('Admin/includes/_search.html.twig') }}
</div>
{{ include('Admin/includes/_filter.html.twig') }}
{% if domains %}
<div class="col-auto">
Scarica CSV
</div>
{{ include('Admin/includes/_domains_table.html.twig',{ 'domains':domains }) }}
{% if is_granted('ROLE_ADMIN') %}
<a class="btn btn-primary" aria-current="page" href="{{path('new_domain')}}" role="button">Nuovo dominio</a>
{% endif %}
{% else %}
{% endif %}
Filters form:
<div class="card">
<div class="row align-items-center">
<a class="text-decoration-none text-reset" id="filter-header" href="#collapseExample" data-bs-toggle="collapse" aria-expanded="false">
<div class="card-header d-flex align-items-center">
<h5 class="pe-3">Filtri</h5>
<div class="border-1 bg-success border border-success w-100" style="opacity:unset;"></div>
<i class="bi bi-chevron-right ps-3 fs-3 text-success arrow"></i>
</div>
</a>
</div>
<div class="collapse" id="collapseExample">
<div class="card-body">
<form id="form-filter-status" method="GET">
{% if is_granted('ROLE_ADMIN') %}
<div class="row mb-3 justify-content-center">
<div class="card col-sm-3 mx-3">
<div class="card-body">
<div class="card-title">Stato:</div>
<div class="col-sm">
<select name="stato" class="form-select" onchange='this.form.submit();'>
<option value="" {% if filters.stato is empty %} selected {% endif %}>Seleziona...</option>
<option value="1" {% if filters.stato == 1 %} selected {% endif %}>Attivo</option>
<option value="2" {% if filters.stato == 2 %} selected {% endif %}>Richiesta Dismissione</option>
<option value="3" {% if filters.stato == 3 %} selected {% endif %}>Dismesso</option>
<option value="4" {% if filters.stato == 4 %} selected {% endif %}>Richiesto Trasferimento</option>
<option value="5" {% if filters.stato == 5 %} selected {% endif %}>Trasferito</option>
</select>
</div>
</div>
</div>
<div class="card col-sm-3 mx-3">
<div class="card-body">
<div class="card-title">Cliente:</div>
<div class="col-sm">
<select name="cliente" class="form-select" onchange='this.form.submit();'>
<option value="" {% if filters.cliente is empty %} selected {% endif %}>Seleziona...</option>
<option value="1" {% if filters.cliente == 1 %} selected {% endif %}>KINETIKON s.r.l.</option>
<option value="2" {% if filters.cliente == 2 %} selected {% endif %}>CINQUEBIT s.r.l.</option>
<option value="3" {% if filters.cliente == 3 %} selected {% endif %}>JAKALA S.p.A.</option>
<option value="4" {% if filters.cliente == 4 %} selected {% endif %}>IN.SI. s.r.l.</option>
<option value="5" {% if filters.cliente == 5 %} selected {% endif %}>PAGNOSSIN s.r.l.</option>
<option value="6" {% if filters.cliente == 6 %} selected {% endif %}>ELEPHASE s.r.l.</option>
</select>
</div>
</div>
</div>
<div class="card col-sm-3 mx-3">
<div class="card-body">
<div class="card-title">Register:</div>
<div class="col-sm">
<select name="registrar" class="form-select" onchange='this.form.submit();'>
<option value="" {% if filters.registrar is empty %} selected {% endif %}>Seleziona...</option>
<option value="1" {% if filters.registrar == 1 %} selected {% endif %}>Register</option>
<option value="2" {% if filters.registrar == 2 %} selected {% endif %}>OpenProvider</option>
<option value="3" {% if filters.registrar == 3 %} selected {% endif %}>TowerTech</option>
<option value="4" {% if filters.registrar == 4 %} selected {% endif %}>Aruba</option>
<option value="5" {% if filters.registrar == 5 %} selected {% endif %}>Aruba Business</option>
</select>
</div>
</div>
</div>
</div>
{% endif %}
<div class="row justify-content-center">
<div class="card col-sm-3 mx-3">
<div class="card-body">
<div class="card-title">Creazione</div>
<div class="input-group mb-3">
<span class="input-group-text col-2" id="creazione_inizio">Da:</span>
<input type="date" name="creazione_inizio" class="form-control" value="{{filters.creazione_inizio}}" placeholder="Creazione inizio" aria-label="Creazione inizio" aria-describedby="creazione_inizio">
</div>
<div class="input-group mb-3">
<span class="input-group-text col-2" id="creazione_fine">A:</span>
<input type="date" name="creazione_fine" class="form-control" value="{{filters.creazione_fine}}" placeholder="Creazione fine" aria-label="Creazione fine" aria-describedby="creazione_fine">
</div>
<div class="d-grid gap-2">
<button class="btn btn-outline-success" type="submit">Filtra data creazione</button>
</div>
</div>
</div>
<div class="card col-sm-3 mx-3">
<div class="card-body">
<div class="card-title">Scadenza</div>
<div class="input-group mb-3">
<span class="input-group-text col-2" id="scadenza_inizio">Da:</span>
<input type="date" name="scadenza_inizio" class="form-control" value="{{filters.scadenza_inizio}}" placeholder="Scadenza inizio" aria-label="Scadenza inizio" aria-describedby="scadenza_inizio">
</div>
<div class="input-group mb-3">
<span class="input-group-text col-2" id="scadenza_fine">A:</span>
<input type="date" name="scadenza_fine" class="form-control" value="{{filters.scadenza_fine}}" placeholder="Scadenza fine" aria-label="Scadenza fine" aria-describedby="scadenza_fine">
</div>
<div class="d-grid gap-2">
<button class="btn btn-outline-success" type="submit">Filtra data scadenza</button>
</div>
</div>
</div>
<div class="card col-sm-3 mx-3">
<div class="card-body">
<div class="card-title">Scadenza pagamento</div>
<div class="input-group mb-3">
<span class="input-group-text col-2" id="scadenza_pagamento_inizio">Da:</span>
<input type="date" name="scadenza_pagamento_inizio" class="form-control" value="{{filters.scadenza_pagamento_inizio}}" placeholder="Scadenza pagamento inizio" aria-label="Scadenza pagamento inizio" aria-describedby="scadenza_pagamento_inizio">
</div>
<div class="input-group mb-3">
<span class="input-group-text col-2" id="scadenza_pagamento_fine">Da:</span>
<input type="date" name="scadenza_pagamento_fine" class="form-control" value="{{filters.scadenza_pagamento_fine}}" placeholder="Scadenza pagamento fine" aria-label="Scadenza pagamento fine" aria-describedby="scadenza_pagamento_fine">
</div>
<div class="d-grid gap-2">
<button class="btn btn-outline-success" type="submit">Filtra data scadenza pagamento</button>
</div>
</div>
</div>
</div>
{% if query is defined %}
<input type="hidden" name="query" value="{{query}}">
{% endif %}
</form>
</div>
</div>
To pass the current GET parameters (from URL, not form) You should be able to modify the href as follows:
Scarica CSV
To use the current form values you need to use JavaScript to set the form's action attribute value to that returned by {{ path('domains_data_csv') }} and submit the form.
This html form is not submitting data and i don't know why.I have tried to find the error and i do not seem to get around it,any help will be gladly appreciated
{% extends 'registration/base.html' %}
{% load widget_tweaks %}
{% block title %}Create account{% endblock %}
{% block body %}
<div class="container" style="padding-top:20px">
<div class="row">
<div class="col-md-4 card jumbotron ">
<h2><span class="badge badge-light">Create Account</span></h2><br>
<form action="{% url 'tzuzz:create_account' %}" method="post">
{% csrf_token %}
<div class="form-group">
<label>Email </label>
<input class="form-control is-valid" type="text" name="email" placeholder="Email">
<label>Names</label>
<input class="form-control is-valid" type="text" name="names" placeholder="Enter first and last name">
<label>Sex</label>
<select class="form-control" name="sex">
<option>Male</option>
<option>Female</option>
</select>
<label>Date of birth</label>
<input class="form-control is-valid" name="date" type="date">
<label>Password</label>
<input class="form-control is-valid" type="password" name="password" placeholder="Password">
</div>
<button class="btn btn-secondary">Login</button>
</form>
<br><br>
{% if error %}
<p class="alert alert-danger alert-dismissible fade show" role="alert">
{{error}}
<button type="button" class="close" data-dismiss="alert" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</p>
{% endif %}
</div>
</div>
{% endblock %}
Here is the answer i forgot to include type submit in my button
<button class="btn btn-secondary" type="submit">Login</button>
I am using textfields, radiobuttons, textarea etc in my form. The textfield size is very small and looks very bad:
How can I make slightly larger? How the height of text area is smaller than that of gender field?
Code is:
<div class='form-group'>
<label class='control-label col-md-2 col-md-offset-2' for='id_name'>Name</label>
<div class='col-md-6'>
{% render_field form.name class="form-control" placeholder="Full Name" type="text" %}
{% if form.name.errors %}
<div class="alert alert-danger tpad">
{{ form.name.errors.as_text }}
</div>
{% endif %}
</div>
</div>
<!-- name ends here -->
{# Gender goes here #}
<div class='form-group'>
<label class='control-label col-md-2 col-md-offset-2' for='id_name'>Gender</label>
<div class='col-md-6'>
{% for radio in form.gender %}
{{ radio }}
{% endfor %}
{{form.gender.errors}}
</div>
</div>
<!-- enroll ment number -->
<div class='form-group'>
<label class='control-label col-md-2 col-md-offset-2' for='id_enrollment_number'>Enrollment Number</label>
<div class='col-md-6'>
{% render_field form.enrollment_no class='form-control' placeholder='Enrollment Number' type='text' %}
{% if form.enrollment_no.errors %}
<div class="alert alert-danger tpad">
{{ form.enrollment_no.errors.as_text }}
</div>
{% endif %}
</div>
</div>
<div class='form-group'>
<label class='control-label col-md-2 col-md-offset-2' for='id_faculty_name'>Faculty Name</label>
<div class='col-md-6'>
{% render_field form.faculty_name class='form-control' rows="1" cols="1" placeholder='Faculty Name' type='text' %}
{% if form.faculty_name.errors %}
<div class="alert alert-danger tpad">
{{ form.faculty_name.errors.as_text }}
</div>
{% endif %}
</div>
</div>
The code generated is:
<div class='form-group'>
<label class='control-label col-md-2 col-md-offset-2' for='id_name'>Name</label>
<div class='col-md-6'>
<input class="form-control" id="id_name" maxlength="200" name="name" placeholder="Full Name" type="text" />
</div>
</div>
<!-- name ends here -->
<div class='form-group'>
<label class='control-label col-md-2 col-md-offset-2' for='id_name'>Gender</label>
<div class='col-md-6'>
<select id="id_gender" name="gender">
<option value="Male">Male</option>
<option value="Female">Female</option>
</select>
</div>
</div>
Solution: The text size rendered by bootstrap was 20px. I changed it manually to 40px, here:
.uneditable-input{display:inline-block;height:40px;padding:4px 6px;margin-bottom:10px;font-size:14px;line-height:20px;color:#555;vertical-align:middle;-webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px}input,textarea,
Since your code generate an id for the name input, adding (or update) this rule in your CSS would do the trick
#id_name {
height: 30px; /* where you give it same height as your select */
}
Another way, more generic for your form elements (input text and select), could be like this
form-control select,
form-control input[type=text] {
height: 30px;
}
I think you should resize the box like: cols or you should make it as a textarea.
For example that part of the box:
{% render_field form.name class="form-control" cols="1" placeholder="Full Name" type="text" %}