From c8eb8e2e1df6a61a108ae1c63e6487d55d14b905 Mon Sep 17 00:00:00 2001 From: Eduardo Edson Batista Cordeiro Alves Date: Mon, 27 Jun 2016 15:50:43 -0300 Subject: [PATCH] =?UTF-8?q?Substitui=20model=20servi=C3=A7o=20pelo=20TipoS?= =?UTF-8?q?ervi=C3=A7o=20j=C3=A1=20existente=20no=20sigi?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sigi/apps/solicitacoes/forms.py | 9 +------ .../migrations/0005_auto_20160627_1349.py | 24 +++++++++++++++++++ sigi/apps/solicitacoes/models.py | 19 ++------------- sigi/apps/solicitacoes/urls.py | 3 +-- sigi/apps/solicitacoes/views.py | 18 ++------------ templates/base.html | 1 - 6 files changed, 30 insertions(+), 44 deletions(-) create mode 100644 sigi/apps/solicitacoes/migrations/0005_auto_20160627_1349.py diff --git a/sigi/apps/solicitacoes/forms.py b/sigi/apps/solicitacoes/forms.py index b2f1d0c..0511c47 100644 --- a/sigi/apps/solicitacoes/forms.py +++ b/sigi/apps/solicitacoes/forms.py @@ -3,7 +3,7 @@ from django.db import transaction from django import forms from django.forms import ModelForm from sigi.settings.prod import OSTICKET_API_KEY, OSTICKET_URL -from .models import Sistema, Solicitacao +from .models import Solicitacao import json import requests @@ -67,10 +67,3 @@ class SolicitacaoEditForm(ModelForm): u'casa_legislativa', u'titulo', u'resumo'] widgets = {u'codigo': forms.TextInput(attrs={u'readonly': u'readonly'}), u'usuario': forms.HiddenInput()} - - -class SistemaForm(ModelForm): - - class Meta(object): - model = Sistema - fields = [u'sigla', u'nome'] diff --git a/sigi/apps/solicitacoes/migrations/0005_auto_20160627_1349.py b/sigi/apps/solicitacoes/migrations/0005_auto_20160627_1349.py new file mode 100644 index 0000000..dc09b9f --- /dev/null +++ b/sigi/apps/solicitacoes/migrations/0005_auto_20160627_1349.py @@ -0,0 +1,24 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.9.6 on 2016-06-27 13:49 +from __future__ import unicode_literals + +from django.db import migrations, models +import django.db.models.deletion + + +class Migration(migrations.Migration): + + dependencies = [ + ('solicitacoes', '0004_solicitacao_osticket'), + ] + + operations = [ + migrations.AlterField( + model_name='solicitacao', + name='sistema', + field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='servicos.TipoServico'), + ), + migrations.DeleteModel( + name='Sistema', + ), + ] diff --git a/sigi/apps/solicitacoes/models.py b/sigi/apps/solicitacoes/models.py index cacff14..534e618 100644 --- a/sigi/apps/solicitacoes/models.py +++ b/sigi/apps/solicitacoes/models.py @@ -4,28 +4,13 @@ from django.db import models from django.utils.translation import ugettext_lazy as _ from sigi.apps.usuarios.models import Usuario - - -class Sistema(models.Model): - sigla = models.CharField(verbose_name=_(u'Sigla'), max_length=10) - nome = models.CharField(verbose_name=_(u'Nome Sistema'), - max_length=100) - descricao = models.TextField(null=True, - blank=True, - verbose_name=_(u'Descrição')) - - class Meta(object): - verbose_name = _(u'Sistema') - verbose_name_plural = _(u'Sistemas') - - def __str__(self): - return u"%s - %s" % (self.sigla, self.nome) +from sigi.apps.servicos.models import TipoServico class Solicitacao(models.Model): codigo = models.PositiveIntegerField(unique=True) usuario = models.ForeignKey(Usuario) - sistema = models.ForeignKey(Sistema) + sistema = models.ForeignKey(TipoServico) titulo = models.CharField(verbose_name=_(u'Título'), max_length=100) resumo = models.CharField(verbose_name=_(u'Resumo'), max_length=50) casa_legislativa = models.CharField(verbose_name=_(u'Casa Legislativa'), diff --git a/sigi/apps/solicitacoes/urls.py b/sigi/apps/solicitacoes/urls.py index 37c6f6f..910d397 100644 --- a/sigi/apps/solicitacoes/urls.py +++ b/sigi/apps/solicitacoes/urls.py @@ -1,14 +1,13 @@ from __future__ import absolute_import from django.conf.urls import include, url -from sigi.apps.solicitacoes.views import SistemaCrud, SolicitacaoCrud +from sigi.apps.solicitacoes.views import SolicitacaoCrud from .apps import AppConfig app_name = AppConfig.name urlpatterns = [ - url(ur'home/atendimento/sistema/', include(SistemaCrud.get_urls())), url(ur'home/atendimento/solicitacao/', include(SolicitacaoCrud.get_urls())), ] diff --git a/sigi/apps/solicitacoes/views.py b/sigi/apps/solicitacoes/views.py index 5999cc2..59a95e4 100644 --- a/sigi/apps/solicitacoes/views.py +++ b/sigi/apps/solicitacoes/views.py @@ -8,8 +8,8 @@ import sigi.apps.crud.base from sigi.apps.crud.base import Crud, CrudCreateView, CrudListView, CrudCreateView, CrudUpdateView, CrudBaseMixin from sigi.apps.usuarios.models import Usuario -from .forms import SistemaForm, SolicitacaoEditForm, SolicitacaoForm -from .models import Sistema, Solicitacao +from .forms import SolicitacaoEditForm, SolicitacaoForm +from .models import Solicitacao class SolicitacaoCrud(LoginRequiredMixin, Crud): @@ -48,17 +48,3 @@ class SolicitacaoCrud(LoginRequiredMixin, Crud): class BaseMixin(CrudBaseMixin): list_field_names = [u'osticket', u'sistema', u'titulo', u'data_criacao'] - - -class SistemaCrud(Crud): - model = Sistema - help_path = u'' - - class CreateView(LoginRequiredMixin, CrudCreateView): - form_class = SistemaForm - - class UpdateView(LoginRequiredMixin, CrudUpdateView): - form_class = SistemaForm - - class ListView(LoginRequiredMixin, CrudListView): - pass diff --git a/templates/base.html b/templates/base.html index adb5dcf..a78a3df 100644 --- a/templates/base.html +++ b/templates/base.html @@ -37,7 +37,6 @@