Electronics & Programming

develissimo

Open Source electronics development and programming

  • You are not logged in.

#1 Jan. 24, 2011 09:30:09

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

Adding to admin logic


On Sunday, January 23, 2011 7:45:04 PM UTC, Tom Wieland wrote:
>
> Hello,
>
> I am trying to get the company that I work at to use Django and Python
> for future webdevelopment (whereas now that is done with PHP). We have
> lots of different customers with lots of different website needs so
> the datamodel is different so webframeworks are good choice (over CMS
> maybe) and Django rocks so use that, is the reasoning :P.
>
> To make a use case and test the framework out I'm making an app called
> treepages that with models Page (tree) and Field I can make a
> structure of webpages with editable fields in the backend. I could use
> the admin to add and remove fields and maybe even disable that
> functionality in production for that site so they can only change page
> content, not structure.
>
> The way I'd like it to work is to change the index view of the page
> model of the treepages app in the admin to my custom view function.
> The problem here for me is that even if I make a route to my own app
> controller instead of the admin one I don't know if and how I can get
> my own view function to behave like an django admin view but then
> include my own logic i.e. how do I integrate with the admin 'session'.
>
> Later I might be interested in changing other views in the admin as
> well to for example have a custom 'dashboard' on the index view when
> enabled in the 'misc settings' view etc.
>
> I understand that this might have been asked before but even if the
> admin wasn't really made for this (though it's all strictly adminny
> stuff meant for the client administrators and not the frontend users
> of the site..) is it possible?
>
> Greetings,
>
> Tom Wieland
>
>
On Sunday, January 23, 2011 7:45:04 PM UTC, Tom Wieland wrote:
>
> Hello,
>
> I am trying to get the company that I work at to use Django and Python
> for future webdevelopment (whereas now that is done with PHP). We have
> lots of different customers with lots of different website needs so
> the datamodel is different so webframeworks are good choice (over CMS
> maybe) and Django rocks so use that, is the reasoning :P.
>
> To make a use case and test the framework out I'm making an app called
> treepages that with models Page (tree) and Field I can make a
> structure of webpages with editable fields in the backend. I could use
> the admin to add and remove fields and maybe even disable that
> functionality in production for that site so they can only change page
> content, not structure.
>
> The way I'd like it to work is to change the index view of the page
> model of the treepages app in the admin to my custom view function.
> The problem here for me is that even if I make a route to my own app
> controller instead of the admin one I don't know if and how I can get
> my own view function to behave like an django admin view but then
> include my own logic i.e. how do I integrate with the admin 'session'.
>
> Later I might be interested in changing other views in the admin as
> well to for example have a custom 'dashboard' on the index view when
> enabled in the 'misc settings' view etc.
>
> I understand that this might have been asked before but even if the
> admin wasn't really made for this (though it's all strictly adminny
> stuff meant for the client administrators and not the frontend users
> of the site..) is it possible?
>
> Greetings,
>
> Tom Wieland
>

There's nothing special about integrating with the admin 'session' - it just
works on the basis of the normal logged-in user, as available via
request.user, just like any other Django view.

However to answer the question about providing your own admin logic, you can
add views as methods in your ModelAdmin subclass and then override the
get_urls method to return a URLconf which points to the new methods. See the
documentation:http://docs.djangoproject.com/en/1.2/ref/contrib/admin/#django.contrib.admin.ModelAdmin.get_urls--
DR.

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

Offline

Board footer

Moderator control

Enjoy the 19th of August
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