Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
AKPlanning
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Aaron -
AKPlanning
Commits
6ccebcb5
Commit
6ccebcb5
authored
5 years ago
by
Nadja Geisler
Browse files
Options
Downloads
Patches
Plain Diff
ensure generated short_name is unique with event
parent
2d9a1b2c
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
AKModel/models.py
+1
-1
1 addition, 1 deletion
AKModel/models.py
AKSubmission/forms.py
+10
-0
10 additions, 0 deletions
AKSubmission/forms.py
with
11 additions
and
1 deletion
AKModel/models.py
+
1
−
1
View file @
6ccebcb5
...
@@ -72,7 +72,7 @@ class AKOwner(models.Model):
...
@@ -72,7 +72,7 @@ class AKOwner(models.Model):
if
not
AKOwner
.
objects
.
filter
(
slug
=
slug_candidate
).
exists
():
if
not
AKOwner
.
objects
.
filter
(
slug
=
slug_candidate
).
exists
():
break
break
digits
=
len
(
str
(
i
))
digits
=
len
(
str
(
i
))
slug_candidate
=
'
{}-{}
'
.
format
(
slug_candidate
[:
-
digits
+
1
],
i
)
slug_candidate
=
'
{}-{}
'
.
format
(
slug_candidate
[:
-
(
digits
+
1
)
],
i
)
self
.
slug
=
slug_candidate
self
.
slug
=
slug_candidate
...
...
This diff is collapsed.
Click to expand it.
AKSubmission/forms.py
+
10
−
0
View file @
6ccebcb5
import
itertools
from
django
import
forms
from
django
import
forms
from
django.core.exceptions
import
ValidationError
from
django.core.exceptions
import
ValidationError
from
django.utils.translation
import
ugettext_lazy
as
_
from
django.utils.translation
import
ugettext_lazy
as
_
...
@@ -76,6 +78,14 @@ class AKForm(forms.ModelForm):
...
@@ -76,6 +78,14 @@ class AKForm(forms.ModelForm):
short_name
=
short_name
.
partition
(
'
:
'
)[
0
]
short_name
=
short_name
.
partition
(
'
:
'
)[
0
]
short_name
=
short_name
.
partition
(
'
-
'
)[
0
]
short_name
=
short_name
.
partition
(
'
-
'
)[
0
]
short_name
=
short_name
.
partition
(
'
(
'
)[
0
]
short_name
=
short_name
.
partition
(
'
(
'
)[
0
]
for
i
in
itertools
.
count
(
1
):
if
not
AK
.
objects
.
filter
(
short_name
=
short_name
,
event
=
self
.
cleaned_data
[
"
event
"
]).
exists
():
break
print
(
short_name
)
digits
=
len
(
str
(
i
))
print
(
digits
)
short_name
=
'
{}-{}
'
.
format
(
short_name
[:
-
(
digits
+
1
)],
i
)
print
(
short_name
)
cleaned_data
[
"
short_name
"
]
=
short_name
[:
AK
.
_meta
.
get_field
(
'
short_name
'
).
max_length
]
cleaned_data
[
"
short_name
"
]
=
short_name
[:
AK
.
_meta
.
get_field
(
'
short_name
'
).
max_length
]
# Get tag names from raw tags
# Get tag names from raw tags
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment