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

Merge branch 'dev'

parents 1554e64d fd91fa0c
......@@ -6,6 +6,9 @@ Go is a drop-in URL shortening service. It aims to provide an easily
branded service for institutions that wish to widely disseminate
information without unnecessarily outsourcing branding.
## To D0
* qr codes on links view-- need to save the pictures somewhere, render inline as well as in different formats and sizes for download, and be deleted along with the links
## Configuration
### settings.py
......
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
......@@ -20,11 +21,14 @@ class URL( models.Model ):
expires = models.DateTimeField( blank = True, null = True )
def __unicode__(self):
return '<URL: %s>' % self.short
return '<%s : %s>' % (self.owner.username, self.target)
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
......
......@@ -54,7 +54,6 @@ def error_500(request):
},
)
##############################################################################
"""
Define user views here.
......@@ -137,6 +136,7 @@ def view(request, short):
"""
url = get_object_or_404(URL, short__iexact = short)
return render(request, 'view.html', {
'url': url,
},
......
......@@ -7,3 +7,6 @@ DB_HOST =
PIWIK_SITE_ID =
PIWIK_URL =
# Do not include a final slash!
SERVERURL =
......@@ -13,7 +13,7 @@ import secret
import os
BASE_DIR = os.path.dirname(os.path.dirname(__file__))
DEBUG = True
DEBUG = False
TEMPLATE_DEBUG = DEBUG
ADMINS = (
......@@ -69,6 +69,7 @@ MEDIAFILES_DIRS = (
STATIC_URL = '/static/'
STATIC_ROOT = os.path.join(BASE_DIR, 'static/')
STATICFILES_DIRS = (
'static/',
)
......@@ -130,6 +131,7 @@ INSTALLED_APPS = (
'piwik',
# Uncomment the next line to enable the admin:
'django.contrib.admin',
'qrcode',
# Uncomment the next line to enable admin documentation:
# 'django.contrib.admindocs',
)
......@@ -219,3 +221,6 @@ AUTH_LDAP_ALWAYS_UPDATE_USER = True
# Piwik settings.
PIWIK_SITE_ID = secret.PIWIK_SITE_ID
PIWIK_URL = secret.PIWIK_URL
SERVERURL = secret.SERVERURL
......@@ -53,10 +53,14 @@ body { /* HTML body */
width: inherit;
margin: auto;
table-layout: fixed;
/* Margin wasn't previously a thing. */
margin-bottom: 10px;
/* This border call was previously in the next chunk. */
border: 1px dashed #000000;
}
.link-box p {
border: 1px dashed #000000;
text-align: left;
padding-bottom: 5px;
padding-top: 5px;
......
{% load go_extras %}
{% load qr_tags %}
<div class="link-box">
<p>
<p class="link">
<strong>Long:</strong> <a href="{{url.target}}">{{url.target}}</a>
<br />
......@@ -23,4 +25,9 @@
</strong>
{% endif %}
</p>
<p class="qr">
{% qr_from_text url.get_absolute_url 100 %}
</p>
</div>
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