django-extra-views

28 views
Skip to first unread message

Elias Coutinho

unread,
Oct 30, 2019, 1:25:00 PM10/30/19
to Django users
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?

Elias Coutinho

unread,
Oct 30, 2019, 8:36:36 PM10/30/19
to django...@googlegroups.com
Sorted out!
path('nova/', views.CreatePerson.as_view(), name='CreatePerson'),

--
You received this message because you are subscribed to a topic in the Google Groups "Django users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/django-users/m7cXAuwS4bQ/unsubscribe.
To unsubscribe from this group and all its topics, send an email to django-users...@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.


--
Elias Coutinho.
Aprender sobre alguns assuntos é fundamental.
Aprender sobre Deus é indiscutivelmente o melhor conteúdo.
Reply all
Reply to author
Forward
0 new messages