xadmin icon indicating copy to clipboard operation
xadmin copied to clipboard

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

Open LuizMegaZord opened this issue 10 years ago • 11 comments

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

LuizMegaZord avatar May 05 '14 03:05 LuizMegaZord

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

sshwsfc avatar May 16 '14 02:05 sshwsfc

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][email protected] [image: Skype]ikeluiz

On Thu, May 15, 2014 at 11:55 PM, 差沙 [email protected] 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 avatar May 16 '14 03:05 LuizMegaZord

on_add_ajax_error ajax_error_server_error

LuizMegaZord avatar May 16 '14 13:05 LuizMegaZord

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

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

On Fri, May 16, 2014 at 12:16 AM, Luiz Henrique Vieira [email protected]:

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][email protected] [image: Skype]ikeluiz

On Thu, May 15, 2014 at 11:55 PM, 差沙 [email protected] 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 avatar May 17 '14 05:05 LuizMegaZord

In this demo online have the same error. Look error_on_default_demo

LuizMegaZord avatar May 21 '14 07:05 LuizMegaZord

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

sshwsfc avatar May 21 '14 07:05 sshwsfc

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 avatar May 21 '14 07:05 LuizMegaZord

Some feed back when this bug is fix???

LuizMegaZord avatar Jul 10 '14 09:07 LuizMegaZord

Was this ever fixed?

Alonitor avatar Apr 22 '18 19:04 Alonitor

Some feed back when this bug is fix???

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

546133753 avatar Oct 31 '19 01:10 546133753

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

alexsilva avatar Oct 31 '19 13:10 alexsilva