File: admin.py

package info (click to toggle)
django-ajax-selects 1.2.4-1
  • links: PTS
  • area: main
  • in suites: wheezy
  • size: 260 kB
  • sloc: python: 735; sh: 9; makefile: 6
file content (16 lines) | stat: -rw-r--r-- 474 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16


from ajax_select.fields import autoselect_fields_check_can_add
from django.contrib import admin


class AjaxSelectAdmin(admin.ModelAdmin):

    """ in order to get + popup functions subclass this or do the same hook inside of your get_form """

    def get_form(self, request, obj=None, **kwargs):
        form = super(AjaxSelectAdmin,self).get_form(request,obj,**kwargs)
        
        autoselect_fields_check_can_add(form,self.model,request.user)
        return form