Comments (9)
Ok, yeah what you need to do is, define the fields property on the admin for the BottomInline. You should only include the foreign key. In your case it should look like:
class BottomInline(LinkInline):
model = models.Bottom
fields = ('top',)
The parent_link should not be used in the BottomInline, only in the BottomAdmin. http://packages.python.org/django-easymode/tree/api.html#easymode.tree.admin.abstract.LinkInline
I don;t know why the fields are empty. That is a bug. Please try again with the definition of BottomInline as follows:
class BottomInline(LinkInline):
model = models.Bottom
fields = ('top', 'text')
But again, you should not show the fields in that form, only the links should be visible. So only the foreign key should be in fields
from django-easymode.
The documentation also says you MUST define the fields property
class BottomLinkInline(LinkInline):
"""
This is the inline view of the inlined item. It will de rendered as a
link to the change view or add view of the inlined item.
NOTE that you MUST define fields, which must only include the foreign key.
Ofcourse you might want to include some more fields and put them as
read_only_fields, to give a bit more info.
"""
fields = ('top',)
model = BottomModel
from django-easymode.
Explicit definition of the 'fields' property doesn't help.
Definitely, the BottomInline works as described if I include the only 'top' field (foreign key) to the 'fields' property, but this is not an expected behaviour for the inline form inherited from the standard django inline :(
Really I wanted to have a standard django inline (probably readonly) with additional link to the full-featured (sub)object editor. The str() representation of the (sub)object helps partially, but is not a complete solution if I f.e. wanted to have a table of (sub)object rows. I will think about it ...
from django-easymode.
If you add 'text' to readonly_fields does that work? Or is it still empty?
class BottomInline(LinkInline):
model = models.Bottom
fields = ('top', )
readonly_fields = ('text',)
from django-easymode.
It doesn't work (the 'text' is not shown at all) in this form, but the following is working as expected:
class BottomInline(LinkInline):
model = models.Bottom
parent_link = 'top'
fields = ('top','text')
readonly_fields = ('text',)
from django-easymode.
Ok so the documentation should be updated to reflect this.
from django-easymode.
It might be useful to have a separate object like 'object link widget' which I can add to the standard (or inherited from standard) tabular or stacked inline ... this solution will cover all needs.
from django-easymode.
Hmm the problem is, that django overrides every attempt to have a custom widget for a the foreign key field in inlines. That is why LinkInline has a custom formset, to stop django from resetting it to it's default.
So what you are proposing is not possible. You always have to override the formset. Maybe what you want is what I'm doing in: https://github.com/specialunderwear/django-polymorphic-easymode/blob/master/mixed/admin.py
It also renders a link to the 'full' admin.
from django-easymode.
Hmm ... it is really near to my needs, including polymorphing, I should investigate it deeply ...
from django-easymode.
Related Issues (18)
- Check standard permissions for add/edit/remove features HOT 4
- Django 1.3, 1.4 admin readonly fields problem HOT 1
- wrong import HOT 1
- `I18n` decorator bug in pip package HOT 1
- ImportError: cannot import name execute_manager
- L10n decorator renders two checkbox columns in admin interface HOT 1
- Support django 1.3 static files subsystem HOT 2
- Django 1.8 support HOT 1
- This seems like the perfect module for model translation... but which version to use on Django 1.7.8? HOT 2
- can't import tzinfo HOT 2
- python3 urlparse error.
- from Django.utils import tzinfo HOT 4
- Useful class for easymode to hide parent_link field HOT 1
- unique_error_message has moved to model in Django 1.3 HOT 5
- L10n decorator doesn't respect a ModelAdmin's pre existing 'exclude' field HOT 3
- I18n broken with django 1.4-beta-1 HOT 1
- Django 1.4 - Locale URL HOT 9
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from django-easymode.