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
SRCT
go
Commits
1b9367ad
Commit
1b9367ad
authored
Jan 02, 2017
by
David Haynes
Browse files
More spaces added in models.py
- for extra readibility
parent
3170766d
Changes
1
Hide whitespace changes
Inline
Side-by-side
go/go/models.py
View file @
1b9367ad
...
...
@@ -75,22 +75,22 @@ class URL(models.Model):
# Who is the owner of this Go link
owner
=
models
.
ForeignKey
(
RegisteredUser
)
# When was this link created?
date_created
=
models
.
DateTimeField
(
default
=
timezone
.
now
)
date_created
=
models
.
DateTimeField
(
default
=
timezone
.
now
)
# What is the target URL for this Go link
target
=
models
.
URLField
(
max_length
=
1000
)
target
=
models
.
URLField
(
max_length
=
1000
)
# What is the actual go link (short url) for this URL
short
=
models
.
SlugField
(
max_length
=
20
,
primary_key
=
True
)
short
=
models
.
SlugField
(
max_length
=
20
,
primary_key
=
True
)
# how many people have visited this Go link
clicks
=
models
.
IntegerField
(
default
=
0
)
clicks
=
models
.
IntegerField
(
default
=
0
)
# how many people have visited this Go link through the qr code
qrclicks
=
models
.
IntegerField
(
default
=
0
)
qrclicks
=
models
.
IntegerField
(
default
=
0
)
# how many people have visited the go link through social media
socialclicks
=
models
.
IntegerField
(
default
=
0
)
socialclicks
=
models
.
IntegerField
(
default
=
0
)
# does this Go link expire on a certain date
expires
=
models
.
DateTimeField
(
blank
=
True
,
null
=
True
)
expires
=
models
.
DateTimeField
(
blank
=
True
,
null
=
True
)
# print(URL)
def
__str__
(
self
):
...
...
@@ -112,7 +112,7 @@ class URL(models.Model):
tries
=
1
while
tries
<
100
:
try
:
URL
.
objects
.
get
(
short__iexact
=
short
)
URL
.
objects
.
get
(
short__iexact
=
short
)
tries
+=
1
cache
.
incr
(
"hashids_counter"
)
except
URL
.
DoesNotExist
as
ex
:
...
...
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