Test coverage report: permission.admin.views

# permission.admin.views: 15 total statements, 0.0% covered

Generated: Thu 2012-03-01 12:13 CST

Source file: /home/alisue/Dropbox/Codes/django-permission/permission/admin/views.py

Stats: 0 executed, 11 missed, 4 excluded, 7 ignored

1. `from django.db import transaction`
2. `from django.http import HttpResponseRedirect`
3. `from django.contrib.contenttypes.models import ContentType`
4. ``
5. `from . import PermissionRoleAdmin`
6. `@transaction.commit_on_success`
7. `def admin_move_ordered_model(request, direction, model_type_id, model_id):`
8. `if direction == "up":`
9. `PermissionRoleAdmin.move_up(model_type_id, model_id)`
10. `else:`
11. `PermissionRoleAdmin.move_down(model_type_id, model_id)`
12. ``
13. `ModelClass = ContentType.objects.get(id=model_type_id).model_class()`
14. ``
15. `app_label = ModelClass._meta.app_label`
16. `model_name = ModelClass.__name__.lower()`
17. ``
18. `redirect_url = request.META.get('HTTP_REFERER')`
19. `if redirect_url is None:`
20. `redirect_url = "/admin/%s/%s/" % (app_label, model_name)`
21. ``
22. `return HttpResponseRedirect(redirect_url)`