Use of django-reversion outside Admin

63 views
Skip to first unread message

SnappyDjangoUser

unread,
Dec 2, 2008, 1:03:53 PM12/2/08
to Django Reversion Discussion
Hopefully this is the correct forum to ask django-reversion use
questions. If not, I apologize and please point me to the correct
forum.

Is there an easy way to incorporate the built-in Change History and
Reversion functionality that exists in the Admin in a standalone (non-
admin) site? I see that there is a low-level api, but before I built
something from the ground up, I wanted to ask and see if there is an
existing view function that could be called to render the Change
History and Reversion pages.

Thanks!

David Hall

unread,
Dec 2, 2008, 1:13:27 PM12/2/08
to django-r...@googlegroups.com
Hi there,

You've come to the right place!

At the moment, there is no existing view function to do what you are
suggesting, as I suspect everyone would have a different way of doing it.

Have you considered using the VersionAdmin class and adding your own
media to style it as appropriate? If not, you can probably copy and
paste a whole lot of the code to get it working.

I'll be happy to answer any queries you have along the way, of course.

Best wishes, and good luck,

David.
--
David Hall
Technical Lead
Etianen.com
Tel: 07896 106290

Email da...@etianen.com
Web www.etianen.com
-------------------------------------------------------------------
Ask for help at sup...@etianen.com
Etianen.com is a small, professional web development agency that
specialises in fast-paced, creative development.
----------------- enlightened website development -----------------

SnappyDjangoUser

unread,
Dec 2, 2008, 2:58:55 PM12/2/08
to Django Reversion Discussion
Good idea! I am just starting to see the light on how django-
reversion is designed.

Just to make sure I understand what you are suggesting, you are
suggesting copying the code in VersionAdmin into a new class and
instead of deriving VersionAdmin from admin.ModelAdmin I could dervice
it from models.Model. I would then use this new class as an abstract
base class to my models. Is that correct?

Thanks,

Brian
>   Ask for help at supp...@etianen.com

David Hall

unread,
Dec 3, 2008, 4:19:33 AM12/3/08
to django-r...@googlegroups.com
Not really. I was more suggesting that you either turn the methods in
VersionAdmin into view functions, or add a media definition to the
VersionAdmin class to style it to your needs.

class MyModelAdmin(VersionAdmin):

class Media:
css = "/media/foo.css", "/media/bar.css",

admin.site.register(MyModel, MyModelAdmin)

Converting the VersionAdmin class into view functions will probably be
easier in the long run, however.

David.
Ask for help at sup...@etianen.com
Reply all
Reply to author
Forward
0 new messages