1515from django .utils .translation import ugettext_lazy as _
1616
1717from feincms import ensure_completely_loaded
18+ from feincms ._internal import get_model_name
1819
1920from mptt .forms import MPTTAdminForm
2021
@@ -23,12 +24,12 @@ class RedirectToWidget(ForeignKeyRawIdWidget):
2324 def label_for_value (self , value ):
2425 match = re .match (
2526 # XXX this regex would be available as .models.REDIRECT_TO_RE
26- r'^(?P<app_label>\w+).(?P<module_name >\w+):(?P<pk>\d+)$' ,
27+ r'^(?P<app_label>\w+).(?P<model_name >\w+):(?P<pk>\d+)$' ,
2728 value )
2829
2930 if match :
3031 matches = match .groupdict ()
31- model = get_model (matches ['app_label' ], matches ['module_name ' ])
32+ model = get_model (matches ['app_label' ], matches ['model_name ' ])
3233 try :
3334 instance = model ._default_manager .get (pk = int (matches ['pk' ]))
3435 return ' <strong>%s (%s)</strong>' % (
@@ -169,7 +170,7 @@ def clean(self):
169170 if redirect_to and re .match (r'^\d+$' , redirect_to ):
170171 opts = self .page_model ._meta
171172 cleaned_data ['redirect_to' ] = '%s.%s:%s' % (
172- opts .app_label , opts . module_name , redirect_to )
173+ opts .app_label , get_model_name ( opts ) , redirect_to )
173174
174175 if not cleaned_data ['active' ]:
175176 # If the current item is inactive, we do not need to conduct
0 commit comments