sshwsfc / xadmin

Drop-in replacement of Django admin comes with lots of goodies, fully extensible with plugin support, pretty UI based on Twitter Bootstrap.
http://www.xadmin.io
BSD 3-Clause "New" or "Revised" License
4.76k stars 1.41k forks source link

Ajax Return Value Error when add new value in ForeignKey or ManyToManyField on inline model - Bug is on demo app to #175

Open LuizMegaZord opened 10 years ago

LuizMegaZord commented 10 years ago

I get ajax error on add value in ForeignKey or ManyToManyField just when add on inline model The value is inserted into the database normally, but the return value ajax get error and field remains blank. if I reload the page the entered value appears. I think the callback function can not find the field because is not in the initial DOM of the page, it is a dynamic inline model field. Perhaps adjusting the Js with a similar event like live, solve this.

Chineses experts please some help!!

Ajax return this error: FieldError at /medicine/diagnostic/add/ Unknown field(s) (diagnostic_set-0-type) specified for Diagnostic Request Method: GET Request URL: http://127.0.0.1:8000/medicine/diagnostic/add/?_field=diagnostic_set-0-type&diagnostic_set-0-type

sshwsfc commented 10 years ago

Hi, are u sure the Model has the type field.

LuizMegaZord commented 10 years ago

Yes, i'm sure.

Look the print screens

my adminx.py: class DiagnosticInline(object): model = Diagnostic extra = 1 style = 'accordion'

class ClinicalAdmin(object): list_display = ('name','sus','cpf','rg','phone','cel','mother_name','father_name',) search_fields=['name','cpf','rg','sus','mother_name','father_name'] list_filter = ('created',) style_fields = {'gender': "radio-inline"} hidden_menu = True inlines = [DiagnosticInline] save_as = True grid_layouts = ('table',) form_layout = ( Main( TabHolder( Tab('Inicio', Row('name', 'born'), Row('gender', 'psychological_treatment_mental_health'),

                Row('phone', 'cel'),
            ),

            Tab('Identificação',
                Row('cpf', 'rg'),
                Row('sus', 'cnpj'),
            ),
            Tab('Localização',
                Row('phone', 'cel'),
                Row('zipcode', 'city'),
                Row('address', 'number'),
                Field('neighborhood'),
            ),
            Tab('Responsáveis',
                Row('mother_name', 'father_name'),
                Row('responsible_name', 'responsible_kinship'),
                Row('responsible_phone', 'responsible_cel'),
                Row('responsible_cpf', 'responsible_rg'),
                Row('responsible_cnpj',

'responsible_sus'),

            )
        )
    )
)

On Thu, May 15, 2014 at 11:55 PM, 差沙 notifications@github.com wrote:

Hi, are u sure the Model has the type field.

— Reply to this email directly or view it on GitHubhttps://github.com/sshwsfc/django-xadmin/issues/175#issuecomment-43290544 .

LuizMegaZord commented 10 years ago

on_add_ajax_error ajax_error_server_error

LuizMegaZord commented 10 years ago

I'm trying to solve this bug, can you tell me what this ajax view points?

And it you could provide a more modern version of the demo equal to the? http://demo.xadmin.io

On Fri, May 16, 2014 at 12:16 AM, Luiz Henrique Vieira ikeluiz@gmail.comwrote:

Yes, i'm sure.

Look the print screens

my adminx.py: class DiagnosticInline(object): model = Diagnostic extra = 1 style = 'accordion'

class ClinicalAdmin(object): list_display = ('name','sus','cpf','rg','phone','cel','mother_name','father_name',) search_fields=['name','cpf','rg','sus','mother_name','father_name'] list_filter = ('created',) style_fields = {'gender': "radio-inline"} hidden_menu = True inlines = [DiagnosticInline] save_as = True grid_layouts = ('table',) form_layout = ( Main( TabHolder( Tab('Inicio', Row('name', 'born'), Row('gender', 'psychological_treatment_mental_health'),

                Row('phone', 'cel'),
            ),

            Tab('Identificação',
                Row('cpf', 'rg'),
                Row('sus', 'cnpj'),
            ),
            Tab('Localização',
                Row('phone', 'cel'),
                Row('zipcode', 'city'),
                Row('address', 'number'),
                Field('neighborhood'),
            ),
            Tab('Responsáveis',
                Row('mother_name', 'father_name'),
                Row('responsible_name', 'responsible_kinship'),
                Row('responsible_phone', 'responsible_cel'),
                Row('responsible_cpf', 'responsible_rg'),
                Row('responsible_cnpj',

'responsible_sus'),

            )
        )
    )
)
  • Atenciosamente, Luiz Henrique Vieira. * Cel: (11) 99350-0350 http://ikeluiz.com [image: Google Talk][image: MSN]ikeluiz@gmail.com [image: Skype]ikeluiz

On Thu, May 15, 2014 at 11:55 PM, 差沙 notifications@github.com wrote:

Hi, are u sure the Model has the type field.

— Reply to this email directly or view it on GitHubhttps://github.com/sshwsfc/django-xadmin/issues/175#issuecomment-43290544 .

LuizMegaZord commented 10 years ago

In this demo online have the same error. Look error_on_default_demo

sshwsfc commented 10 years ago

This is a bug, I will fix it recently. Thx

LuizMegaZord commented 10 years ago

Ok very thanks, i waiting for fix. If you write a best docs, i can help to fix other bugs, some times i debug with grep -rl '' to find some things rs, i waiting a good docs to.

Thanks

LuizMegaZord commented 10 years ago

Some feed back when this bug is fix???

Alonitor commented 6 years ago

Was this ever fixed?

546133753 commented 5 years ago

Some feed back when this bug is fix???

Hi,I also encountered this problem.Do you has fixed it?

alexsilva commented 5 years ago

I partially solved this problem for both inlines and modal (quickform). If you want you can copy or use as a patch. quickform diff