Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

slug validator added to GroupForm #743

Merged
merged 2 commits into from Oct 1, 2018
Merged

slug validator added to GroupForm #743

merged 2 commits into from Oct 1, 2018

Conversation

Onitopheles
Copy link

Hello, I was testing your demo tendenci groups, and I found an issues with the "URL PATH", when you try to use '/' in the text field and it displays an "Oops admin error".

screenshot-demo tendenci com-2018 09 25-22-09-02

so, I try to make a fix for that using forms.py in user_groups app folder adding these lines of code

from tendenci.apps.base.fields import SlugField to import tendenci SlugField from tendenci

and added this line to class GroupForm(TendenciBaseForm)

slug = forms.SlugField(label=_("URL Path"))

that works for me but, I'd like to know if you have some advices to fix it properly.

@jennyq jennyq merged commit e8b2bbb into tendenci:tendenci7 Oct 1, 2018
@jennyq
Copy link
Member

jennyq commented Oct 1, 2018

Hi @GfBot,
I cannot replicate the issue https://demo.tendenci.com/groups/add/. The demo site gets recreated every 30 minutes, it's likely the error was due to the site was being removed and recreated. Have you tried again?

Although the slug field is not specified in the GroupForm, it is specified as SlugField for the Group class in the models.py. Thus it does use the validators for tendenci.apps.base.fields.SlugField. But I see you changed it to use django's forms.SlugField which I think is better. Thanks!

@Onitopheles
Copy link
Author

Onitopheles commented Oct 3, 2018

@jennyq Hello, thanks for the feedback, if you want to reproduce this error you have to create a group, and then when you're in the "URL Path" field, you have to use a slash for that for ex: "testing-group/error-slug" or something like this using a slash and that will reproduce that error.

@Onitopheles Onitopheles deleted the gfbot/slugurl_groups_fixed branch October 9, 2018 21:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants