Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

pep8

  • Loading branch information...
commit 15f93684a0cb9bfb880c6f9856ea2fba50ecc45a 1 parent 5a52571
mjbecze@gmail.com authored
View
7 occupywallst/media/css/rideshare.css
@@ -5,10 +5,3 @@
text-align: left;
}
-.paginate_enabled_previous { background: url('../img/back_enabled.png') no-repeat top left; }
-.paginate_enabled_previous:hover { background: url('../img/back_enabled_hover.png') no-repeat top left; }
-.paginate_disabled_previous { background: url('../img/back_disabled.png') no-repeat top left; }
-
-.paginate_enabled_next { background: url('../img/forward_enabled.png') no-repeat top right; }
-.paginate_enabled_next:hover { background: url('../img/forward_enabled_hover.png') no-repeat top right; }
-.paginate_disabled_next { background: url('../img/forward_disabled.png') no-repeat top right; }
View
22 occupywallst/media/js/occupywallst/rides.js
@@ -411,26 +411,4 @@ var rides_init;
}
// export stuff
rides_init = init;
-
})();
-
-
-//this shit is for ride edit
-$(function(){
-
-var date = new Date('2012', '04', '15');
-
-$("#id_depart_time").datepicker({ dateFormat: 'yy-mm-dd',
- defaultDate: '2012-05-15' });
-
-$("#id_return_time").datepicker({ dateFormat: 'yy-mm-dd',
- defaultDate: '2012-05-22' });
-$("#id_ride_direction").change(function(){
- if($(this).val() != 'round'){
- $('#id_return_time').closest('tr').hide();
- }else{
- $('#id_return_time').closest('tr').show();
- }
- });
-});
-
View
2  occupywallst/views.py
@@ -322,7 +322,7 @@ def signup(request):
form = forms.SignupForm(request.POST)
if form.is_valid():
key = 'signup_' + request.META['REMOTE_ADDR']
- if cache.get(key):
+ if cache.get(key) and not settings.DEBUG:
return HttpResponse('please wait before signing up again')
cache.set(key, True, settings.OWS_LIMIT_SIGNUP)
form.save()
View
3  rideshare/forms.py
@@ -48,11 +48,8 @@ def __init__(self, *args, **kwargs):
def save(self, commit=True):
from django.contrib.gis.geos import GEOSGeometry
model = super(RideForm, self).save(commit=False)
-
points = GEOSGeometry(self.cleaned_data['waypoints_points_wkt'])
- #pdb.set_trace()
model.waypoints_points = points
-
if self.cleaned_data['waypoints'] != '':
self.cleaned_data['waypoints'] = \
self.cleaned_data['waypoints'] + '\n'
View
19 rideshare/models.py
@@ -4,6 +4,7 @@
from django.core.exceptions import ObjectDoesNotExist
from occupywallst import geo
+from rideshare import settings
class Ride(models.Model):
@@ -13,7 +14,7 @@ class Ride(models.Model):
('bus', 'Bus'),
('other', 'Other'),
)
- #this is defined twice?
+ #this is defined twice, other in RideRequest
RIDEDIR_CHOICES = (
('round', 'Round Trip'),
('to', 'One Way too'),
@@ -34,9 +35,19 @@ class Ride(models.Model):
What type of vehicle is being offered?""")
title = models.CharField(max_length=255, help_text="""
A one-line title to describe ride.""")
- depart_time = models.DateTimeField(default="2012-05-15", help_text="""
+ if hasattr(settings, 'DEFUALT_DEPART_DATE'):
+ default_depart_time = settings.DEFUALT_DEPART_DATE
+ else:
+ default_depart_time = None
+
+ depart_time = models.DateTimeField(default=default_depart_time, help_text="""
What time are you leaving?""")
- return_time = models.DateTimeField(default="2012-05-22", help_text="""
+
+ if hasattr(settings, 'DEFUALT_RETURN_DATE'):
+ default_return_time = settings.DEFUALT_DEPART_DATE
+ else:
+ default_return_time = None
+ return_time = models.DateTimeField(default=default_return_time, help_text="""
What time are you coming back?""")
seats_total = models.IntegerField(default=0, help_text="""
How many seats in vehicle does the user wish to fill?""")
@@ -79,7 +90,7 @@ def accepted_requests(self):
def forum_title(self):
waypoints = self.waypoint_list
return "%s to %s on %s" % (
- waypoints[0], waypoints[-1], self.depart_time.date())
+ waypoints[0], waypoints[-1], self.depart_time.date())
def retrieve_route_from_google(self):
route = geo.directions(self.waypoint_list)
View
3  rideshare/settings.py
@@ -10,3 +10,6 @@
DEFAULT_CITY = "New York, NY"
DEFAULT_LOCATION = [40.744136, -73.989487]
DEFAULT_END_ADDRESS = "Wall Street, NYC"
+
+#DEFUALT_DEPART_DATE = "2012-05-22"
+#DEFUALT_RETURN_DATE = "2012-05-22"
View
3  rideshare/templates/ride_base.html
@@ -4,9 +4,6 @@
{% block body_class %}rides-page{% endblock %}
{% block scripts %}
<script src="//maps.google.com/maps/api/js?libraries=places&sensor=false&region=us" type="text/javascript"></script>
- <script src="//maps.google.com/maps/api/js?libraries=places&sensor=false&region=us" type="text/javascript"></script>
- <script src="{{ MEDIA_URL }}js/jquery-ui-1.8.17.custom.min.js" type="text/javascript"></script>
- <script src="{{ MEDIA_URL }}js/jquery-ui-timepicker-addon.js" type="text/javascript"></script>
<script src="{{ MEDIA_URL }}js/jquery.dataTables.min.js" type="text/javascript"></script>
{% endblock scripts %}
View
16 rideshare/templates/ride_update.html
@@ -1,10 +1,12 @@
-{% extends base %}
+{% extends "ride_base.html" %}
{% block body_class %}rides-page rides-update-page{% endblock %}
{% block title %}Free Bus/Carpool Route Map | {{ OWS_SITE_NAME }}{% endblock title %}
{% block scripts %}
+ {{ block.super }}
+ <script src="{{ MEDIA_URL }}js/jquery-ui-1.8.17.custom.min.js" type="text/javascript"></script>
+ <script src="{{ MEDIA_URL }}js/jquery-ui-timepicker-addon.js" type="text/javascript"></script>
<link type="text/css" href="{{ MEDIA_URL }}css/custom-theme/jquery-ui-1.8.23.custom.css" rel="Stylesheet" />
- <script src="//maps.google.com/maps/api/js?libraries=places&sensor=false&region=us" type="text/javascript"></script>
{% endblock scripts %}
{% block js_init %}
@@ -20,6 +22,16 @@
"rendezvous":[{% for request in requests %}[{{request.rendezvous.0}},{{request.rendezvous.1}},"{{request.rendezvous_address}}","{{request.user}}"],{%endfor%}],
{% endif %}
});
+
+ $("#id_depart_time").datepicker({ dateFormat: 'yy-mm-dd'});
+ $("#id_return_time").datepicker({ dateFormat: 'yy-mm-dd'});
+ $("#id_ride_direction").change(function(){
+ if($(this).val() != 'round'){
+ $('#id_return_time').closest('tr').hide();
+ }else{
+ $('#id_return_time').closest('tr').show();
+ }
+ });
{% endblock js_init %}
{% block content %}
View
14 rideshare/templates/rides.html
@@ -60,10 +60,10 @@
<tr>
<th>Ride</th>
<th>Description</th>
- <th>Start</th>
- <th>Date</th>
- <th>End</th>
- <th>Date</th>
+ <th>Start Location</th>
+ <th>Destination</th>
+ <th>Arrival&nbsp;Date</th>
+ <th>Return&nbsp;Date</th>
</tr>
</thead>
<tbody>
@@ -71,10 +71,10 @@
<tr>
<td><a href="{% url ride_info ride.id %}" >{{ride.title}}</a></td>
<td>{{ ride.info|slice:":29"}}{% if ride.info|length > 30 %}...{% endif %}</td>
- <td>{{ride.waypoint_list.1}}</td>
+ <td>{{ride.waypoint_list.0}}</td>
+ <td>{{ride.waypoint_list|last}}</td>
<td>{{ride.depart_time|date:"SHORT_DATE_FORMAT"}}</td>
- <td>{{ride.waypoint_list|last}}</td>
- <td>{{ride.return_time|date:"SHORT_DATE_FORMAT"}}</td>
+ <td>{% if ride.ride_direction == "round" %} {{ride.return_time|date:"SHORT_DATE_FORMAT"}} {% endif %}</td>
</tr>
{% endfor %}
</tbody>
View
13 rideshare/views.py
@@ -71,8 +71,8 @@ def ride_delete(request, ride_id):
requests = ride.requests.all()
for req in requests:
maindb.Notification.send(
- req.user, reverse('rides'),
- '%s has deleted there ride' % (ride.user.username))
+ req.user, reverse('rides'),
+ '%s has deleted there ride' % (ride.user.username))
requests.delete()
ride.delete()
return HttpResponseRedirect(reverse(rides))
@@ -113,9 +113,13 @@ def ride_create_or_update(request, instance=None):
ride_requests = None
else:
userinfo = maindb.UserInfo.objects.get(user=request.user)
+ if hasattr(settings, 'DEFAULT_END_ADDRESS'):
+ default_end_address = settings.DEFAULT_END_ADDRESS
+ else:
+ default_end_address = None
form = forms.RideForm(initial={
'start_address': userinfo.formatted_address,
- 'end_address': settings.DEFAULT_END_ADDRESS,
+ 'end_address': default_end_address,
}, instance=instance)
ride_requests = db.RideRequest.objects.filter(ride=instance)
return render_to_response('ride_update.html', {
@@ -206,11 +210,10 @@ def rides_get(bounds=None, **kwargs):
.filter(route__isnull=False))
for ride in qset:
yield {'id': ride.id,
- 'title':ride.title,
+ 'title': ride.title,
'address': ride.waypoint_list[0],
'route': ride.route}
-
def ride_request_update(request_id, status, user=None, **kwargs):
ride_request = (db.RideRequest.objects
.select_related("ride", "ride__user")
Please sign in to comment.
Something went wrong with that request. Please try again.