def validate_url(data, query):
"""
Checks if the given url contains the specified query. Used for custom url validation in the ModelForms
:param data: full url
:param query: string to search within the url
:return:
"""
if data and query not in data:
raise forms.ValidationError('Please enter a valid {} url'.format(query))
评论列表
文章目录