Example #1
0
 def get_context_data(self, **kwargs):
     opts = self.document._meta
     obj = self.object
     context = AdminViewMixin.get_context_data(self, **kwargs)
     context.update({
         'root_path':
         getattr(self.admin_site, 'root_path', None),
         'app_label':
         opts.app_label,
         'opts':
         opts,
         'module_name':
         force_unicode(opts.verbose_name_plural),
         'breadcrumbs':
         self.get_breadcrumbs(),
         'has_add_permission':
         self.admin.has_add_permission(self.request),
         'has_change_permission':
         self.admin.has_change_permission(self.request, obj),
         'has_delete_permission':
         self.admin.has_delete_permission(self.request, obj),
         'has_file_field':
         True,  # FIXME - this should check if form or formsets have a FileField,
         'has_absolute_url':
         hasattr(self.document, 'get_absolute_url'),
         #'content_type_id': ContentType.objects.get_for_model(self.model).id,
         'save_as':
         self.admin.save_as,
         'save_on_top':
         self.admin.save_on_top,
     })
     return context
Example #2
0
 def get_context_data(self, **kwargs):
     opts = self.document._meta
     obj = self.object
     context = AdminViewMixin.get_context_data(self, **kwargs)
     context.update({'root_path': getattr(self.admin_site, 'root_path', None),
                     'app_label': opts.app_label,
                     'opts': opts,
                     'module_name': force_unicode(opts.verbose_name_plural),
                     'breadcrumbs': self.get_breadcrumbs(),
                     'has_add_permission': self.admin.has_add_permission(self.request),
                     'has_change_permission': self.admin.has_change_permission(self.request, obj),
                     'has_delete_permission': self.admin.has_delete_permission(self.request, obj),
                     'has_file_field': True, # FIXME - this should check if form or formsets have a FileField,
                     'has_absolute_url': hasattr(self.document, 'get_absolute_url'),
                     #'content_type_id': ContentType.objects.get_for_model(self.model).id,
                     'save_as': self.admin.save_as,
                     'save_on_top': self.admin.save_on_top,})
     return context
Example #3
0
 def get_context_data(self, **kwargs):
     context = AdminViewMixin.get_context_data(self, **kwargs)
     opts = self.schema._meta
     context.update({'title': _('Add %s') % force_unicode(opts.verbose_name),
                     'show_save': True,
                     'show_delete_link': bool(self.dotpath()), #TODO is it a new subobject?
                     'show_save_and_add_another': False,
                     'show_save_and_continue': True,
                     'add': True,
                     'add_another': True,
                     'cancel': False,
                     'change': False,
                     'delete': False,
                     'breadcrumbs': self.get_breadcrumbs(),
                     'dotpath': self.dotpath(),
                     'tempdoc': self.get_temporary_store(),
                     'tempdoc_info': self.get_temporary_store()._tempinfo,
                     'adminform':self.create_admin_form(),
                     'inline_admin_formsets': self.get_inline_admin_formsets(),})
     context['media'] += context['adminform'].form.media
     for inline in context['inline_admin_formsets']:
         context['media'] += inline.media
         #TODO this does not work as media is a property, fix this and js will be pulled from the inline form
         context['media'] += inline.formset.form.media
     
     obj = None
     if hasattr(self, 'object'):
         obj = self.object
     
     context.update({'root_path': getattr(self.admin_site, 'root_path', None),
                     'app_label': opts.app_label,
                     'opts': opts,
                     'original': obj,
                     'module_name': force_unicode(opts.verbose_name_plural),
                     'has_add_permission': self.admin.has_add_permission(self.request),
                     'has_change_permission': self.admin.has_change_permission(self.request, obj),
                     'has_delete_permission': self.admin.has_delete_permission(self.request, obj),
                     'has_file_field': True, # FIXME - this should check if form or formsets have a FileField,
                     'has_absolute_url': hasattr(self.document, 'get_absolute_url'),
                     #'content_type_id': ContentType.objects.get_for_model(self.model).id,
                     'save_as': self.admin.save_as,
                     'save_on_top': self.admin.save_on_top,})
     context['object_tools'] = self.get_object_tools(context)
     return context
Example #4
0
    def get_context_data(self, **kwargs):
        context = AdminViewMixin.get_context_data(self, **kwargs)
        opts = self.schema._meta
        context.update({
            'title':
            _('Add %s') % force_unicode(opts.verbose_name),
            'show_save':
            True,
            'show_delete_link':
            bool(self.dotpath()),  #TODO is it a new subobject?
            'show_save_and_add_another':
            False,
            'show_save_and_continue':
            True,
            'add':
            True,
            'add_another':
            True,
            'cancel':
            False,
            'change':
            False,
            'delete':
            False,
            'breadcrumbs':
            self.get_breadcrumbs(),
            'dotpath':
            self.dotpath(),
            'tempdoc':
            self.get_temporary_store(),
            'tempdoc_info':
            self.get_temporary_store()._tempinfo,
            'adminform':
            self.create_admin_form(),
            'inline_admin_formsets':
            self.get_inline_admin_formsets(),
        })
        context['media'] += context['adminform'].form.media
        for inline in context['inline_admin_formsets']:
            context['media'] += inline.media
            #TODO this does not work as media is a property, fix this and js will be pulled from the inline form
            context['media'] += inline.formset.form.media

        obj = None
        if hasattr(self, 'object'):
            obj = self.object

        context.update({
            'root_path':
            getattr(self.admin_site, 'root_path', None),
            'app_label':
            opts.app_label,
            'opts':
            opts,
            'original':
            obj,
            'module_name':
            force_unicode(opts.verbose_name_plural),
            'has_add_permission':
            self.admin.has_add_permission(self.request),
            'has_change_permission':
            self.admin.has_change_permission(self.request, obj),
            'has_delete_permission':
            self.admin.has_delete_permission(self.request, obj),
            'has_file_field':
            True,  # FIXME - this should check if form or formsets have a FileField,
            'has_absolute_url':
            hasattr(self.document, 'get_absolute_url'),
            #'content_type_id': ContentType.objects.get_for_model(self.model).id,
            'save_as':
            self.admin.save_as,
            'save_on_top':
            self.admin.save_on_top,
        })
        context['object_tools'] = self.get_object_tools(context)
        return context