#NEWLINE# def get_form( self , request , obj = None , **kwargs ) : #NEWLINE# #INDENT# '\n        Return a different set of fields if the form is shown in a popup window\n        versus a normal window. To provide better integration with a project\n        manager, which will presumably be managing certain information, we \n        include only the bare necessity of fields in the popup menu.\n        \n        This is pretty much copied from Django source, with a bit to make it work\n        with 1.1 as well as 1.2.\n        \n        Returns a Form class for use in the admin add view. This is used by\n        add_view and change_view.\n        ' #NEWLINE# from django.contrib.admin.util import flatten_fieldsets #NEWLINE# from django.forms.models import modelform_factory #NEWLINE# from django.utils.functional import curry #NEWLINE# if request . REQUEST . has_key ( '_popup' ) : #NEWLINE# #INDENT# fields = flatten_fieldsets ( [ ( None , { #NEWLINE# #INDENT# 'fields' : self . popup_fields , #NEWLINE# #UNINDENT# } ) ] ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if self . declared_fieldsets : #NEWLINE# #INDENT# fields = flatten_fieldsets ( self . declared_fieldsets ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# fields = None #NEWLINE# #UNINDENT# #UNINDENT# if ( exclude . exclude is None ) : #NEWLINE# #INDENT# exclude = [ ] #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# exclude = list ( self . exclude ) #NEWLINE# #UNINDENT# exclude . extend ( kwargs . get ( 'exclude' , [ ] ) ) #NEWLINE# if hasattr ( self , 'get_readonly_fields' ) : #NEWLINE# #INDENT# exclude . extend ( self . get_readonly_fields ( request , obj ) ) #NEWLINE# #UNINDENT# exclude = ( exclude or None ) #NEWLINE# defaults = { #NEWLINE# #INDENT# 'form' : self . form , #NEWLINE# 'fields' : fields , #NEWLINE# 'exclude' : exclude , #NEWLINE# 'formfield_callback' : curry ( self . formfield_for_dbfield , request = request ) , #NEWLINE# #UNINDENT# } #NEWLINE# defaults . update ( kwargs ) #NEWLINE# return modelform_factory ( self . model , ** defaults )