mirror of https://github.com/interlegis/sapl.git
LeandroRoberto
8 years ago
14 changed files with 372 additions and 111 deletions
@ -0,0 +1,38 @@ |
|||||
|
# -*- coding: utf-8 -*- |
||||
|
# Generated by Django 1.9.7 on 2016-10-16 03:56 |
||||
|
from __future__ import unicode_literals |
||||
|
|
||||
|
from django.db import migrations, models |
||||
|
import django.db.models.deletion |
||||
|
|
||||
|
|
||||
|
class Migration(migrations.Migration): |
||||
|
|
||||
|
dependencies = [ |
||||
|
('contenttypes', '0002_remove_content_type_name'), |
||||
|
('materia', '0056_merge'), |
||||
|
] |
||||
|
|
||||
|
operations = [ |
||||
|
migrations.RemoveField( |
||||
|
model_name='tipoproposicao', |
||||
|
name='materia_ou_documento', |
||||
|
), |
||||
|
migrations.RemoveField( |
||||
|
model_name='tipoproposicao', |
||||
|
name='modelo', |
||||
|
), |
||||
|
migrations.RemoveField( |
||||
|
model_name='tipoproposicao', |
||||
|
name='tipo_documento', |
||||
|
), |
||||
|
migrations.RemoveField( |
||||
|
model_name='tipoproposicao', |
||||
|
name='tipo_materia', |
||||
|
), |
||||
|
migrations.AddField( |
||||
|
model_name='tipoproposicao', |
||||
|
name='conteudo', |
||||
|
field=models.ForeignKey(default=None, on_delete=django.db.models.deletion.CASCADE, to='contenttypes.ContentType', verbose_name='Conteúdo'), |
||||
|
), |
||||
|
] |
@ -0,0 +1,26 @@ |
|||||
|
# -*- coding: utf-8 -*- |
||||
|
# Generated by Django 1.9.7 on 2016-10-16 05:29 |
||||
|
from __future__ import unicode_literals |
||||
|
|
||||
|
from django.db import migrations, models |
||||
|
import django.db.models.deletion |
||||
|
|
||||
|
|
||||
|
class Migration(migrations.Migration): |
||||
|
|
||||
|
dependencies = [ |
||||
|
('materia', '0057_auto_20161016_0156'), |
||||
|
] |
||||
|
|
||||
|
operations = [ |
||||
|
migrations.AddField( |
||||
|
model_name='tipoproposicao', |
||||
|
name='object_id', |
||||
|
field=models.PositiveIntegerField(blank=True, default=None, null=True), |
||||
|
), |
||||
|
migrations.AlterField( |
||||
|
model_name='tipoproposicao', |
||||
|
name='conteudo', |
||||
|
field=models.ForeignKey(default=None, on_delete=django.db.models.deletion.CASCADE, to='contenttypes.ContentType', verbose_name='Definição de Tipo'), |
||||
|
), |
||||
|
] |
@ -1,6 +0,0 @@ |
|||||
{% extends "base.html" %} |
|
||||
{% load i18n crispy_forms_tags %} |
|
||||
|
|
||||
{% block base_content %} |
|
||||
{% crispy form helper %} |
|
||||
{% endblock %} |
|
@ -0,0 +1,36 @@ |
|||||
|
{% extends "crud/form.html" %} |
||||
|
{% load i18n %} |
||||
|
aaa |
||||
|
{% block extra_js %} |
||||
|
|
||||
|
<script type="text/javascript"> |
||||
|
|
||||
|
$(document).ready(function(){ |
||||
|
var initial_select = $("input[name=tipo_conteudo_related]").val(); |
||||
|
$("input[name=tipo_conteudo_related]").remove(); |
||||
|
$('#id_conteudo').change(function(event) { |
||||
|
var pk = this[event.target.selectedIndex].value; |
||||
|
|
||||
|
var url = '{% url 'sapl.api:model_list' 0 %}' |
||||
|
url = url.replace('0', pk) |
||||
|
|
||||
|
$.get(url).done(function(data) { |
||||
|
var radios = $("#div_id_tipo_conteudo_related_radio .controls").html(''); |
||||
|
data.models.forEach(function (val, index) { |
||||
|
var html_radio = '<label class="radio'+(initial_select==val.value?' checked':'')+'"><span class="icons"><span class="first-icon"></span><span class="second-icon"></span></span><input type="radio" name="tipo_conteudo_related" id="id_tipo_conteudo_related_'+index+'" value="'+val.value+'"'+(initial_select?' checked="checked"':'')+'>'+val.text+'</label>'; |
||||
|
radios.append(html_radio); |
||||
|
}); |
||||
|
initial_select=''; |
||||
|
|
||||
|
|
||||
|
|
||||
|
}); |
||||
|
}); |
||||
|
$('#id_conteudo').trigger('change'); |
||||
|
|
||||
|
}); |
||||
|
|
||||
|
|
||||
|
</script> |
||||
|
|
||||
|
{% endblock %} |
Loading…
Reference in new issue