#28068: Allow customizing popup window for selecting related objects in django
admin
-----------------------------------------+------------------------
               Reporter:  tonnzor        |          Owner:  nobody
                   Type:  New feature    |         Status:  new
              Component:  contrib.admin  |        Version:  master
               Severity:  Normal         |       Keywords:
           Triage Stage:  Unreviewed     |      Has patch:  0
    Needs documentation:  0              |    Needs tests:  0
Patch needs improvement:  0              |  Easy pickings:  0
                  UI/UX:  0              |
-----------------------------------------+------------------------
 In Django admin when you select related object in Django admin -- it shows
 you popup window. Size of this popup is hardcoded to 800x500 px and does
 not always match user expectations. It would be great to allow changing it
 at least system-wide.

 Proposal:

 1. Provide a setting to change default popup size
 2. Use some global Javascript variable for storing popup size so we could
 override per page

 Sample application:

 {{{
 #!python
 # models.py

 class Author(models.Model):
     name = models.CharField(max_length=100)


 class Book(models.Model):
     author = models.ForeignKey(Author)
     name = models.CharField(max_length=100)

 # admin.py

 @admin.register(Author)
 class AuthorAdmin(admin.ModelAdmin):
     pass


 @admin.register(Book)
 class BookAdmin(admin.ModelAdmin):
     raw_id_fields = ('author',)

 }}}


 Source code:
 {{{
 #!javascript
 // RelatedObjectLookups.js

     function showAdminPopup(triggeringLink, name_regexp, add_popup) {
         var name = triggeringLink.id.replace(name_regexp, '');
         name = id_to_windowname(name);
         var href = triggeringLink.href;
         if (add_popup) {
             if (href.indexOf('?') === -1) {
                 href += '?_popup=1';
             } else {
                 href += '&_popup=1';
             }
         }
         var win = window.open(href, name,
 'height=500,width=800,resizable=yes,scrollbars=yes');
         win.focus();
         return false;
     }

 //-----------------------------------------^ here it is

 }}}

--
Ticket URL: <https://code.djangoproject.com/ticket/28068>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/050.992032af0131ca3d3923bcf643cc641c%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to