You can register models anywhere you like. However, you’ll need to make sure
that the module it’s in gets imported early on so that the model gets
registered before any bookmark is saved by the user.
This makes your app’s models.py a good place to put the above code.

Handlers are Python classes encapsulating bookmarking options for a given
model, and theese options can be overridden while registering a model, e.g.:

What if, for instance, you want to use different forms for staff and normal
users?

As in Django own contrib.admin.ModelAdmin, you can write subclasses of
bookmarks.handlers.Handler to override the methods which actually
perform the bookmark process, and apply any logic you desire.

Here is an example meeting the needs described above:

frombookmakrs.handlersimportlibrary,HandlerclassMyHandler(Handler):defget_form_class(self,request):""" Return the form class that will be used to add or remove bookmarks. Default is *self.form_class*. """returnStaffFormifrequest.user.is_staffelseself.form_classlibrary.register(MyModel,MyHandler)

Initially the handler is responsable of producing a valid bookmark key.

The key is an arbitrary string representing the type of bookmark we are saving.
For example, users can like an article or hate it, or maybe they want to be
notified on comments of that article. Theese are different types of bookmarks
and can be expressed using different keys
(e.g.: likes, hates, comments).