Pull requests

#12 Declined
Repository
Deleted repository
Branch
default (80dc4614be79)
Repository
izi izi
Branch
default

Fixed url template tags with the string syntax required for Django 1.5 and available since 1.4

Author
  1. glic3rinu
Reviewers
Description

admin-tools breaks in Django 1.5 because it requires view names in url template tags to be strings (syntax available since 1.4)

Additional info from django 1.5 release notes:

One deprecated feature worth noting is the shift to “new-style” url tag. Prior to Django 1.3, syntax like {% url myview %} was interpreted incorrectly (Django considered "myview" to be a literal name of a view, not a template variable named myview). Django 1.3 and above introduced the {% load url from future %} syntax to bring in the corrected behavior where myview was seen as a variable.

The upshot of this is that if you are not using {% load url from future %} in your templates, you’ll need to change tags like {% url myview %} to {% url "myview" %}. If you were using {% load url from future %} you can simply remove that line under Django 1.5

Comments (5)

  1. Simon Litchfield

    Error under Django 1.5 -- "menu.bookmark: 'user' defines a relation with the model 'auth.User', which has been swapped out. Update the relation to point at settings.AUTH_USER_MODEL."

    1. glic3rinu author

      This is not related with this pull request but with swappable user model introduced also on 1.5. This has an easy fix which is import the user model like:

      try:
          from django.contrib.auth import get_user_model
      except ImportError: # django < 1.5
          from django.contrib.auth.models import User
      else:
          User = get_user_model()
      

      and also on migrations change all 'auth.User' by '%s.%s' % (User._meta.app_label, User._meta.object_name)

      EDIT: just created pull request #15 with the needed changes