Electronics & Programming

develissimo

Open Source electronics development and programming

  • You are not logged in.
  • Root
  • » Django
  • » use admin features in external applications [RSS Feed]

#1 Nov. 12, 2005 19:14:59

frank h.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

use admin features in external applications


hello,
how can i reuse some features of the admin app in my external
applications?
the search_fields and date_hierarchy features are so nice!
is there a simple way?
-frank

Offline

#2 Nov. 13, 2005 16:18:22

t.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

use admin features in external applications


I hate to do this, but - me too!

I've svn'ed the new-admin branch in the hope that it would be easier to
do it from that checkout, but no joy as yet.

Offline

#3 Nov. 14, 2005 01:03:21

Robert W.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

use admin features in external applications


tonemcd wrote:
> I hate to do this, but - me too!
>
> I've svn'ed the new-admin branch in the hope that it would be easier to
> do it from that checkout, but no joy as yet.
>
>
Not really sure what you want to do, so I hope the reply to frank h will
help you too.

Offline

#4 Nov. 14, 2005 01:12:12

Robert W.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

use admin features in external applications


frank h. wrote:
> hello,
> how can i reuse some features of the admin app in my external
> applications?
> the search_fields and date_hierarchy features are so nice!
> is there a simple way?
> -frank
>
>

Your best bet is the new-admin branch. However, the particular features
you have mentioned do not really work in a particularly componentised
way at the present time.

You can take a look at django/contrib/admin/templatetags/admin_list.py

The relevant tags are search_form and date_hierarchy.

As you can see, both these tags rely on a variable called 'cl' . This is
an instance of the class ChangeList from django/contrib/admin/main.py.

It should be possible, due to the "duck typing" nature of python, to
create another class which supports the methods used by these tags, and
use an instance of this class to pass to this tag.

A more complete solution would be to extract interfaces or abstract
classes from the class ChangeList which encapsulate the functionality
required by a particular tag. And then provide a patch to new-admin so
that others can benefit ;-)

Note that the tags also rely on particular get parameters being
processed by the view that contains them.

Offline

#5 Nov. 14, 2005 03:52:48

Kenneth G.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

use admin features in external applications


On Sunday 13 Nov 2005 12:44 am, frank h. wrote:
> hello,
> how can i reuse some features of the admin app in my external
> applications?
> the search_fields and date_hierarchy features are so nice!
> is there a simple way?

join the rjwittam fan club - new-admin is on the way
--
regards
kghttp://www.livejournal.com/users/lawgontally ho!http://avsap.org.inಇಂಡ್ಲಿನಕ್ಸ வாழ்க!

Offline

#6 Nov. 14, 2005 12:36:57

t.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

use admin features in external applications


Thanks for the info Robert - I was aiming at using some of the forms
etc. functionality from the admin interface in my own applications
(trying to not re-invent the wheel).

I will have a look around the admin_list.py code and see whether I can
pick things up from there.

Certainly being able to use all the Django forms goodies in my own app
would be *rather* nice, so please developers, could you consider this a
+1 for this functionality 'out of the box'?.

cheers
Tone

Offline

#7 Nov. 14, 2005 13:23:50

Robert W.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

use admin features in external applications


tonemcd wrote:
> Thanks for the info Robert - I was aiming at using some of the forms
> etc. functionality from the admin interface in my own applications
> (trying to not re-invent the wheel).
>
> I will have a look around the admin_list.py code and see whether I can
> pick things up from there.
>
> Certainly being able to use all the Django forms goodies in my own app
> would be *rather* nice, so please developers, could you consider this a
> +1 for this functionality 'out of the box'?.
>
> cheers
> Tone
>
>

The autogenerated forms stuff is a bit easier to use than the
change_list . The place to look at the tags is admin_modify.py.

You can see what is needed to make the tags work by looking at
django/contrib/admin/views/main.py.

The api to generate these objects ( BoundManipulator, BoundField, etc )
is not yet finalised: There are a very bits that I think will only be
resolved when core fields go. (Basically, the FormFieldwrapper is still
used, which should not be necessary when core fields go).

If you just wish to use inline editing outside the admin, take a look athttp://code.djangoproject.com/wiki/NewAdminChangesRobert

Offline

  • Root
  • » Django
  • » use admin features in external applications [RSS Feed]

Board footer

Moderator control

Enjoy the 18th of November
PoweredBy

The Forums are managed by develissimo stuff members, if you find any issues or misplaced content please help us to fix it. Thank you! Tell us via Contact Options
Leave a Message
Welcome to Develissimo Live Support