I'm doing some stuff on 'clean' on an admin ModelForm:
class MyAdminForm(forms.ModelForm):
def clean(self):
# Some stuff happens...
request.user.message_set.create(message="Some stuff happened")
class MyAdmin(admin.ModelAdmin):
form = MyAdminForm
Other than the threadlocals hack - how do I access request.user ...
I'm trying to use django-tinymce to make fields that are editable through Django's admin with a TinyMCE field. I am using tinymce.models.HTMLField as the field for this.
The problem is it's not working. I get a normal textarea. I check the HTML source, and it seems like all the code needed for TinyMCE is there. I also confirmed that the...
I can override edit_inline/tabular.html if I save it in my overall template directory ( let's say mysite/templates/admin/edit_inline/tabular.html ) , but when I try to save it with other admin template, like change_form.html ( in mysite/myapp/templates/admin/myapp/mymodel/change_form.html, it doesn't work.
Any thoughts?
Thanks!
...
I am writing a custom action for django admin. This action should only work for records having particular state.
For example "Approve Blog" custom action should approve user blog only when blog is not approved. And it must not appove rejected blogs.
One option is to filter non approved blogs and then approve them. But there are still...
In Django admin, how can I increase the width of the ManyToMany field's widget when using filter_horizontal?
...
Hello,
I just want to add the subscription date in the User list in the Django CRUD Administration site.
How can I do that ?
Thank you for your help
...
I'd like to extend/subclass admin Groups & Users classes in Django.
CourseAdmin group should be doing what admin can do, and they have extra information like email, phone, address.
CourseAdmin should be able to create CourseAdmins, Teachers, Courses and Students.
Teacher should be able to edit courses and students belong to them. They ...
How to add the forgot-password feature to Django admin site? With email/security question options? Is there any plug-in/extension available?
...
There was a nearly similar question: http://stackoverflow.com/questions/1160030/how-to-make-email-field-unique-in-model-user-from-contrib-auth-in-django
The solution was not perfect: Validating email for uniqueness. The solution provided is rather funny. It disallows modifications to User that leave email intact. How to fix it? Thanks i...
I have Admin User extended/subclassed by Teacher class.
How to prevent Teachers from seeing and changing other Teachers' profile data and Teachers are able to change their own records/rows only? Thanks in advance!
...
By default Django admin site shows all records of a related model/table for viewing. How can I show only the records that meet certain criteria?
...
I'm trying to make a django upload progress bar within the django admin.
The application is only a small part of the project, therefor I do not want to set the custom upload handler in the settings.py.
The upload_handler can be set with request.upload_handlers.insert(0, UploadProgressHandler(request)) but not within the add_view of the ...
Looking for some implementation ideas here. I am trying to design a custom polling system for my school, to allow teachers to give students polls to take.
I have a Poll model, Question model (with a foreignkey to Poll model), and Choice model (with a foreignkey to the Question model).
What I need to be able to do is allow whoever is ad...
I'm creating a multiple-tenant application that won't use any of the standard Django Admin (except for internal use which will have access to all tenants... that's simple enough). I'm trying to create an authorization system of my own and I'm not interested in using the standard User model (or any built-in application's model). My applic...
In chapter 8 of the Django book there is an example showing a fundamental view wrap method, which receives another view method passed in from any single arbitrary URLconf:
def requires_login(view):
def new_view(request, *args, **kwargs):
if not request.user.is_authenticated():
return HttpResponseRedirect('/accoun...
I want to be able to provide a list of possible values when entering a text field in django admin. I have a legacy database so I can't add a new model and reference that.
Could I provide something like:
possible_values = ['one','two',three']
to the fieldsets tuple, for a particular field in model handler?
Sorry for the newbie quest...
Hi everybody, I wonder if there is a way to override Django admin's submit_line buttons for a specific model, so that instead of showing the save & save and add another options they show send mail or save draft and actually work...
Thanks a million!
...
I have a django site with a large customer base. I would like to give our customer service department the ability to alter normal user accounts, doing things like changing passwords, email addresses, etc. However, if I grant someone the built-in auth | user | Can change user permission, they gain the ability to set the is_superuser flag ...
Suppose I have a model Animal. Animals have a field species which can either be "Lion" or "Dolphin".
The AnimalAdmin should have two views, add_lion_view() and add_dolphin_view(), which call the standard add_view() method after making sure that either species is going to be added.
I used to do this by setting the an AnimalAdmin instan...
The Django docs only list examples for overriding save() and delete(). However, I'd like to define some extra processing for my models only when they are created. For anyone familiar with Rails, it would be the equivalent to creating a :before_create filter. Is this possible?
...