|
|
@ -3,11 +3,9 @@ from django.contrib import admin |
|
|
|
|
|
|
|
from sapl.base.models import TipoAutor |
|
|
|
from sapl.comissoes.models import TipoComissao |
|
|
|
from sapl.materia.models import Proposicao, TipoMateriaLegislativa |
|
|
|
from sapl.norma.models import TipoNormaJuridica, TipoVinculoNormaJuridica |
|
|
|
from sapl.parlamentares.models import TipoAfastamento, SituacaoMilitar, TipoDependente |
|
|
|
from sapl.protocoloadm.models import TipoDocumentoAdministrativo |
|
|
|
from sapl.sessao.models import TipoSessaoPlenaria, TipoExpediente, TipoResultadoVotacao |
|
|
|
from sapl.materia.models import Proposicao |
|
|
|
from sapl.parlamentares.models import TipoAfastamento, SituacaoMilitar, \ |
|
|
|
TipoDependente |
|
|
|
from sapl.utils import register_all_models_in_admin |
|
|
|
|
|
|
|
|
|
|
@ -15,13 +13,6 @@ register_all_models_in_admin(__name__) |
|
|
|
|
|
|
|
if not settings.DEBUG: |
|
|
|
|
|
|
|
admin.site.unregister(Proposicao) |
|
|
|
admin.site.unregister(TipoAutor) |
|
|
|
admin.site.unregister(TipoComissao) |
|
|
|
admin.site.unregister(TipoAfastamento) |
|
|
|
admin.site.unregister(SituacaoMilitar) |
|
|
|
admin.site.unregister(TipoDependente) |
|
|
|
|
|
|
|
class RestricaoAdmin(admin.ModelAdmin): |
|
|
|
|
|
|
|
def has_add_permission(self, request, obj=None): |
|
|
@ -33,9 +24,16 @@ if not settings.DEBUG: |
|
|
|
def has_delete_permission(self, request, obj=None): |
|
|
|
return False |
|
|
|
|
|
|
|
admin.site.register(Proposicao, RestricaoAdmin) |
|
|
|
admin.site.register(TipoAutor, RestricaoAdmin) |
|
|
|
admin.site.register(TipoComissao, RestricaoAdmin) |
|
|
|
admin.site.register(TipoAfastamento, RestricaoAdmin) |
|
|
|
admin.site.register(SituacaoMilitar, RestricaoAdmin) |
|
|
|
admin.site.register(TipoDependente, RestricaoAdmin) |
|
|
|
models = ( |
|
|
|
Proposicao, |
|
|
|
TipoAutor, |
|
|
|
TipoComissao, |
|
|
|
TipoAfastamento, |
|
|
|
SituacaoMilitar, |
|
|
|
TipoDependente |
|
|
|
) |
|
|
|
|
|
|
|
for model in models: |
|
|
|
if admin.site.is_registered(model): |
|
|
|
admin.site.unregister(model) |
|
|
|
admin.site.register(model, RestricaoAdmin) |
|
|
|