Commit a310f439 authored by Jean Michel Rouly's avatar Jean Michel Rouly
Browse files

Generate correct absolute url for urls models

parent 8e1f9ce8
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)
def generate_valid_short():
selection = string.ascii_lowercase + string.digits
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment