1. Inlines 
http://docs.djangoproject.com/en/dev/ref/contrib/admin/#inlinemodeladmin-objects

2. Form media http://docs.djangoproject.com/en/dev/topics/forms/media/

3. Your example does not require custom template overrides for the
admin HTML, it is possible to simply include a function from your
Model in 'list_display'. 
http://docs.djangoproject.com/en/dev/intro/tutorial02/#customize-the-admin-change-list
... In your example the function must return the HTML for the
thumbnail image, and it must escape it and allow tags so that the HTML
shows correctly in the admin.  Example (from django-imagekit):

>    def admin_thumbnail_view(self):
>        if not self._imgfield:
>            return None
>        prop = getattr(self, self._ik.admin_thumbnail_spec, None)
>        if prop is None:
>            return 'An "%s" image spec has not been defined.' % \
>              self._ik.admin_thumbnail_spec
>        else:
>            if hasattr(self, 'get_absolute_url'):
>                return u'<a href="%s"><img src="%s"></a>' % \
>                    (escape(self.get_absolute_url()), escape(prop.url))
>            else:
>                return u'<a href="%s"><img src="%s"></a>' % \
>                    (escape(self._imgfield.url), escape(prop.url))
>    admin_thumbnail_view.short_description = _('Thumbnail')
>    admin_thumbnail_view.allow_tags = True

You would then include 'admin_thumbnail_view' in 'list_display' in
your Model's admin.

4. As for the thumbnail question, you can look at 'sorl-thumbnail' or
'django-imagekit'. I use my own amalgamation of both, for their
different features.

As for the rest of the question, you can add onto the admin app all
you want with your own views, templates, etc. by hijacking the URL
routing in urls.py to look for '/admin/my-report-page' and route that
to your own app.  To integrate this into the admin you can simply edit
the template for the main index, or use 'django-admin-tools' which
gives you a much nicer way of adding onto the admin with your own
dashboard links and modules.  Or you may watch out for 'django-
grappelli' to soon integrate 'django-admin-tools' into its already
existing body of work, like their Navigation sidebar which lets you
add your own links to the admin index, and Bookmarks which appear at
the top of every admin page. (The latest work is still not quite
usable but still very impressive)

5. I've pondered on both examples myself, but haven't really gone
anywhere with those ideas, so I can't tell you for sure whether it's
possible or not. But my bet's on it being possible, because in the
first example you're simply filtering out child categories based on
the parent category selection, so this would be doable completely with
JS it seems.  The second example seems doable as well, though I
haven't tried it myself.

On Apr 8, 6:15 am, UnclaimedBaggage <baynej...@gmail.com> wrote:
> Hi folks,
>
> Long-time PHP/Zend user here who'd LOVE to switch to Python/Django for
> webdev work. I've just spent a few hours snooping around Django and
> really like what I see, but before I invest any real time in it I'd
> really appreciate some advice on if (or how easily) a few things can
> be done. My main concern is the flexibility of django-admin. I LOVE
> the feature, but I'm a little concerned about flexibility. Any
> suggestions on the following would be very appreciated:
>
> #1.) For usability's sake, I'd like to have foreign key models
> embedded in the same admin form as the model they're referencing. For
> example, if there's a "products" model with a one-to-many relationship
> to "product options", I'd like to add "product options" from within
> the "product" admin form. (Eg javascript adds another field each time
> all existing "product option" fields are filled out...or something).
> Anything that will help (or hurt)  me in trying to add this sort of
> functionality? Is this commonly done?
>
> #2.) Adding javascript to individual admin forms. Simple?
>
> #3.) Customising the HTML (not CSS) output of django-admin. For
> example, putting a thumbnailed image next to each product in the
> Admin-->Products table list. Simple?
>
> #4.) A lot of what I do is basic (but custom) e-commerce & CMS stuff.
> Django's CMS potential looks very solid, although I'm wondering if
> tacking on basic e-commerce features to django-admin could be a little
> cumbersome. Features such as basic order reports/stats etc don't seem
> to fit too freely into the django-admin approach. I'll also need to
> auto-create thumbnails from model.ImageField inputs. Easily doable?
>
> #5.) 'Convenience' form fields in admin forms. For example, a select
> box that lets you choose a parent category, which in turn presents a
> 'child category' select box, etc...or tree-structured checkboxes. I'm
> comfortable writing up the javascript, but from a quick inspection
> django-admin didn't seem to like the inclusion of select fields that
> weren't intended to interact with the model. Was this just my clumsy
> newbieness or is this going to be a problem?
>
> Many thanks - hope to be one of the django community soon. :-)
>
>  - Unclaimed Baggage

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to