Merge branch 'master' of github.com:Gluejar/regluit into goodreads

pull/1/head
Raymond Yee 2011-11-18 10:03:36 -08:00
commit a1eee9682c
10 changed files with 54 additions and 10 deletions

View File

@ -61,6 +61,7 @@ Below are the steps for getting regluit running on EC2 with Apache and mod_wsgi,
1. `pip install -r requirements.pip`
1. `echo "/opt/" > ENV/lib/python2.7/site-packages/regluit.pth`
1. `django-admin.py syncdb --migrate --settings regluit.settings.prod`
1. `django-admin.py collectstatic --settings regluit.settings.prod`
1. `sudo ln -s /opt/regluit/deploy/regluit.conf /etc/apache2/sites-available/regluit`
1. `sudo a2ensite regluit`
1. `sudo /etc/init.d/apache2 restart`

10
core/lookups.py Normal file
View File

@ -0,0 +1,10 @@
from selectable.base import ModelLookup
from selectable.registry import registry
from django.contrib.auth.models import User
class OwnerLookup(ModelLookup):
model = User
search_field = 'username__icontains'
registry.register(OwnerLookup)

View File

@ -11,4 +11,4 @@ WSGIScriptAlias / /opt/regluit/deploy/regluit.wsgi
Allow from all
</Directory>
Alias /static /opt/regluit/static
Alias /static /var/www/static

View File

@ -2,8 +2,12 @@ from django import forms
from django.db import models
from django.contrib.auth.models import User
from django.utils.translation import ugettext_lazy as _
from decimal import Decimal as D
from selectable.forms import AutoCompleteSelectWidget,AutoCompleteSelectField
from regluit.core.models import UserProfile, RightsHolder, Claim
from regluit.core.lookups import OwnerLookup
class ClaimForm(forms.ModelForm):
i_agree=forms.BooleanField()
@ -13,6 +17,13 @@ class ClaimForm(forms.ModelForm):
widgets = { 'user': forms.HiddenInput, 'work': forms.HiddenInput }
class RightsHolderForm(forms.ModelForm):
owner = AutoCompleteSelectField(
OwnerLookup,
label='Owner',
widget=AutoCompleteSelectWidget(OwnerLookup),
required=True,
)
class Meta:
model = RightsHolder
@ -20,10 +31,10 @@ class RightsHolderForm(forms.ModelForm):
rights_holder_name = self.data["rights_holder_name"]
try:
RightsHolder.objects.get(rights_holder_name__iexact=rights_holder_name)
except User.DoesNotExist:
except RightsHolder.DoesNotExist:
return rights_holder_name
raise forms.ValidationError(_("Another rights holder with that name already exists."))
class ProfileForm(forms.ModelForm):
clear_facebook=forms.BooleanField(required=False)
clear_twitter=forms.BooleanField(required=False)

View File

@ -12,9 +12,12 @@
<link type="text/css" rel="stylesheet" href="/static/css/sitewide.css" />
<link href="/static/css/book-panel.css" rel="stylesheet" type="text/css" />
<link REL="SHORTCUT ICON" HREF="/static/images/favicon.ico">
{% block base_js %}
<script type="text/javascript" src="/static/js/jquery-1.6.3.min.js"></script>
<script type="text/javascript" src="/static/js/book-panel.js"></script>
{% block extra_head %}{% endblock %}
{% endblock %}
{% block extra_head %}
{% endblock %}
</head>
<body>

View File

@ -1,4 +1,12 @@
{% extends "basedocumentation.html" %}
{% block base_js %}{% endblock %}
{% block extra_head %}
<link rel="stylesheet" href="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.13/themes/ui-lightness/jquery-ui.css" type="text/css" media="screen">
{{ form.media.css }}
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js"></script>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.13/jquery-ui.min.js"></script>
{{ form.media.js }}
{% endblock %}
{% block doccontent %}
@ -13,10 +21,12 @@
<h2> Accepted Rights Holders </h2>
{% for rights_holder in rights_holders %}
<h3>{{ rights_holder.rights_holder_name }}</h3>
<h3>{{ rights_holder.rights_holder_name }}</h3><p>
PSA #: {{ rights_holder.id }}<br/>
email: {{ rights_holder.email }}<br/>
owner: <a href="{% url supporter supporter_username=rights_holder.owner %}">{{ rights_holder.owner }}</a><br/>
owner: <a href="{% url supporter supporter_username=rights_holder.owner %}">{{ rights_holder.owner }}</a></p>
{% empty %}
<p>No rights holders have been accepted yet</p>
{% endfor %}
{% if pending %}
@ -37,7 +47,7 @@
{% endfor %}
</form>
{% endif %}
active:{{ active_data.count }}
{% if active_data.count %}
<h2> Active Claims </h2>
{% for claim in active_data %}

View File

@ -17,3 +17,4 @@ mechanize
pyzotero
freebase
django-endless-pagination
django-selectable

View File

@ -93,6 +93,7 @@ TEMPLATE_DIRS = (
INSTALLED_APPS = (
'django.contrib.auth',
'django.contrib.admin',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.sites',
@ -109,6 +110,7 @@ INSTALLED_APPS = (
'tastypie',
'djcelery',
'endless_pagination',
'selectable',
)
# A sample logging configuration. The only tangible logging

View File

@ -4,7 +4,7 @@ DEBUG = False
TEMPLATE_DEBUG = DEBUG
ADMINS = (
('Ed Summers', 'ehs@pobox.com'),
('Ed Summers', 'ed.summers@gmail.com'),
('Raymond Yee', 'rdhyee+ungluebugs@gluejar.com'),
('Eric Hellman', 'eric@gluejar.com'),
('Andromeda Yelton', 'andromeda@gluejar.com'),
@ -107,4 +107,4 @@ LOGGING = {
}
}
STATIC_ROOT = '/var/www/static'

View File

@ -1,6 +1,9 @@
from django.conf.urls.defaults import *
from frontend.forms import ProfileForm
from django.contrib import admin
admin.autodiscover()
urlpatterns = patterns('',
url(r'^accounts/activate/complete/$','django.contrib.auth.views.login',
{'template_name': 'registration/activation_complete.html'}),
@ -11,5 +14,8 @@ urlpatterns = patterns('',
('^profiles/edit/$', 'profiles.views.edit_profile', {'form_class': ProfileForm,}),
(r'^profiles/', include('profiles.urls')),
(r'', include('regluit.frontend.urls')),
(r'', include('regluit.payment.urls'))
(r'', include('regluit.payment.urls')),
(r'^selectable/', include('selectable.urls')),
url(r'^admin/', include(admin.site.urls)),
)