forked from wardi/django-filebrowser-no-grappelli
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request wardi#5 from vdboor/master
General improvements for the filebrowser in the Django admin
- Loading branch information
Showing
8 changed files
with
46 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
from django.conf.urls import patterns, url | ||
from django.contrib import admin | ||
from django.core.urlresolvers import reverse | ||
from django.http import HttpResponseRedirect | ||
from .models import FileBrowser | ||
|
||
|
||
class FileBrowserAdmin(admin.ModelAdmin): | ||
actions = [] | ||
|
||
def has_add_permission(self, request): | ||
return False | ||
|
||
def has_delete_permission(self, request, obj=None): | ||
return False | ||
|
||
def get_urls(self): | ||
info = self.model._meta.app_label, self.model._meta.module_name | ||
return patterns('', | ||
url('^$', self.admin_site.admin_view(self.filebrowser_view), name='{0}_{1}_changelist'.format(*info)), | ||
) | ||
|
||
def filebrowser_view(self, request): | ||
return HttpResponseRedirect(reverse('filebrowser:fb_browse')) | ||
|
||
|
||
admin.site.register(FileBrowser, FileBrowserAdmin) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,9 @@ | ||
# This file is only necessary for the tests to work | ||
from django.db import models | ||
from django.utils.translation import ugettext_lazy as _ | ||
|
||
|
||
class FileBrowser(models.Model): | ||
class Meta: | ||
managed = False | ||
verbose_name = _("FileBrowser") | ||
verbose_name_plural = _("FileBrowser") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters