Project for the UPV to develop an app like BlaBlaCar but only for UPV people.
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

fixed database problem

+43 -13
+1
docs/install.rst
··· 24 24 $ make 25 25 $ sudo make install 26 26 27 + 27 28 Install Virtualenv 28 29 ------------------ 29 30
+4 -3
upvcarshare/journeys/managers.py
··· 81 81 queryset = queryset.filter(kind=kind) 82 82 if ignore_full: 83 83 return queryset 84 - return queryset.\ 85 - annotate(total_passengers=Count("passengers")).\ 86 - filter(total_passengers__lt=F("free_places")) 84 + # NOTE: annotate QuerySet method has problems with Oracle, so, we have to 85 + # look for an other way to make this query. 86 + # queryset.annotate(total_passengers=Count("passengers")).filter(total_passengers__lt=F("free_places")) 87 + return queryset.filter(total_passengers__lt=F("free_places")) 87 88 88 89 def nearby(self, geometry, distance, kind=None): 89 90 """Gets available nearby journeys.
+20
upvcarshare/journeys/migrations/0013_journey_total_passengers.py
··· 1 + # -*- coding: utf-8 -*- 2 + # Generated by Django 1.10.2 on 2016-11-30 11:22 3 + from __future__ import unicode_literals 4 + 5 + from django.db import migrations, models 6 + 7 + 8 + class Migration(migrations.Migration): 9 + 10 + dependencies = [ 11 + ('journeys', '0012_auto_20161024_1001'), 12 + ] 13 + 14 + operations = [ 15 + migrations.AddField( 16 + model_name='journey', 17 + name='total_passengers', 18 + field=models.PositiveIntegerField(blank=True, default=0, null=True, verbose_name='total pasajeros'), 19 + ), 20 + ]
+9 -1
upvcarshare/journeys/models.py
··· 131 131 ) 132 132 kind = models.PositiveIntegerField(choices=JOURNEY_KINDS, verbose_name=_("tipo de viaje")) 133 133 free_places = models.PositiveIntegerField(default=4, verbose_name=_("plazas libres"), blank=True, null=True) 134 + total_passengers = models.PositiveIntegerField(default=0, verbose_name=_("total pasajeros"), blank=True, null=True) 134 135 departure = models.DateTimeField(verbose_name=_("fecha y hora de salida*")) 135 136 arrival = models.DateTimeField(verbose_name=_("fecha y hora de llegada estimada*"), null=True, blank=True) 136 137 time_window = models.PositiveIntegerField( ··· 281 282 if not self.is_passenger(user=user): 282 283 raise NotAPassenger() 283 284 self.passengers.filter(user=user).delete() 285 + self.total_passengers -= 1 286 + if self.total_passengers < 0: 287 + self.total_passengers = 0 288 + self.save() 284 289 285 290 @dispatch(THROW_OUT) 286 291 def throw_out(self, user): ··· 299 304 if passenger: 300 305 passengers = passenger.recurrence() 301 306 passengers.update(status=CONFIRMED) 307 + self.total_passengers += 1 308 + self.save() 302 309 303 310 @dispatch(REJECT) 304 311 def reject_passenger(self, user): ··· 323 330 """ 324 331 if self.driver == self.user: 325 332 return Journey.objects.none() 326 - return Journey.objects.recommended(user=self.user, kind=self.kind, journey=self, ignore_full=ignore_full) 333 + result = Journey.objects.recommended(user=self.user, kind=self.kind, journey=self, ignore_full=ignore_full) 334 + return result 327 335 328 336 def needs_driver(self): 329 337 """Checks if the journey needs a driver."""
+2 -2
upvcarshare/templates/header.html
··· 35 35 </a> 36 36 </li> 37 37 </ul> 38 - <ul class="nav navbar-nav pull-xs-right"> 38 + <ul class="nav navbar-nav float-xs-right"> 39 39 <li class="nav-item {% add_active_class "journeys:search" %}"> 40 40 <a class="nav-link" href="{% url "journeys:search" %}">{% trans "Buscador" %}</a> 41 41 </li> ··· 66 66 </li> 67 67 </ul> 68 68 {% else %} 69 - <ul class="nav navbar-nav pull-xs-right"> 69 + <ul class="nav navbar-nav float-xs-right"> 70 70 <li class="nav-item"> 71 71 <a class="nav-link" href="{% url "users:sign-in" %}">{% trans "Acceder" %}</a> 72 72 </li>
+1 -1
upvcarshare/templates/journeys/create.html
··· 30 30 </div> 31 31 <div class="col-sm-5"> 32 32 {% block residence_action %} 33 - <div class="btn-group pull-xs-right" role="group" aria-label="{% trans "Acciones" %}"> 33 + <div class="btn-group float-xs-right" role="group" aria-label="{% trans "Acciones" %}"> 34 34 <a href="{% url "journeys:create-residence" %}" class="btn btn-success-outline">{% trans "Crear nuevo lugar" %}</a> 35 35 </div> 36 36 {% endblock %}
+2 -2
upvcarshare/templates/journeys/create.smart.html
··· 42 42 </div> 43 43 <div class="col-sm-5"> 44 44 {% block residence_action %} 45 - <div class="btn-group pull-xs-right" role="group" aria-label="{% trans "Acciones" %}"> 45 + <div class="btn-group float-xs-right" role="group" aria-label="{% trans "Acciones" %}"> 46 46 <a href="{% url "journeys:create-residence" %}" class="btn btn-outline-success">{% trans "Crear nuevo lugar" %}</a> 47 47 </div> 48 48 {% endblock %} ··· 54 54 {{ field }} 55 55 </div> 56 56 <div class="col-sm-5"> 57 - <div class="btn-group pull-xs-right" role="group" aria-label="{% trans "Acciones" %}"> 57 + <div class="btn-group float-xs-right" role="group" aria-label="{% trans "Acciones" %}"> 58 58 <a href="{% url "journeys:create-transport" %}" class="btn btn-outline-success">{% trans "Crear nuevo transporte" %}</a> 59 59 </div> 60 60 </div>
+1 -1
upvcarshare/templates/journeys/edit.html
··· 12 12 {% endblock section_title %} 13 13 14 14 {% block residence_action %} 15 - <div class="btn-group pull-xs-right" role="group" aria-label="{% trans "Acciones" %}"> 15 + <div class="btn-group float-xs-right" role="group" aria-label="{% trans "Acciones" %}"> 16 16 <a href="{% url "journeys:edit-residence" journey.residence.pk %}" class="btn btn-secondary">{% trans "Editar lugar" %}</a> 17 17 <a href="{% url "journeys:create-residence" %}" class="btn btn-secondary">{% trans "Crear nuevo lugar" %}</a> 18 18 </div>
+1 -1
upvcarshare/templates/partials/journeys/calendar.html
··· 10 10 </ul> 11 11 </div> 12 12 <div class="col-md-4"> 13 - <div class="btn-group pull-xs-right"> 13 + <div class="btn-group float-xs-right"> 14 14 <button class="btn btn-success" ng-click="$ctrl.changeView('agendaDay', 'calendar')">{% trans "Dia" %}</button> 15 15 <button class="btn btn-success" ng-click="$ctrl.changeView('agendaWeek', 'calendar')">{% trans "Semana" %}</button> 16 16 <button class="btn btn-success" ng-click="$ctrl.changeView('month', 'calendar')">{% trans "Mes" %}</button>
+1 -1
upvcarshare/templates/partials/journeys/origin_destiny_select.html
··· 13 13 </div> 14 14 <div class="col-sm-5"> 15 15 {% block residence_action %} 16 - <div class="btn-group pull-xs-right" role="group" aria-label="{% trans "Acciones" %}"> 16 + <div class="btn-group float-xs-right" role="group" aria-label="{% trans "Acciones" %}"> 17 17 <a href="{% url "journeys:create-residence" %}" class="btn btn-outline-success">{% trans "Crear nuevo lugar" %}</a> 18 18 </div> 19 19 {% endblock %}
+1 -1
upvcarshare/templates/partials/messenger/message.form.html
··· 10 10 <input type="text" placeholder="{% trans "Escribe tu mensaje" %}" class="form-control form-control-lg" ng-model="$ctrl.message.content"> 11 11 </div> 12 12 <div class="col-xs-3 col-lg-2"> 13 - <button type="submit" class="btn btn-lg btn-info pull-xs-right">{% trans "Enviar" %}</button> 13 + <button type="submit" class="btn btn-lg btn-info float-xs-right">{% trans "Enviar" %}</button> 14 14 </div> 15 15 </div> 16 16 </form>