django-grappelli

Django Admin Column Sort Descending

白昼怎懂夜的黑 提交于 2019-12-11 01:35:55
问题 When using Django admin with grappelli I would like that a click on a column header will sort the table by descending order. (I don't want a default ordering to the columns by defining the ordering field in the Model Meta Class.) The default behavior is Ascending. The first click should order like this: 回答1: Rewrite the def result_headers(cl) add these 2 lines: ..... ..... th_classes = ['sortable'] order_type = '' #new lines default_order_type = getattr(attr, "admin_order_first_type", None)

Django grappelli seems unable to see all its media files

て烟熏妆下的殇ゞ 提交于 2019-12-10 14:01:10
问题 I have django 1.4 and grappelli 2.4.3 running on an Ubuntu server, which I'm viewing over a Windows networked system when in production. Everything works fine on the development server when I view it on the Ubuntu machine using RDP. The relevant parts of settings.py are: STATIC_ROOT = os.path.join(os.path.dirname(__file__), '../03_static_files/collected/') STATIC_URL = '/static/' STATICFILES_DIRS = ( # Put strings here, like "/home/html/static" or "C:/www/django/static". # Always use forward

Django Grappelli Autocomplete M2M

青春壹個敷衍的年華 提交于 2019-12-08 03:34:48
问题 I followed the docs down to the letter and can't get the M2M autocomplete lookup to work in Grappelli. #models.py #main model class Entry(models.Model): title = models.CharField(max_length=60) content = models.TextField() keywords = models.ManyToManyField(Keyword, blank=True) #model I want to be searched through while typing in the autocomplete field class Keyword(models.Model): name = models.CharField(max_length=30) @staticmethod def autocomplete_search_field(): return ('id__iexact', 'name_

Django Grappelli Autocomplete M2M

☆樱花仙子☆ 提交于 2019-12-06 15:44:32
I followed the docs down to the letter and can't get the M2M autocomplete lookup to work in Grappelli. #models.py #main model class Entry(models.Model): title = models.CharField(max_length=60) content = models.TextField() keywords = models.ManyToManyField(Keyword, blank=True) #model I want to be searched through while typing in the autocomplete field class Keyword(models.Model): name = models.CharField(max_length=30) @staticmethod def autocomplete_search_field(): return ('id__iexact', 'name__icontains',) def __str__(self): return '%s' % (self.name) then in admin.py : class EntryAdmin(admin

Django-grappelli admin: No reverse match error

孤人 提交于 2019-12-05 00:17:12
I've been working on a django project for a while now that uses grappelli for the admin and all of a sudden today my change_form.html template is throwing the following error: Caught NoReverseMatch while rendering: Reverse for "grp_related_lookup" with arguments '()' and keyword arguments '{}' not found. The offending line of code is line 38: 37 $.each(related_lookup_fields_fk, function() { 38 $("#id_" + this).grp_related_fk({lookup_url:"{% url grp_related_lookup %}"}); 39 }); which is preceded by this bit of code: var related_lookup_fields_fk = {% get_related_lookup_fields_fk adminform.model

Django Grappelli Tabular Inline add new row TinyMCE textfield not editable

杀马特。学长 韩版系。学妹 提交于 2019-12-03 12:20:58
I am using django Grappelli skin for my project. I have a ModelAdmin with tabular inline function. I use extra = 0 to prevent auto insert blank row, when the page is loaded. It works fine. Now, when I click on the + sign to insert new row, the row is loaded, but the tinymce textfield is not editable. Anyone know what is the reasons and how to solve this problem? After reading the document: http://django-grappelli.readthedocs.org/en/latest/customization.html#using-tinymce I notice: Using TinyMCE with Inlines is a bit more tricky because of the hidden empty-form. You need to write a custom

django-cms + grappelli

北慕城南 提交于 2019-12-01 16:19:52
If anyone knows how to make django-cms play with grappelli, please give some tips Well I've just gone through a fairly epic adventure, the story of which might be of some use to you. The end point of said adventure was getting django-cms 2.1.3 working with django-filebrowser-no-grappelli . Whilst that may sound in fact like the opposite of what you want, I ended up there because what I really wanted was to get django-cms working with filebrowser. Without grappelli though the standard django-filebrowser does not work as expected. But with grappelli django-cms does not work as expected. So

How to filter a dropdownlist in Django's admin when a selection is made on another dropdownlist

旧时模样 提交于 2019-12-01 03:45:58
I have two dropdownlists in a Django admin site. For example, I have SelectCountry and SelectRegion. Region has a foreignkey relationship to Country. How do I ensure that when a Country is selected, the Regions are filtered based on that Country? N.B: I am using django-grappelli for my admin backend as well. Any ideas will be appreciated. Thanks. As DrMeers hints at, use django-smart-selects . No point in re-inventing the wheel. 来源: https://stackoverflow.com/questions/9853595/how-to-filter-a-dropdownlist-in-djangos-admin-when-a-selection-is-made-on-anoth

No module named Image

删除回忆录丶 提交于 2019-11-28 23:16:17
Sorry for my grammar, I don't speak English. After I set filebrowser, tinymce, and grappelli, I get this error: No module named Image try: from PIL import Image except ImportError: import Image I set it to PIL but it didn't solve the problem. my platform windows If i want: pip install PIL `c:\Users\Kim\BitNami DjangoStack projects\homex8>pip install PIL Downloading/unpacking PIL Running setup.py egg_info for package PIL WARNING: '' not a valid package name; please use only.-separated package names in setup.py Installing collected packages: PIL Running setup.py install for PIL WARNING: '' not a

No module named Image

无人久伴 提交于 2019-11-27 13:53:48
问题 Sorry for my grammar, I don't speak English. After I set filebrowser, tinymce, and grappelli, I get this error: No module named Image try: from PIL import Image except ImportError: import Image I set it to PIL but it didn't solve the problem. my platform windows If i want: pip install PIL `c:\Users\Kim\BitNami DjangoStack projects\homex8>pip install PIL Downloading/unpacking PIL Running setup.py egg_info for package PIL WARNING: '' not a valid package name; please use only.-separated package