django-admin-large-initial-data

Allow to make redirects with large session data to django ModelAdmin add view


Keywords
django, admin, initial_data
License
GPL-2.0+
Install
pip install django-admin-large-initial-data==1.0.0

Documentation

django-admin-large-initial-data

Allow to make redirects with large session data.

This application overrides limitation of Django ModelAdmin.get_changeform_initial_data which is encoded in URL and therefore limmited in size.

With django-admin-large-initial-data, You can make redirections to the ModelAdmin with large set of data marked as ManyToManyField.

Basic Usage

In Admin use LargeInitialMixin:

   from large_initial import LargeInitialMixin
   @admin.register(models.Album)
   class AlbumAdmin(LargeInitialMixin, admin.ModelAdmin):
       pass

Then you can create redirection link:

   from large_initial import build_redirect_url

   redirect_url = build_redirect_url(
       request,
       'admin:main_album_add',
       params={'artists': musicians},
   )
   return HttpResponseRedirect(redirect_url)

all of the musicians objects are stored in request.session.