Wednesday, October 30, 2019

django-extra-views

Good afternoon friends!

I need your help on this issue.

I'm trying to use this lib:


Specifically CreateWithInlinesView or UpdateWithInlinesView

Then I created the view like this:

    from extra_views import CreateWithInlinesView, InlineFormSetFactory

    class FilesDocumentsInline (InlineFormSetFactory):
      model = FilesDocuments
      fields = ['id', 'kynd', 'file_document']


    class ContactInline (InlineFormSetFactory):
      model = Contact
      fields = ['kynd', 'description', 'contact']


    class CreatePerson (CreateWithInlinesView):
      model = Person
      inlines = [ContactInline, FilesDocumentsInline]
      fields = ['name', 'phone', 'cpf_cnpj', 'email', 'birth', 'rg', 'cep', 'backyard', 'number', 'neighborhood',
            'city State']
  template_name = 'person_create_contact.html'

   I'm calling in the url like this:

    
    path ('nova /', views.CreatePerson, name = 'CreatePerson'),




And the terminal is returning an argument error.

    response = wrapped_callback (request, * callback_args, ** callback_kwargs)
    TypeError: __init __ () takes 1 positional argument but 2 were given

How can you? This is virtually identical to the example!

I will post this same text in some forums to try to solve too.

What am I doing wrong in this example?

--
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 django-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/f7cd09d7-201e-4874-a296-c996569c7b45%40googlegroups.com.

No comments:

Post a Comment