Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Christopher M Reffett
go
Commits
a310f439
Commit
a310f439
authored
Mar 31, 2014
by
Jean Michel Rouly
Browse files
Generate correct absolute url for urls models
parent
8e1f9ce8
Changes
1
Hide whitespace changes
Inline
Side-by-side
go/go/models.py
View file @
a310f439
from
django.db
import
models
from
django.contrib.auth.models
import
User
from
django.utils
import
timezone
from
django.conf
import
settings
import
random
,
string
...
...
@@ -25,6 +26,9 @@ class URL( models.Model ):
class
Meta
:
ordering
=
[
'short'
]
def
get_absolute_url
(
self
):
return
"%s/%s"
%
(
settings
.
SERVERURL
,
self
.
short
)
@
staticmethod
def
generate_valid_short
():
selection
=
string
.
ascii_lowercase
+
string
.
digits
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment