URL field does not show up in Admin when editing a link

81 views
Skip to first unread message

Christopher Vo

unread,
Oct 11, 2014, 11:37:41 PM10/11/14
to mezzani...@googlegroups.com
I am using Mezzanine 3.1.10

The attached screen shot shows the problem. Notice how there is no "URL" field when I try to edit a link.
Is there any reason why this would happen?
Screenshot from 2014-10-11 23:28:54.png

Christopher Vo

unread,
Oct 12, 2014, 12:23:04 AM10/12/14
to mezzani...@googlegroups.com
I even went into the Mezzanine source code:

At mezzanine/pages/admin.py:224
Added the line "print fieldsets"

And verified that 'slug' appears among the fieldsets! But it still doesn't display on the admin....

Josh Cartmell

unread,
Oct 15, 2014, 9:47:45 AM10/15/14
to mezzani...@googlegroups.com
That's strange, it always shows for me.  Could there be some stray javascript that is hiding it?

Is it present in the page source?

--
You received this message because you are subscribed to the Google Groups "Mezzanine Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mezzanine-use...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Christopher Vo

unread,
Oct 15, 2014, 10:19:36 AM10/15/14
to mezzani...@googlegroups.com
Yes, in fact, you can see it in the page source.

Christopher Vo

--
You received this message because you are subscribed to a topic in the Google Groups "Mezzanine Users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/mezzanine-users/qKrpWVmrcgw/unsubscribe.
To unsubscribe from this group and all its topics, send an email to mezzanine-use...@googlegroups.com.

Christopher Vo

unread,
Oct 15, 2014, 10:27:49 AM10/15/14
to mezzani...@googlegroups.com
I found where it's happening in the source output:

<link rel="stylesheet" href="/static/mezzanine/css/admin/global.css">
<style>
    /* These are set in PageAdmin's view methods, and mezzanine.core.admin.SingletonAdmin */
    .slug {display:none !important;}
</style>
<script>

Christopher Vo

Josh Cartmell

unread,
Oct 15, 2014, 10:32:42 AM10/15/14
to mezzani...@googlegroups.com
I'm not sure why that's there.

It's not present on the dev site, mezzanine.jupo.org/admin

Could you try creating a completely vanilla project and see if it's still happening?

Christopher Vo

unread,
Oct 15, 2014, 10:35:38 AM10/15/14
to mezzani...@googlegroups.com
And here is where it's happening in the PageAdmin's view methods.
Apparently it hides the slug field if you have overridden it. 
I'm not sure why that would make sense.

kwargs["extra_context"].update({
    "hide_delete_link": not content_model.can_delete(request),
    "hide_slug_field": content_model.overridden(),
})

Christopher Vo

Josh Cartmell

unread,
Oct 15, 2014, 11:14:42 AM10/15/14
to mezzani...@googlegroups.com
I'm not sure why I didn't think of this before, but I think I understand what is happening now.  If the slug field matches a url somewhere in a urls.py Mezzanine hides it.  This is to prevent an admin user modifying it, not realizing the slug needs to match the url.

Does the url you set match an existing url?

Christopher Vo

unread,
Oct 15, 2014, 11:19:39 AM10/15/14
to mezzani...@googlegroups.com
Yes, this seems to be what is happening. It's linked to an existing url and so it's preventing its modification.
Now that I think of it, this is a desirable behavior on a production site.
Thanks for your help Josh. 

Christopher Vo

Josh Cartmell

unread,
Oct 15, 2014, 2:15:11 PM10/15/14
to mezzani...@googlegroups.com
No problem, I think someday it would be nice to update it so there was a setting somewhere that would toggle this behavior, that way if you really did know what you were doing and had accidentally set a slug that overlapped a URL you could fix it without having to mess with the database directly.

Good luck!

Christopher Vo

unread,
Oct 15, 2014, 3:02:14 PM10/15/14
to mezzani...@googlegroups.com

Or perhaps "greyed out" so you can't edit it but at least you know where the link points to. That was the main problem for me; the end user wanted to know what the link was pointing to but it wouldn't even show in the admin.

Christopher Vo

Wim Feijen

unread,
May 28, 2017, 6:13:08 AM5/28/17
to Mezzanine Users
Hi all,

I ran into the same problem. I find it confusing that we sometimes hide the link, the more so when we have trouble explaining what happened.  

My proposal is to just show the url all the time, and point out that: "Things might break when you change this. Don't change it unless you know what you are doing." in the help_text.

In my case, the end user is smart and knows what he is doing. And urls were pointing at the live site in stead of the test site, while still remaining hidden so the end user could not solve it.

I would rather give a warning than create limitations.

Let me know if you find this desirable and I will make a pull request when I find time.

Wim 
Reply all
Reply to author
Forward
0 new messages