Novo visual do forms introduzido.

parent 9d742fc6
# -*- coding: utf-8 -*-
from django import forms
from django.forms import DateField
from Diarioapp.models.aluno import Aluno
from base import settings
class AlunoForm(forms.ModelForm):
data_nascimento = DateField(input_formats=settings.DATE_INPUT_FORMATS)
data_nascimento = forms.DateField(input_formats=settings.DATE_INPUT_FORMATS, label='Data de Nascimento')
# data_nascimento =forms.DateField(widget=forms.DateInput())
class Meta:
......
......@@ -8,18 +8,18 @@ from base import settings
class Aluno(models.Model):
nome = models.CharField(max_length=60)
data_nascimento = models.DateField()
rg = models.CharField(max_length=20, blank=True)
nome = models.CharField(max_length=60, verbose_name='Nome')
data_nascimento = models.DateField(verbose_name='Data de Nascimento')
rg = models.CharField(max_length=20, blank=True, verbose_name='RG')
#responsavel = models.ManyToManyField(blank=True)
#responsavel = models.CharField(max_length=60, blank=True)
nome_responsavel = models.CharField(max_length=60)
telefone_responsavel = models.CharField(max_length=11)
email_responsavel = models.CharField(max_length=120, blank=True)
endereco_responsavel = models.CharField(max_length=150)
rg_responsavel = models.CharField(max_length=20)
cpf_responsavel = models.CharField(max_length=11)
ativo = models.BooleanField(default=True)
nome_responsavel = models.CharField(max_length=60, verbose_name='Nome do Responsável')
telefone_responsavel = models.CharField(max_length=11, verbose_name='Telefone do Responsável')
email_responsavel = models.CharField(max_length=120, blank=True, verbose_name='E-mail do Responsável')
endereco_responsavel = models.CharField(max_length=150, verbose_name='Endereço')
rg_responsavel = models.CharField(max_length=20, verbose_name='RG do Responsável')
cpf_responsavel = models.CharField(max_length=11, verbose_name='CPF do Responsável')
ativo = models.BooleanField(default=True, verbose_name='Ativo')
def __unicode__(self):
return '%s' %(self.nome)
......
{% extends 'base.html' %}
{% load staticfiles %}
{% block body_block %}
<article>
<article id='conteudo'>
<h2 class='ui header row'>
<i class="asterisk icon"></i>
<div class="content">
Cadastro de Aluno
<div class='sub header'>Prencha os campos abaixo.</div>
</div>
</h2>
{{ mensagem }}
{% if form.instance.id %}
<form action="{% url 'edit-aluno' form.instance.id %}" method="post">
<form class="ui fifteen wide column form row" action="{% url 'edit-aluno' form.instance.id %}"
method="post">
{% else %}
<form action="{% url 'cad-aluno' %}" method="post">
<form class="ui form" action="{% url 'cad-aluno' %}" method="post">
{% endif %}
{% csrf_token %}
{{ form.as_p }}
<button type="submit">Salvar</button>
{% for hidden in form.hidden_fields %}
{{ hidden }}
{% endfor %}
<div class="ui segment">
<h3 class="ui dividing header">
Dados do Aluno
</h3>
<div class="three fields">
<div class="field">
<label>{{ form.nome.label }}:</label>
<div>{{ form.nome }}</div>
{% if form.nome.help_text %}
<span class="ui pointing label">Ajuda: {{ form.nome.help_text }}</span>{% endif %}<br>
{% if form.nome.errors %}
<span class="ui pointing red label">
{{ form.nome.errors }}
</span>
{% endif %}
</div>
<div class="field">
<label>{{ form.rg.label }}:</label>
<div>{{ form.rg }}</div>
{% if form.rg.help_text %}
<span class="ui pointing label">Ajuda: {{ form.rg.help_text }}</span>{% endif %}<br>
{% if form.rg.errors %}
<span class="ui pointing red label">
{{ form.rg.errors }}
</span>
{% endif %}
</div>
<div class="field">
<label>{{ form.data_nascimento.label }}:</label>
<div>{{ form.data_nascimento }}</div>
{% if form.data_nascimento.help_text %}
<span class="ui pointing label">Ajuda: {{ form.data_nascimento.help_text }}</span>{% endif %}
<br>
{% if form.data_nascimento.errors %}
<span class="ui pointing red label">
{{ form.data_nascimento.errors }}
</span>
{% endif %}
</div>
</div>
</div>
<div class="ui segment">
<h3 class="ui dividing header">
Dados do Responsável
</h3>
<div class="three fields">
<div class="field">
<label>{{ form.nome_responsavel.label }}:</label>
<div>{{ form.nome_responsavel }}</div>
{% if form.nome_responsavel.help_text %}
<span class="ui pointing label">Ajuda: {{ form.nome_responsavel.help_text }}</span>{% endif %}
<br>
{% if form.nome_responsavel.errors %}
<span class="ui pointing red label">
{{ form.nome_responsavel.errors }}
</span>
{% endif %}
</div>
<div class="field">
<label>{{ form.rg_responsavel.label }}:</label>
<div>{{ form.rg_responsavel }}</div>
{% if form.rg_responsavel.help_text %}
<span class="ui pointing label">Ajuda: {{ form.rg_responsavel.help_text }}</span>{% endif %}<br>
{% if form.rg_responsavel.errors %}
<span class="ui pointing red label">
{{ form.rg_responsavel.errors }}
</span>
{% endif %}
</div>
<div class="field">
<label>{{ form.cpf_responsavel.label }}:</label>
<div>{{ form.cpf_responsavel }}</div>
{% if form.cpf_responsavel.help_text %}
<span class="ui pointing label">Ajuda: {{ form.cpf_responsavel.help_text }}</span>{% endif %}
<br>
{% if form.cpf_responsavel.errors %}
<span class="ui pointing red label">
{{ form.cpf_responsavel.errors }}
</span>
{% endif %}
</div>
</div>
{# fhdjisafiul#}
<div class="three fields">
<div class="field">
<label>{{ form.telefone_responsavel.label }}:</label>
<div>{{ form.telefone_responsavel }}</div>
{% if form.telefone_responsavel.help_text %}
<span class="ui pointing label">Ajuda: {{ form.telefone_responsavel.help_text }}</span>{% endif %}
<br>
{% if form.telefone_responsavel.errors %}
<span class="ui pointing red label">
{{ form.telefone_responsavel.errors }}
</span>
{% endif %}
</div>
<div class="field">
<label>{{ form.email_responsavel.label }}:</label>
<div>{{ form.email_responsavel }}</div>
{% if form.email_responsavel.help_text %}
<span class="ui pointing label">Ajuda: {{ form.email_responsavel.help_text }}</span>{% endif %}
<br>
{% if form.email_responsavel.errors %}
<span class="ui pointing red label">
{{ form.email_responsavel.errors }}
</span>
{% endif %}
</div>
<div class="field">
<label>{{ form.endereco_responsavel.label }}:</label>
<div>{{ form.endereco_responsavel }}</div>
{% if form.endereco_responsavel.help_text %}
<span class="ui pointing label">Ajuda: {{ form.endereco_responsavel.help_text }}</span>{% endif %}
<br>
{% if form.endereco_responsavel.errors %}
<span class="ui pointing red label">
{{ form.endereco_responsavel.errors }}
</span>
{% endif %}
</div>
</div>
<div class="field">
<label>{{ form.ativo.label }}:</label>
<div>{{ form.ativo }}</div>
{% if form.ativo.help_text %}
<span class="ui pointing label">Ajuda: {{ form.ativo.help_text }}</span>{% endif %}
<br>
{% if form.ativo.errors %}
<span class="ui pointing red label">
{{ form.ativo.errors }}
</span>
{% endif %}
</div>
</div>
<div class="ui two buttons">
<button onclick="location.href ='{% url 'alunos' %}'" class="ui button">
Cancelar
</button>
<button class="ui fluid teal button" type="submit">Salvar</button>
</div>
</form>
</article>
<script type="text/javascript">
$('[type=checkbox]').addClass("ui toggle checkbox").checkbox('attach events', '.toggle.button');
</script>
{% endblock body_block %}
\ No newline at end of file
......@@ -15,7 +15,6 @@
<script type="text/javascript" src="{% static 'javascript/base.js' %}"></script>
<link rel="stylesheet" href="{% static 'javascript/bootstrap-datepicker.js' %}">
<link rel="stylesheet" href="{% static 'CSS/bootstrap-datepicker.css' %}">
</head>
<body>
{% if user.is_authenticated %}
......
......@@ -6,15 +6,15 @@
<div class="ui four column centered grid">
<div class="ui inverted segment">
<div class="ui inverted form">
Tem certeza que deseja deslogar?
<button onclick="location.href='{% url 'logout' %}?next=/login/'" class="ui teal button">
Confirmar
</button>
<button onclick="location.href ='/perfil/'" class="ui button" >
Cancelar
</button>
<h3 class="ui inverted header">Tem certeza que deseja deslogar?</h3>
<p class="ui two buttons">
<button onclick="location.href ='/perfil/'" class="ui button">
Cancelar
</button>
<button onclick="location.href='{% url 'logout' %}?next=/login/'" class="ui teal button">
Confirmar
</button>
</p>
</div>
</div>
</div>
......
File mode changed from 100755 to 100644
......@@ -10,7 +10,7 @@
{% endif %}
{% csrf_token %}
{{ form.as_p }}
<button type="submit">salvar</button>
<button type="submit">Salvar</button>
</form>
</article>
{% endblock body_block %}
\ No newline at end of file
......@@ -13,12 +13,12 @@ article#login {
padding: 10% 0 13% 0 !important;
}
article#logout{
article#logout {
padding: 19% 0 19.3% 0;
}
article#conteudo{
padding-top: 5%;
padding: 5% !important;
}
footer.ui.secondary.segment.centered.stackable.grid{
......
$(document).ready(function () {
$('.sidebar.menu').sidebar('setting', 'transition', 'overlay').sidebar('attach events', '.item.visibilidade');
$('select').dropdown();
});
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment