Good afternoon people,

I'm trying to render a template with django-material
I am getting the error message in the template as below:


And the complete traceback is as follows:


I am submitting below the project template:


from django import forms
from django.forms import ModelForm, Field
from material import Fieldset, Layout, Row, Span6

from danibraz.persons.models import Client, Author, Book, Employee

class ClientsForm(forms.ModelForm):
    name = forms.CharField(label='Nome', required=True)
    birthday = forms.DateField(label='Nascimento', required=False)
    address1 = forms.CharField(label='Endereço completo')
    purchase_limit = forms.DecimalField(label='Limite de compra')
    compra_sempre = forms.BooleanField(label='Compra sempre?', required=False)

    class Meta:
        model = Client
        fields = '__all__'

    layout = Layout(
        Fieldset("Inclua um cliente",
                 Row('name', ),
                 Row('address1', ),
                 Row('compra_sempre', ),


# from django.contrib.auth.models import User
from django.db import models

class Person(models.Model):
    name = models.CharField('Nome',max_length=100)
    birthday = models.DateField('Aniversário')
    address1 = models.CharField('Endereço 1',max_length=100)
    purchase_limit = models.DecimalField('Limite de compra',max_digits=15, 

    class Meta:
        verbose_name_plural = 'pessoas'
        verbose_name = 'pessoa'

    def __str__(self):

class Address(models.Model):
    KINDS = (
        ('P', 'PRINCIPAL'),
        ('C', 'COBRANÇA'),
        ('E', 'ENTREGA'),
    person = models.ForeignKey('Person')
    kynd = models.CharField('Tipo', max_length=1, choices=KINDS)
    public_place = models.CharField('Logradouro',max_length=150)
    number = models.CharField('Número',max_length=150)
    city = models.CharField('Cidade',max_length=150)
    state = models.CharField('Estado',max_length=150)
    zipcode = models.CharField('Cep',max_length=10)
    country = models.CharField('País',max_length=150)
    phone = models.CharField('Fone',max_length=50)

    class Meta:
        verbose_name_plural = 'endereços'
        verbose_name = 'endereço'

    def __str__(self):
        return self.public_place


from django.conf.urls import url, include
from django.views.i18n import JavaScriptCatalog

from danibraz.persons import views
from danibraz.persons.views import clients, employees, NewProfissoesPessoaView, 

urlpatterns = [

    url(r'^jsi18n/$', JavaScriptCatalog.as_view(), name='javascript-catalog'),
    url(r'^i18n/', include('django.conf.urls.i18n')),


class AddressInline(extra_views.InlineFormSet):
    model = Address #Model Address
    # Desnecessário
    #fields = ['kynd', 'public_place', 'number', 'city', 'state', 'zipcode', 
'country', 'phone', 'delete'] #Campos do endereço

    # layout = Layout(
    #     # Campos do Persons
    #     Row('qualificacao', 'campo_novo_um'),
    #     Row('campo_novo_dois', 'campo_novo_tres'),
    # )
    # extra = 3# Define aquantidade de linhas a apresentar.
    can_delete = True

#LoginRequiredMixin faz a mesma função de @login_required(login_url=LOGIN_URL). 
a ndiferença que LoginRequiredMixin não precisa apontar na url
class NewCadastroPessoaView(LayoutMixin,
    title = "Nova Pessoa"

    model = Person# model Person

    layout = Layout(
        # Campos do Persons
        Fieldset("Inclua uma pessoa",
                 Row('name', ),
                 Row('address1', ),
        #Inline dos endereços
        Inline('Endereços', AddressInline,),


    #print('Chegou na linha 340')

    def forms_valid(self, form, inlines):
        self.object =
        #self.object.pessoa_id =
        return super(NewCadastroPessoaView, self).forms_valid(form, inlines)

    def get_success_url(self):
        return self.object.get_absolute_url()

Maybe I'm sinning to know something in this code, can anyone help me?

The code is in the github <>

I have already asked for help on several discussion lists and could not get 
Anyone have a clue about what I'm doing deer?

You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
To post to this group, send email to
Visit this group at
To view this discussion on the web visit
For more options, visit

Reply via email to