models.py 501 Bytes
Newer Older
1
from django.db import models
Jean Michel Rouly's avatar
Jean Michel Rouly committed
2
3
from django.contrib.auth.models import User
from django.utils import timezone
4
5

# Create your models here.
Jean Michel Rouly's avatar
Jean Michel Rouly committed
6
7
8
9
10
class URL( models.Model ):
    owner = models.OneToOneField( User )
    date_created = models.DateTimeField( default=timezone.now() )

    target = models.CharField( max_length = 1000 )
11
    short = models.CharField( primary_key = True, max_length = 50 )
Jean Michel Rouly's avatar
Jean Michel Rouly committed
12
    clicks = models.IntegerField( default = 0 )
13
    expires = models.DateTimeField( blank = True, null = True )