Browse Source

Adiciona listagem ao crud mestre detalhe

pull/341/head
Marcio Mazza 9 years ago
committed by LeandroRoberto
parent
commit
11c75da8c4
  1. 3
      crud/masterdetail.py
  2. 4
      parlamentares/forms.py

3
crud/masterdetail.py

@ -70,10 +70,13 @@ class MasterDetailCrud(Crud):
def get_url_regex(cls): def get_url_regex(cls):
return r'^%s/(?P<pk>\d+)/delete$' % cls.model._meta.model_name return r'^%s/(?P<pk>\d+)/delete$' % cls.model._meta.model_name
<<<<<<< c9325f593ff07366e8a4acc20bdfba1f54ce254e
def get_success_url(self): def get_success_url(self):
pk = getattr(self.get_object(), self.crud.parent_field).pk pk = getattr(self.get_object(), self.crud.parent_field).pk
return self.resolve_url(LIST, args=(pk,)) return self.resolve_url(LIST, args=(pk,))
=======
>>>>>>> Adiciona listagem ao crud mestre detalhe
@classonlymethod @classonlymethod
def build(cls, model, parent_field, help_path): def build(cls, model, parent_field, help_path):
crud = super(MasterDetailCrud, cls).build(model, help_path) crud = super(MasterDetailCrud, cls).build(model, help_path)

4
parlamentares/forms.py

@ -12,6 +12,10 @@ from crispy_layout_mixin import form_actions
from .models import Filiacao, Legislatura, Mandato, Parlamentar from .models import Filiacao, Legislatura, Mandato, Parlamentar
class ImageThumbnailFileInput(ClearableFileInput):
template_name = 'floppyforms/image_thumbnail.html'
class ParlamentarForm(ModelForm): class ParlamentarForm(ModelForm):
class Meta: class Meta:

Loading…
Cancel
Save