burke-software / django-mass-edit Goto Github PK
View Code? Open in Web Editor NEWMake bulk changes in the Django admin interface
Make bulk changes in the Django admin interface
Readme should be updated to support new versions of Django.
[root@e85a0fc40662 /]# /usr/lib64/python2.7/site-packages/django/contrib/admin/util.py:7: RemovedInDjango19Warning: The django.contrib.admin.util module has been renamed. Use django.contrib.admin.utils instead.
"Use django.contrib.admin.utils instead.", RemovedInDjango19Warning)
Looks like massadmin.py references this.
When using django 1.7 the admin.site.site_header = field is being ignored so your site still shows Django Admin at the top. Is this easily fixed?
Hi Burke Software,
This is a lovely app. I'm not necessarily reporting a bug, or even requesting a feature change. I'm trying to find an app, like this mass edit app, that lets me select a set of objects and certain fields, then it presents me with a long page with all the selected objects and the selected fields so I can do quick data entry. I'm sure this is possible with coding, but is there an app out there you know that would do this?
As far as I'm aware, django-mass-edit bulk-edits all the selected objects with the exact same data entered in the form. Correct?
Thank you for both reporting and mass-edit!
keehun
Please update PyPI package with version that is compatible with Django 2.0.
Django version: 2.1.4
Python Version: 3.6.0
KeyError:
'has_view_permission' is missing "In template .../django/contrib/admin/templates/admin/base.html, error at line 58"
Django 2.1 added a view permission to the default permissions.
This might be a stretch, and I know its "out of the core focus", but I would appreciate it if you could look at the option of providing templates that make mass-edit compatible with the "look and feel" of django-suit. This is the best package I have seen for admin interface customisation, and the developer is working hard to ensure that third-party apps can integrate with it.
https://github.com/darklow/django-suit/
and
darklow/django-suit#3
Thanks!
Guys,
Could you explain to me how to make django-mass-edit add log entries? I'm trying to audit some mass updates and I really need this feature. Should this plugin do this by default? Or I need to add some extra code by myself?
Anyone also has this particulary problem?
If I select all records using top left check box and then I click at "Select all XXX <table_verbose>", all records are selected including these which aren't show at current page. But only records from current page are changed. The rest of them is still the same
Hi there,
I am using this package with initcrash/django-denorm and I have a problem with their interaction. It can be fixed by either package, and both fixes are useful.
Denormalization is asynchronous except when a model is saved directly. Massadmin saves the model directly, causing all denormalization to be synchronous.
Solutions:
These are sort of the same solution - it will involve disconnecting a signal and then reconnecting it, or something like that. I have not figured out the best way.
I like this, because (a) massadmin seems to be a more active project with easier to understand code and (b) I already use django-rq for lots of asynchronous things such as some manual denormalization that is too hard to express with django-denorm.
So I am already working on this solution and it is mostly done except for troubling pickling various things. I wonder if you have opinions about this problem before I proceed further.
Cheers,
Kenn
There is warning about future incompatibility with Django 1.10
/env/lib/python3.4/site-packages/massadmin/urls.py:7: RemovedInDjango110Warning: django.conf.urls.patterns() is deprecated and will be removed in Django 1.10. Update your urlpatterns to be a list of django.conf.urls.url() instances instead.
Howdy!
After initial installation of django-mass-edit in a Django 1.11 app, I'm getting a TemplateDoesNotExist /admin/app/mymodel-masschange/1,2/
error when selecting two items to bulk edit from an admin list page. The docs mention uncommenting django.template.loaders.eggs.Loader
from TEMPLATE_LOADERS
in settings.py, but TEMPLATE_LOADERS
does exist in my settings settings.py. After some research, it looks like the Django template settings got changed in 1.8.
In that upgrade documentation I noticed that I could add a loaders
section and, low and behold, my TemplateDoesNotExist
error goes away. As a second attempt, I uncommented APP_DIRS and added some loaders and things seem to work.
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [],
# 'APP_DIRS': True,
'OPTIONS': {
'context_processors': [
'django.template.context_processors.debug',
'django.template.context_processors.request',
'django.contrib.auth.context_processors.auth',
'django.contrib.messages.context_processors.messages',
],
# using loaders instead of APP_DIRS to get this stupid eggs thing to work for massadmin
# we should probably undo this at some point
'loaders': [
'django.template.loaders.filesystem.Loader',
'django.template.loaders.app_directories.Loader',
'django.template.loaders.eggs.Loader',
],
},
},
]
So, while this works, it doesn't seem like this is the right way to do things any longer. Any idea what the right way to do this is? Maybe massadmin needs to un-egg itself during install?
I'm on Python 3 with Django 1.8 and noticed that I can see mass-edits admin action in the drop down of change lists only if I use Django's default admin site. When I start using a custom admin site, it is no longer there and I can't mass-edit any model.
It would be a very good idea if, when a user clicks 'Save', but no options are checked, that a prompt is raised/displayed noting that nothing will be changed ...
I am getting this error:
File "/usr/local/lib/python2.7/dist-packages/massadmin/massadmin.py" in mass_change_view
193. raise Exception('Some of the selected objects could\'t be changed.')
There is nothing in the stack trace to indicate what is causing it or what records are not changed.
How I do catch this exception and report to the user which records could not be changed (and why)?
Just wondering if this functionality is available? e.g. I have a fields containing "foo" - "A foo", "B foo" and I want to replace the "foo" part with another word or remove it altogether.
Not sure why this particular case fails.
Traceback:
File "/usr/local/lib/python2.7/dist-packages/django/core/handlers/base.py" in get_response
response = callback(request, _callback_args, *_callback_kwargs)
return view_func(request, _args, *_kwargs)
return ma.mass_change_view(request, object_ids)
ModelForm = self.get_form(request, obj)
return modelform_factory(self.model, **defaults)
return type(form)(class_name, (form,), form_class_attrs)
raise FieldError(message)
Exception Type: FieldError at /admin/alumni/alumni-masschange/1036,1035/
Exception Value: Unknown field(s) (alumniaction_set) specified for Alumni
I just installed django-mass-edit, which basically boiled down to mentioning it in urls.py and settings.py. Mass editing works fine, but after the operation, I get redirected to '/admin/modelname' instead of '/admin/appname/modelname'. How can I fix that?
I often add read-only fields that are links to related models. Any such thing causes a crash when rendering the mass edit form, due to the field having no associated attribute.
Like so:
class MyAdmin(ModelAdmin):
def other_model_link(self, instance):
if instance.other_model:
other_url = reverse('admin:other_model_change',
args=[instance.other_model.id])
return '<a href="%(url)s">%(description)s</a>' % {
'url': other_url,
'description': html.escape(instance.other_model)
}
else:
return '(no other model)'
other_model_link.allow_tags = True
other_model_link.short_description = 'Other Model'
other_model_link.admin_order_field = 'other_model_ordering_field'
readonly_fields = ['other_model_link']
...
And the underlying error that crashes the template is AttributeError: Unable to lookup 'other_model_link' on MyModel
.
-- Kenn
Grappelli offers a very nice style and interaction enhancements for the Django admin site.
In particular, it adds a modern and friendly date & time picker which I would like to make available when doing a mass edit.
I believe that Grappelli adds these via Javascript so it may be possible to help Grappelli recognize the mass edit datetime picker and do the same thing.
Thoughts?
It would be great if in addition to writing a change to a bunch of models, it could make a copy of the model with the changed fields as differentiating factor.
hi-
would it be possible to exclude an entire model from mass edit? rather than listing the fields?
After I add 'massadmin' into INSTALLED_APPS I got that error:
.venv/local/lib/python2.7/site-packages/django/contrib/admin/util.py:7: RemovedInDjango19Warning: The django.contrib.admin.util module has been renamed. Use django.contrib.admin.utils instead.
"Use django.contrib.admin.utils instead.", RemovedInDjango19Warning)
.venv/local/lib/python2.7/site-packages/django/contrib/contenttypes/models.py:159: RemovedInDjango19Warning: Model class django.contrib.contenttypes.models.ContentType doesn't declare an explicit app_label and either isn't in an application in INSTALLED_APPS or else was imported before its application was loaded. This will no longer be supported in Django 1.9.
class ContentType(models.Model):
Hi,
Currently an object form is fetched using self.get_form(request, obj) but this results in field errors when you have custom fields which aren't defined in the model. I've been getting around this issue by replacing get_form() with admin_site._registry[model].form but I'm not sure if it's safe.
Environment:
Request Method: POST
Request URL: http://localhost:8000/admin/core/member/
Django Version: 1.8.2
Python Version: 3.4.0
Installed Applications:
('massadmin',
'bootstrap3',
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'core')
Installed Middleware:
('django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.auth.middleware.SessionAuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware')
Traceback:
File "/usr/local/lib/python3.4/dist-packages/django/core/handlers/base.py" in get_response
response = wrapped_callback(request, _callback_args, *_callback_kwargs)
return self.admin_site.admin_view(view)(_args, *_kwargs)
response = view_func(request, _args, *_kwargs)
response = view_func(request, _args, *_kwargs)
return view(request, _args, *_kwargs)
return bound_func(_args, *_kwargs)
response = view_func(request, _args, *_kwargs)
return func.**get**(self, type(self))(_args2, *_kwargs2)
response = self.response_action(request, queryset=cl.get_queryset(request))
response = func(self, request, queryset)
(modeladmin.model._meta.module_name, ','.join(selected)))
Exception Type: AttributeError at /admin/core/member/
Exception Value: 'Options' object has no attribute 'module_name'
I’m using this app in production and have an interest in keeping it updated and maybe evolving as well. So thank you for a great app @bufke et al.
There is a PR that I made 6 months ago which still got no reply. I totally understand the limitations of 24 hours in a day, believe me! I’m just wondering about the state of this app and if there is anything I can do to help keep the app alive.
If a user makes a changes that results in mass-edit creating one or more records that have duplicate entries, then an error is thrown that is not handled.
Is it possible that mass-edit can catch these and rather return a set of messages/warnings as to why the records in question were not altered?
File "/home/creation/.virtualenvs/s2s/local/lib/python2.7/site-packages/django/core/handlers/base.py" in get_response
115. response = callback(request, *callback_args, **callback_kwargs)
File "/home/creation/.virtualenvs/s2s/local/lib/python2.7/site-packages/django/contrib/admin/views/decorators.py" in _checklogin
17. return view_func(request, *args, **kwargs)
File "/home/creation/.virtualenvs/s2s/local/lib/python2.7/site-packages/massadmin/massadmin.py" in mass_change_view
65. return ma.mass_change_view(request, object_ids)
File "/home/creation/.virtualenvs/s2s/local/lib/python2.7/site-packages/massadmin/massadmin.py" in mass_change_view
183. self.save_model(request, new_object, form, change=True)
File "/home/creation/.virtualenvs/s2s/local/lib/python2.7/site-packages/django/contrib/admin/options.py" in save_model
740. obj.save()
File "/home/creation/.virtualenvs/s2s/local/lib/python2.7/site-packages/django/db/models/base.py" in save
546. force_update=force_update, update_fields=update_fields)
File "/home/creation/.virtualenvs/s2s/local/lib/python2.7/site-packages/django/db/models/base.py" in save_base
626. rows = manager.using(using).filter(pk=pk_val)._update(values)
File "/home/creation/.virtualenvs/s2s/local/lib/python2.7/site-packages/django/db/models/query.py" in _update
605. return query.get_compiler(self.db).execute_sql(None)
File "/home/creation/.virtualenvs/s2s/local/lib/python2.7/site-packages/django/db/models/sql/compiler.py" in execute_sql
1020. cursor = super(SQLUpdateCompiler, self).execute_sql(result_type)
File "/home/creation/.virtualenvs/s2s/local/lib/python2.7/site-packages/django/db/models/sql/compiler.py" in execute_sql
846. cursor.execute(sql, params)
File "/home/creation/.virtualenvs/s2s/local/lib/python2.7/site-packages/django/db/backends/util.py" in execute
41. return self.cursor.execute(sql, params)
File "/home/creation/.virtualenvs/s2s/local/lib/python2.7/site-packages/django/db/backends/mysql/base.py" in execute
122. six.reraise(utils.IntegrityError, utils.IntegrityError(*tuple(e.args)), sys.exc_info()[2])
File "/home/creation/.virtualenvs/s2s/local/lib/python2.7/site-packages/django/db/backends/mysql/base.py" in execute
120. return self.cursor.execute(query, args)
File "/home/creation/.virtualenvs/s2s/local/lib/python2.7/site-packages/MySQLdb/cursors.py" in execute
201. self.errorhandler(self, exc, value)
File "/home/creation/.virtualenvs/s2s/local/lib/python2.7/site-packages/MySQLdb/connections.py" in defaulterrorhandler
36. raise errorclass, errorvalue
Exception Type: IntegrityError at /admin/myapp/site-masschange/120,121,124,122,123,365,371,377,383,389/
Exception Value: (1062, "Duplicate entry '5-1-1' for key 'site_id_2'")
In development version of Django 1.9 mass-edit causes following error:
File "env19/src/django-mass-edit/massadmin/massadmin.py", line 34, in <module>
from django.contrib.admin.util import unquote
ImportError: No module named util
It is because modules with backward compatibility were removed - see [release notes](https://docs.djangoproject.com/en/dev/releases/1.9/)
from massedit.massedit import MassEditMixin
should be
from massadmin.massadmin import MassEditMixin
Default urls.py with a couple options only default admin setting and then massadmin, but getting an error message saying basically that can't reference .urls in massadmin. I have this setup in settings.py and i did end up having to import massadmin in urls.py to get the reference for massadmin to work. But not .urls
from django.conf.urls import patterns, include, url
from django.contrib import admin
from import massadmin import *
admin.autodiscover()
admin.site.site_header = "FireByte Networks"
urlpatterns = patterns('',
# Examples:
# url(r'^$', 'cms.views.home', name='home'),
# url(r'^blog/', include('blog.urls')),
url(r'^admin/', include(massadmin.urls)),
url(r'^admin/', include(admin.site.urls)),
)
I have a weird compatibility issue with django-autocomplete-light. When I try to mass edit the following model Select
button does nothing. Completely nothing. No messages, no errors in javascript console, nothing. I even tried to debug javascript code but it looks like submit action is never called. When I remove autocomplete_light.modelform_factory
it starts working as intended. Weird is that I have another model which uses autocomplete_light form and it works nicely with mass edit.
Model:
class ProductRelation(models.Model):
KIND_SIMILAR = 1
KIND_ACCESSORY = 2
KIND_GIFT = 3
RELATIONSHIP_KINDS = (
(KIND_SIMILAR, 'similar'),
(KIND_ACCESSORY, 'accessory'),
(KIND_GIFT, 'gift'),
)
parent_product = models.ForeignKey(Product, on_delete=models.CASCADE, related_name='parent_products')
child_product = models.ForeignKey(Product, on_delete=models.CASCADE, related_name='child_products')
kind = models.SmallIntegerField(choices=RELATIONSHIP_KINDS, default=KIND_SIMILAR, db_index=True)
Admin:
@admin.register(ProductRelation)
class ProductRelationAdmin(admin.ModelAdmin):
list_display = ['parent_product', 'child_product', 'kind']
list_display_links = ['parent_product', 'child_product']
form = autocomplete_light.modelform_factory(ProductRelation, exclude=['fake'])
Do you know if the red/green colors used by DS are 'color blind' friendly?
http://webdesign.about.com/od/accessibility/a/aa062804.htm
It throws a 500 error when I click save after I mass-edit 100 items or more.
I don't see anything in the logs.
Trying to make changes to boolean fields on a model; how I can debug/fix this:
Traceback:
File "/usr/local/lib/python2.7/dist-packages/django/core/handlers/base.py" in get_response
111. response = callback(request, *callback_args, **callback_kwargs)
File "/usr/local/lib/python2.7/dist-packages/django/contrib/admin/views/decorators.py" in _checklogin
16. return view_func(request, *args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/django_mass_edit-1.4-py2.7.egg/massadmin/massadmin.py" in mass_change_view
65. return ma.mass_change_view(request, object_ids)
File "/usr/local/lib/python2.7/dist-packages/django_mass_edit-1.4-py2.7.egg/massadmin/massadmin.py" in mass_change_view
193. raise Exception('Some of the selected objects could\'t be changed.')
Exception Type: Exception at /admin/foos/foo-masschange/2935,2937/
Exception Value: Some of the selected objects could't be changed.
I have some models with my own primary key definitions.
After trying to mass update i get error:
FieldError ....
Cannot resolve keyword 'id' into field.
.../massadmin/massadmin.py in mass_change_selected
...55. selected_int = queryset.values_list('id', flat=True)
I changed 'ID' to 'PK' in massadmin.py and it works:
..55. selected_int = queryset.values_list('pk', flat=True)
..56. #selected_int = queryset.values_list('id', flat=True)
Now, regular expression looks like
^admin/ (?P<app_name>[^/]+)/(?P<model_name>[^/]+)-masschange/(?P<object_ids>[0-9,]+)/$
so mass edit does not work with models using non-numeric primary key.
(removed the debug data because these were not relevant)
Exception Value: admin/serviceprobes/product/mass_change_form.html, admin/serviceprobes/mass_change_form.html, admin/mass_change_form.html
I installed django-mass-edit by pulling it from github and "sudo python setup.py install" as root. What am I doing wrong?
I wonder what is the point in this line:
django-mass-edit/massadmin/massadmin.py
Line 189 in f69a639
If I define custom change form for my model admin, mass edit becomes completely broken. If I remove this line from massadmin.py
everything returns to normal.
mass-edit correctly excludes unique fields from the form before it even gets created. What would be very helpful to prevent potential problems is to add a check to the form after its filled in (but before the change process is run) so that the 'unique_together' property in the model Meta is also validated.
For example, I have a Location type of model. Neither its 'name' or 'region' are individually unique, but the combination has to be. The mass-edit form should throw an error if a user tries to fill in both of those fields at the same time.
I have installed master and updated urls but I am not getting the mass edit form only a single form for the first object. Did a quick bit of debugging and everything seems to be reaching mass_change_view correctly. Any ideas?
I'm slightly new to Django so I'm not sure if this is my fault, but these models have been working fine. I get an error when I try to mass update them though.
NoReverseMatch at /admin/inventory/product/
Reverse for 'massadmin_change_view' with arguments '()' and keyword arguments '{'model_name': 'product', 'app_name': 'inventory', 'object_ids': 'MBX-99-888,SIZ-66-6666'}' not found. 1 pattern(s) tried: ['admin/(?P<app_name>[^/]+)/(?P<model_name>[^/]+)-masschange/(?P<object_ids>[\\w,\\.]+)/$']
Request Method: POST
Request URL: http://192.168.0.15:8005/admin/inventory/product/
Django Version: 1.10
Exception Type: NoReverseMatch
Exception Value:
Reverse for 'massadmin_change_view' with arguments '()' and keyword arguments '{'model_name': 'product', 'app_name': 'inventory', 'object_ids': 'MBX-99-888,SIZ-66-6666'}' not found. 1 pattern(s) tried: ['admin/(?P<app_name>[^/]+)/(?P<model_name>[^/]+)-masschange/(?P<object_ids>[\\w,\\.]+)/$']
Exception Location: /home/ryan/apps/kingsway/venv/lib/python3.4/site-packages/django/urls/resolvers.py in _reverse_with_prefix, line 389
Python Executable: /usr/bin/uwsgi
Python Version: 3.4.5
Python Path:
['.',
'',
'/home/ryan/apps/kingsway/venv/lib/python34.zip',
'/home/ryan/apps/kingsway/venv/lib64/python3.4',
'/home/ryan/apps/kingsway/venv/lib64/python3.4/plat-linux',
'/home/ryan/apps/kingsway/venv/lib64/python3.4/lib-dynload',
'/usr/lib64/python3.4',
'/usr/lib/python3.4',
'/home/ryan/apps/kingsway/venv/lib/python3.4/site-packages']
Server time: Fri, 6 Jan 2017 15:21:16 -0800
Traceback Switch to copy-and-paste view
/home/ryan/apps/kingsway/venv/lib/python3.4/site-packages/django/core/handlers/exception.py in inner
response = get_response(request) ...
▶ Local vars
/home/ryan/apps/kingsway/venv/lib/python3.4/site-packages/django/core/handlers/base.py in _legacy_get_response
response = self._get_response(request) ...
▶ Local vars
/home/ryan/apps/kingsway/venv/lib/python3.4/site-packages/django/core/handlers/base.py in _get_response
response = self.process_exception_by_middleware(e, request) ...
▶ Local vars
/home/ryan/apps/kingsway/venv/lib/python3.4/site-packages/django/core/handlers/base.py in _get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs) ...
▶ Local vars
/home/ryan/apps/kingsway/venv/lib/python3.4/site-packages/django/contrib/admin/options.py in wrapper
return self.admin_site.admin_view(view)(*args, **kwargs) ...
▶ Local vars
/home/ryan/apps/kingsway/venv/lib/python3.4/site-packages/django/utils/decorators.py in _wrapped_view
response = view_func(request, *args, **kwargs) ...
▶ Local vars
/home/ryan/apps/kingsway/venv/lib/python3.4/site-packages/django/views/decorators/cache.py in _wrapped_view_func
response = view_func(request, *args, **kwargs) ...
▶ Local vars
/home/ryan/apps/kingsway/venv/lib/python3.4/site-packages/django/contrib/admin/sites.py in inner
return view(request, *args, **kwargs) ...
▶ Local vars
/home/ryan/apps/kingsway/venv/lib/python3.4/site-packages/django/utils/decorators.py in _wrapper
return bound_func(*args, **kwargs) ...
▶ Local vars
/home/ryan/apps/kingsway/venv/lib/python3.4/site-packages/django/utils/decorators.py in _wrapped_view
response = view_func(request, *args, **kwargs) ...
▶ Local vars
/home/ryan/apps/kingsway/venv/lib/python3.4/site-packages/django/utils/decorators.py in bound_func
return func.__get__(self, type(self))(*args2, **kwargs2) ...
▶ Local vars
/home/ryan/apps/kingsway/venv/lib/python3.4/site-packages/django/contrib/admin/options.py in changelist_view
response = self.response_action(request, queryset=cl.get_queryset(request)) ...
▶ Local vars
/home/ryan/apps/kingsway/venv/lib/python3.4/site-packages/django/contrib/admin/options.py in response_action
response = func(self, request, queryset) ...
▶ Local vars
/home/ryan/apps/kingsway/venv/lib/python3.4/site-packages/massadmin/massadmin.py in mass_change_selected
"object_ids": ",".join(str(s) for s in selected)}) ...
▶ Local vars
/home/ryan/apps/kingsway/venv/lib/python3.4/site-packages/django/urls/base.py in reverse
return force_text(iri_to_uri(resolver._reverse_with_prefix(view, prefix, *args, **kwargs))) ...
▶ Local vars
/home/ryan/apps/kingsway/venv/lib/python3.4/site-packages/django/urls/resolvers.py in _reverse_with_prefix
(lookup_view_s, args, kwargs, len(patterns), patterns) ...
▶ Local vars
Request information
USER
ryan
GET
No GET data
POST
Variable Value
select_across
'0'
index
'0'
csrfmiddlewaretoken
'OvtfWkdznQIO5bWo5C9icnFO1WcSRQGl7rcNK3inwFGDF4SJgYyKnUJUjoIc2s9Z'
_selected_action
'SIZ-66-6666'
action
'mass_change_selected'
FILES
No FILES data
COOKIES
Variable Value
tabstyle
'html-tab'
sessionid
'zkrv0xhrewftu459e3i7tc0sdh9tnpnu'
gsScrollPos
''
csrftoken
'yzRMhyze1nq2XxQ6uXYHagmYb6q3M3htRvAk5hE2acoRxqMrFjn9lNq4tyWnXFK7'
META
Variable Value
CONTENT_LENGTH
'193'
CONTENT_TYPE
'application/x-www-form-urlencoded'
CSRF_COOKIE
'yzRMhyze1nq2XxQ6uXYHagmYb6q3M3htRvAk5hE2acoRxqMrFjn9lNq4tyWnXFK7'
DOCUMENT_ROOT
'/usr//html'
HTTP_ACCEPT
'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8'
HTTP_ACCEPT_ENCODING
'gzip, deflate'
HTTP_ACCEPT_LANGUAGE
'en-US,en;q=0.8,it;q=0.6'
HTTP_CACHE_CONTROL
'max-age=0'
HTTP_CONNECTION
'keep-alive'
HTTP_CONTENT_LENGTH
'193'
HTTP_CONTENT_TYPE
'application/x-www-form-urlencoded'
HTTP_COOKIE
('gsScrollPos=; sessionid=zkrv0xhrewftu459e3i7tc0sdh9tnpnu; '
'tabstyle=html-tab; '
'csrftoken=yzRMhyze1nq2XxQ6uXYHagmYb6q3M3htRvAk5hE2acoRxqMrFjn9lNq4tyWnXFK7')
HTTP_HOST
'192.168.0.15:8005'
HTTP_ORIGIN
'http://192.168.0.15:8005'
HTTP_REFERER
'http://192.168.0.15:8005/admin/inventory/product/'
HTTP_UPGRADE_INSECURE_REQUESTS
'1'
HTTP_USER_AGENT
('Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like '
'Gecko) Chrome/55.0.2883.87 Safari/537.36')
PATH_INFO
'/admin/inventory/product/'
QUERY_STRING
''
REMOTE_ADDR
'192.168.0.2'
REMOTE_PORT
'63802'
REQUEST_METHOD
'POST'
REQUEST_URI
'/admin/inventory/product/'
SCRIPT_NAME
''
SERVER_NAME
'kingsway.treasuremart.net'
SERVER_PORT
'8005'
SERVER_PROTOCOL
'HTTP/1.1'
uwsgi.core
33
uwsgi.node
b'ls4'
uwsgi.version
b'2.0.13.1'
wsgi.errors
<_io.TextIOWrapper name=2 mode='w' encoding='ANSI_X3.4-1968'>
wsgi.file_wrapper
''
wsgi.input
<uwsgi._Input object at 0x7fa52fbcb918>
wsgi.multiprocess
False
wsgi.multithread
True
wsgi.run_once
False
wsgi.url_scheme
'http'
wsgi.version
(1, 0)
Settings
Using settings module mysite.settings
Setting Value
ABSOLUTE_URL_OVERRIDES
{}
ACCOUNT_ACTIVATION_DAYS
90
ADMINS
[]
ALLOWED_HOSTS
[]
APPEND_SLASH
True
AUTHENTICATION_BACKENDS
['django.contrib.auth.backends.ModelBackend']
AUTH_PASSWORD_VALIDATORS
'********************'
AUTH_USER_MODEL
'auth.User'
BASE_DIR
'/home/ryan/apps/kingsway/content'
CACHES
{'default': {'BACKEND': 'django.core.cache.backends.locmem.LocMemCache'}}
CACHE_MIDDLEWARE_ALIAS
'default'
CACHE_MIDDLEWARE_KEY_PREFIX
'********************'
CACHE_MIDDLEWARE_SECONDS
600
CSRF_COOKIE_AGE
31449600
CSRF_COOKIE_DOMAIN
None
CSRF_COOKIE_HTTPONLY
False
CSRF_COOKIE_NAME
'csrftoken'
CSRF_COOKIE_PATH
'/'
CSRF_COOKIE_SECURE
False
CSRF_FAILURE_VIEW
'django.views.csrf.csrf_failure'
CSRF_HEADER_NAME
'HTTP_X_CSRFTOKEN'
CSRF_TRUSTED_ORIGINS
[]
DATABASES
{'default': {'ATOMIC_REQUESTS': False,
'AUTOCOMMIT': True,
'CONN_MAX_AGE': 0,
'ENGINE': 'django.db.backends.postgresql_psycopg2',
'HOST': 'localhost',
'NAME': 'kingsway',
'OPTIONS': {},
'PASSWORD': '********************',
'PORT': '5432',
'TEST': {'CHARSET': None,
'COLLATION': None,
'MIRROR': None,
'NAME': None},
'TIME_ZONE': None,
'USER': 'ryan'}}
DATABASE_ROUTERS
[]
DATA_UPLOAD_MAX_MEMORY_SIZE
2621440
DATA_UPLOAD_MAX_NUMBER_FIELDS
1000
DATETIME_FORMAT
'N j, Y, P'
DATETIME_INPUT_FORMATS
['%Y-%m-%d %H:%M:%S',
'%Y-%m-%d %H:%M:%S.%f',
'%Y-%m-%d %H:%M',
'%Y-%m-%d',
'%m/%d/%Y %H:%M:%S',
'%m/%d/%Y %H:%M:%S.%f',
'%m/%d/%Y %H:%M',
'%m/%d/%Y',
'%m/%d/%y %H:%M:%S',
'%m/%d/%y %H:%M:%S.%f',
'%m/%d/%y %H:%M',
'%m/%d/%y']
DATE_FORMAT
'N j, Y'
DATE_INPUT_FORMATS
['%Y-%m-%d',
'%m/%d/%Y',
'%m/%d/%y',
'%b %d %Y',
'%b %d, %Y',
'%d %b %Y',
'%d %b, %Y',
'%B %d %Y',
'%B %d, %Y',
'%d %B %Y',
'%d %B, %Y']
DEBUG
True
DEBUG_PROPAGATE_EXCEPTIONS
False
DECIMAL_SEPARATOR
'.'
DEFAULT_CHARSET
'utf-8'
DEFAULT_CONTENT_TYPE
'text/html'
DEFAULT_EXCEPTION_REPORTER_FILTER
'django.views.debug.SafeExceptionReporterFilter'
DEFAULT_FILE_STORAGE
'django.core.files.storage.FileSystemStorage'
DEFAULT_FROM_EMAIL
'[email protected]'
DEFAULT_INDEX_TABLESPACE
''
DEFAULT_TABLESPACE
''
DISALLOWED_USER_AGENTS
[]
EMAIL_BACKEND
'django.core.mail.backends.smtp.EmailBackend'
EMAIL_HOST
'localhost'
EMAIL_HOST_PASSWORD
'********************'
EMAIL_HOST_USER
''
EMAIL_PORT
25
EMAIL_SSL_CERTFILE
None
EMAIL_SSL_KEYFILE
'********************'
EMAIL_SUBJECT_PREFIX
'[Django] '
EMAIL_TIMEOUT
None
EMAIL_USE_SSL
False
EMAIL_USE_TLS
False
FILE_CHARSET
'utf-8'
FILE_UPLOAD_DIRECTORY_PERMISSIONS
None
FILE_UPLOAD_HANDLERS
['django.core.files.uploadhandler.MemoryFileUploadHandler',
'django.core.files.uploadhandler.TemporaryFileUploadHandler']
FILE_UPLOAD_MAX_MEMORY_SIZE
2621440
FILE_UPLOAD_PERMISSIONS
None
FILE_UPLOAD_TEMP_DIR
None
FIRST_DAY_OF_WEEK
0
FIXTURE_DIRS
[]
FORCE_SCRIPT_NAME
None
FORMAT_MODULE_PATH
None
IGNORABLE_404_URLS
[]
INSTALLED_APPS
('django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'registration',
'registration.supplements.default',
'base_registration',
'inventory',
'purchase_orders',
'invoicing',
'rest_framework',
'rest_framework.authtoken',
'massadmin')
INTERNAL_IPS
[]
LANGUAGES
[('af', 'Afrikaans'),
('ar', 'Arabic'),
('ast', 'Asturian'),
('az', 'Azerbaijani'),
('bg', 'Bulgarian'),
('be', 'Belarusian'),
('bn', 'Bengali'),
('br', 'Breton'),
('bs', 'Bosnian'),
('ca', 'Catalan'),
('cs', 'Czech'),
('cy', 'Welsh'),
('da', 'Danish'),
('de', 'German'),
('dsb', 'Lower Sorbian'),
('el', 'Greek'),
('en', 'English'),
('en-au', 'Australian English'),
('en-gb', 'British English'),
('eo', 'Esperanto'),
('es', 'Spanish'),
('es-ar', 'Argentinian Spanish'),
('es-co', 'Colombian Spanish'),
('es-mx', 'Mexican Spanish'),
('es-ni', 'Nicaraguan Spanish'),
('es-ve', 'Venezuelan Spanish'),
('et', 'Estonian'),
('eu', 'Basque'),
('fa', 'Persian'),
('fi', 'Finnish'),
('fr', 'French'),
('fy', 'Frisian'),
('ga', 'Irish'),
('gd', 'Scottish Gaelic'),
('gl', 'Galician'),
('he', 'Hebrew'),
('hi', 'Hindi'),
('hr', 'Croatian'),
('hsb', 'Upper Sorbian'),
('hu', 'Hungarian'),
('ia', 'Interlingua'),
('id', 'Indonesian'),
('io', 'Ido'),
('is', 'Icelandic'),
('it', 'Italian'),
('ja', 'Japanese'),
('ka', 'Georgian'),
('kk', 'Kazakh'),
('km', 'Khmer'),
('kn', 'Kannada'),
('ko', 'Korean'),
('lb', 'Luxembourgish'),
('lt', 'Lithuanian'),
('lv', 'Latvian'),
('mk', 'Macedonian'),
('ml', 'Malayalam'),
('mn', 'Mongolian'),
('mr', 'Marathi'),
('my', 'Burmese'),
('nb', 'Norwegian Bokmål'),
('ne', 'Nepali'),
('nl', 'Dutch'),
('nn', 'Norwegian Nynorsk'),
('os', 'Ossetic'),
('pa', 'Punjabi'),
('pl', 'Polish'),
('pt', 'Portuguese'),
('pt-br', 'Brazilian Portuguese'),
('ro', 'Romanian'),
('ru', 'Russian'),
('sk', 'Slovak'),
('sl', 'Slovenian'),
('sq', 'Albanian'),
('sr', 'Serbian'),
('sr-latn', 'Serbian Latin'),
('sv', 'Swedish'),
('sw', 'Swahili'),
('ta', 'Tamil'),
('te', 'Telugu'),
('th', 'Thai'),
('tr', 'Turkish'),
('tt', 'Tatar'),
('udm', 'Udmurt'),
('uk', 'Ukrainian'),
('ur', 'Urdu'),
('vi', 'Vietnamese'),
('zh-hans', 'Simplified Chinese'),
('zh-hant', 'Traditional Chinese')]
LANGUAGES_BIDI
['he', 'ar', 'fa', 'ur']
LANGUAGE_CODE
'en-us'
LANGUAGE_COOKIE_AGE
None
LANGUAGE_COOKIE_DOMAIN
None
LANGUAGE_COOKIE_NAME
'django_language'
LANGUAGE_COOKIE_PATH
'/'
LOCALE_PATHS
[]
LOGGING
{}
LOGGING_CONFIG
'logging.config.dictConfig'
LOGIN_REDIRECT_URL
'/accounts/profile/'
LOGIN_URL
'/accounts/login/'
LOGOUT_REDIRECT_URL
None
MANAGERS
[]
MEDIA_ROOT
''
MEDIA_URL
''
MESSAGE_STORAGE
'django.contrib.messages.storage.fallback.FallbackStorage'
MIDDLEWARE
None
MIDDLEWARE_CLASSES
('django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.auth.middleware.SessionAuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
'django.middleware.security.SecurityMiddleware')
MIGRATION_MODULES
{}
MONTH_DAY_FORMAT
'F j'
NUMBER_GROUPING
0
PASSWORD_HASHERS
'********************'
PASSWORD_RESET_TIMEOUT_DAYS
'********************'
PREPEND_WWW
False
REGISTRATION_ACCEPTANCE_EMAIL
True
REGISTRATION_ACTIVATION_EMAIL
True
REGISTRATION_BACKEND_CLASS
'registration.backends.default.DefaultRegistrationBackend'
REGISTRATION_DEFAULT_PASSWORD_LENGTH
'********************'
REGISTRATION_DJANGO_AUTH_URLS_ENABLE
True
REGISTRATION_DJANGO_AUTH_URL_NAMES_PREFIX
''
REGISTRATION_DJANGO_AUTH_URL_NAMES_SUFFIX
''
REGISTRATION_OPEN
True
REGISTRATION_REGISTRATION_EMAIL
True
REGISTRATION_REJECTION_EMAIL
True
REGISTRATION_SUPPLEMENT_ADMIN_INLINE_BASE_CLASS
'registration.admin.RegistrationSupplementAdminInlineBase'
REGISTRATION_SUPPLEMENT_CLASS
'base_registration.models.MyRegistrationSupplement'
REGISTRATION_USE_OBJECT_PERMISSION
False
REST_FRAMEWORK
{'DEFAULT_AUTHENTICATION_CLASSES': ('rest_framework.authentication.TokenAuthentication',
'rest_framework.authentication.SessionAuthentication'),
'DEFAULT_PERMISSION_CLASSES': ('rest_framework.permissions.IsAuthenticated',
'rest_framework.permissions.IsAdminUser')}
ROOT_URLCONF
'mysite.urls'
SECRET_KEY
'********************'
SECURE_BROWSER_XSS_FILTER
False
SECURE_CONTENT_TYPE_NOSNIFF
False
SECURE_HSTS_INCLUDE_SUBDOMAINS
False
SECURE_HSTS_SECONDS
0
SECURE_PROXY_SSL_HEADER
None
SECURE_REDIRECT_EXEMPT
[]
SECURE_SSL_HOST
None
SECURE_SSL_REDIRECT
False
SERVER_EMAIL
'root@localhost'
SESSION_CACHE_ALIAS
'default'
SESSION_COOKIE_AGE
1209600
SESSION_COOKIE_DOMAIN
None
SESSION_COOKIE_HTTPONLY
True
SESSION_COOKIE_NAME
'sessionid'
SESSION_COOKIE_PATH
'/'
SESSION_COOKIE_SECURE
False
SESSION_ENGINE
'django.contrib.sessions.backends.db'
SESSION_EXPIRE_AT_BROWSER_CLOSE
False
SESSION_FILE_PATH
None
SESSION_SAVE_EVERY_REQUEST
False
SESSION_SERIALIZER
'django.contrib.sessions.serializers.JSONSerializer'
SETTINGS_MODULE
'mysite.settings'
SHORT_DATETIME_FORMAT
'm/d/Y P'
SHORT_DATE_FORMAT
'm/d/Y'
SIGNING_BACKEND
'django.core.signing.TimestampSigner'
SILENCED_SYSTEM_CHECKS
[]
STATICFILES_DIRS
[]
STATICFILES_FINDERS
['django.contrib.staticfiles.finders.FileSystemFinder',
'django.contrib.staticfiles.finders.AppDirectoriesFinder']
STATICFILES_STORAGE
'django.contrib.staticfiles.storage.StaticFilesStorage'
STATIC_ROOT
'/home/ryan/apps/kingsway/content/static'
STATIC_URL
'/static/'
TEMPLATES
[{'APP_DIRS': True,
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [],
'OPTIONS': {'context_processors': ['django.template.context_processors.debug',
'django.template.context_processors.request',
'django.contrib.auth.context_processors.auth',
'django.contrib.messages.context_processors.messages']}}]
TEST_NON_SERIALIZED_APPS
[]
TEST_RUNNER
'django.test.runner.DiscoverRunner'
THOUSAND_SEPARATOR
','
TIME_FORMAT
'P'
TIME_INPUT_FORMATS
['%H:%M:%S', '%H:%M:%S.%f', '%H:%M']
TIME_ZONE
'America/Vancouver'
USE_ETAGS
False
USE_I18N
True
USE_L10N
True
USE_THOUSAND_SEPARATOR
False
USE_TZ
True
USE_X_FORWARDED_HOST
False
USE_X_FORWARDED_PORT
False
WSGI_APPLICATION
'mysite.wsgi.application'
X_FRAME_OPTIONS
'SAMEORIGIN'
YEAR_MONTH_FORMAT
'F Y'
_REGISTRATION_ADMIN_REQ_ATTR_NAME_IN_MODEL_INS
'_registration_admin_request'
You're seeing this error because you have DEBUG = True in your Django settings file. Change that to False, and Django will display a standard page generated by the handler for this status code.
model:
class Product(models.Model):
# Description
name = models.CharField(max_length=200)
description = models.TextField(blank=True)
# Price
price = models.DecimalField(max_digits=6, decimal_places=2, blank=True, null=True)
cost_markup = models.DecimalField(max_digits=6, decimal_places=2, blank=True, null=True)
cost_msrp = models.DecimalField(max_digits=6, decimal_places=2, blank=True, null=True)
cost_wholesale = models.DecimalField(max_digits=6, decimal_places=2, blank=True, null=True)
cost_distributor = models.DecimalField(max_digits=6, decimal_places=2, blank=True, null=True)
cost_discount_msrp = models.IntegerField(blank=True, null=True)
cost_discount_wholesale = models.IntegerField(blank=True, null=True)
cost_discount_distributor = models.IntegerField(blank=True, null=True)
# Specs
model = models.CharField(max_length=32, primary_key=True) # PRIMARY KEY
sku = models.CharField(max_length=32, blank=True) # Vendor Part Number
upc = models.BigIntegerField(blank=True, null=True)
slug = models.SlugField(('slug'), max_length=60, blank=True)
# Specs
dimensions_length = models.IntegerField(blank=True, null=True)
dimensions_width = models.IntegerField(blank=True, null=True)
dimensions_height = models.IntegerField(blank=True, null=True)
dimensions_depth = models.IntegerField(blank=True, null=True)
weight = models.DecimalField(max_digits=6, decimal_places=2, blank=True, null=True)
# Inventory
qty_on_hand = models.IntegerField(default=0)
# Data
active = models.BooleanField(default=False)
date_created = models.DateTimeField(
default=timezone.now, editable=False)
date_updated = models.DateTimeField(auto_now=True)
dwo_choices = ('Supplier', 'Us', 'Active')
dwo = models.CharField(choices=Choices(*dwo_choices), max_length=24, blank=True, default='Active')
# Selectors
themes = models.ManyToManyField( Theme, related_name='products', blank=True)
colors = models.ManyToManyField( Color, related_name='products', blank=True)
product_types = models.ManyToManyField( ProductType, related_name='products', blank=True)
designer = models.ForeignKey( Designer, related_name='products', blank=True, null=True)
brand = models.ForeignKey( Brand, related_name='products', blank=True, null=True)
product_class = models.ForeignKey( ProductClass, related_name='products', blank=True, null=True)
class Meta:
ordering = ['brand__name', 'name']
permissions = (("can_inv_mgmt", "Can manage inventory"),)
#Then override models save method:
def save(self, *args, **kwargs):
if not self.model:
#Only set the slug when the object is created.
self.slug = slugify(self.name) #Or whatever you want the slug to use
super(Product, self).save(*args, **kwargs)
def __str__(self):
return self.model
When many objects are selected for mass edit the URL string can get very long, especially if the model's primary key has many digits or id a uuid.
At some point the URL becomes too long and this will result in a server error.
I have created a pull request that addresses this issue (#62)
In some cases users would like to set passwords to be the same in mass.
Right now one can only set the password hash which end users don't understand.
dme is a very useful tool, but as our database has grown, so has the length of many of the drop-down lists & we have had to disable some to allow for reasonable page load times. Could there be some consideration given to allow dme to support django-selectable (http://django-selectable.readthedocs.org/en/latest/index.html) which allow for incremental lookups and thereby avoids the problems of loading large lists at page creation time? Thanks!
There isn't a license file for this project. The original was BSD so I would assume this is an extension. If you can confirm that would be great!
When I set the massadmin_exclude on some fields I get a issue with rendering the template.
Django Version: 1.5.4
Exception Type: KeyError
Exception Value: u"Key 'slug' not found in Form"
build\bdist.win32\egg\massadmin\massadmin.py in mass_change_view
return ma.mass_change_view(request, object_ids) ...
build\bdist.win32\egg\massadmin\massadmin.py in mass_change_view
adminForm = helpers.AdminForm(form, self.get_fieldsets(request, obj),
self.prepopulated_fields, self.get_readonly_fields(request, obj))
In files massadmin.py and urls.py is import:
from django.conf.urls import *
and for Django 1.3 must be:
from django.conf.urls.defaults import *
We are using a custom AdminSite, where the each_context()
is overridden to add some additional context variables. Our base_site.html
template then uses these variables. This causes an error when rendering the mass change view, because it doesn't include the context variables from the each_context()
function.
Here's an example showing how Django's default admin views use each_context()
: https://github.com/django/django/blob/2.2.11/django/contrib/admin/options.py#L1616
I will post a PR with a fix for this soon.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.