Parent initialization don't working

42 views
Skip to first unread message

RompePC

unread,
Aug 11, 2016, 6:58:20 AM8/11/16
to Django users
I'll say first that I'm using xadmin, although it doesn't matter for this problem.
Python 2.7.3 with Django 1.9.5

The problem is in this piece of code (take it as an example):

class ParentAdmin(object):
   def __init__(self):
     # Boring stuff
     self.list_filter = ["name"]
     # Calling super()

class SonAdmin(ParentAdmin):
    # Boring stuff

If I set up list_filter in SonAdmin, it shows the filter and all goes well. But, if I set up it instead in ParentAdmin, it just doesn't show. And its weird because it works when setting list_display the same way. No errors throwed, and no other part of the code is the problem. I think that Django overrides it in some moment, but that wouldn't make sense. Any ideas?

Constantine Covtushenko

unread,
Aug 11, 2016, 3:26:50 PM8/11/16
to django...@googlegroups.com
Hi Rompe,

As for your admin models it seems like they should extend:
`admin.ModelAdmin`, see django documentation

I am not sure that this is a problem you have encountered.
But to move further please do like said in the documentation firstly.

Regards,


--
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 post to this group, send email to django...@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/e74c0eca-d417-4914-ab4c-df5b67bae618%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

RompePC

unread,
Aug 12, 2016, 2:29:22 AM8/12/16
to Django users, constantine...@gmail.com
Thanks for the response, but I tried that before and didn't helped. In xadmin you inherit from object (yeah, weird), and there you've your model panel.
The matter is that some set up works in that parent class (like form_layout), but others not, and raising and exception to see their values show me that all are setted up well, but later doesn't shows anything. That super has to be doing something with they, but I don't know what.


El jueves, 11 de agosto de 2016, 21:26:50 (UTC+2), Constantine Covtushenko escribió:
Hi Rompe,

As for your admin models it seems like they should extend:
`admin.ModelAdmin`, see django documentation

I am not sure that this is a problem you have encountered.
But to move further please do like said in the documentation firstly.

Regards,

On Thu, Aug 11, 2016 at 1:06 PM, RompePC <durillo...@gmail.com> wrote:
I'll say first that I'm using xadmin, although it doesn't matter for this problem.
Python 2.7.3 with Django 1.9.5

The problem is in this piece of code (take it as an example):

class ParentAdmin(object):
   def __init__(self):
     # Boring stuff
     self.list_filter = ["name"]
     # Calling super()

class SonAdmin(ParentAdmin):
    # Boring stuff

If I set up list_filter in SonAdmin, it shows the filter and all goes well. But, if I set up it instead in ParentAdmin, it just doesn't show. And its weird because it works when setting list_display the same way. No errors throwed, and no other part of the code is the problem. I think that Django overrides it in some moment, but that wouldn't make sense. Any ideas?

--
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...@googlegroups.com.

RompePC

unread,
Aug 12, 2016, 7:45:06 AM8/12/16
to Django users
An intereseting point is that, even after the super, list_filter remains still setted (which is what I want), but then in the web page it doesn't show anywhere (as if you just didn't setted it). Maybe there's some hidden __init__ upside model admin that do some clean?

Constantine Covtushenko

unread,
Aug 12, 2016, 4:24:52 PM8/12/16
to django...@googlegroups.com
Sorry, I did not mention your point about xadmin.
Sorry again.

I've checked its github page. It seems like they do not have documentation in English.

So may be your problem should be addressed to them?
Did you try that?

Else as for me we should go to xadmin code and check there.

--
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 post to this group, send email to django...@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.

RompePC

unread,
Aug 22, 2016, 10:35:31 AM8/22/16
to Django users, constantine...@gmail.com
Sorry for the late response, have been busy.

In communication, their activity is almost null (just see the response to issues). Every problem I had has to be fixed by me with no help.
About english docs, they were supossed to be finished 2 years ago.
And if you think you can check code to know what's going on... ahhhhh my friend, the path is dark and long (like the Abyss).

Although I'll continue searching, hoping for some light. Thanks anyway.


El viernes, 12 de agosto de 2016, 22:24:52 (UTC+2), Constantine Covtushenko escribió:
Sorry, I did not mention your point about xadmin.
Sorry again.

I've checked its github page. It seems like they do not have documentation in English.

So may be your problem should be addressed to them?
Did you try that?

Else as for me we should go to xadmin code and check there.
On Fri, Aug 12, 2016 at 2:45 PM, RompePC <durillo...@gmail.com> wrote:
An intereseting point is that, even after the super, list_filter remains still setted (which is what I want), but then in the web page it doesn't show anywhere (as if you just didn't setted it). Maybe there's some hidden __init__ upside model admin that do some clean?

El jueves, 11 de agosto de 2016, 12:58:20 (UTC+2), RompePC escribió:
I'll say first that I'm using xadmin, although it doesn't matter for this problem.
Python 2.7.3 with Django 1.9.5

The problem is in this piece of code (take it as an example):

class ParentAdmin(object):
   def __init__(self):
     # Boring stuff
     self.list_filter = ["name"]
     # Calling super()

class SonAdmin(ParentAdmin):
    # Boring stuff

If I set up list_filter in SonAdmin, it shows the filter and all goes well. But, if I set up it instead in ParentAdmin, it just doesn't show. And its weird because it works when setting list_display the same way. No errors throwed, and no other part of the code is the problem. I think that Django overrides it in some moment, but that wouldn't make sense. Any ideas?

--
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...@googlegroups.com.

To post to this group, send email to django...@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
Reply all
Reply to author
Forward
0 new messages