Did I find the right examples for you? yes no      Crawl my project      Python Jobs

All Samples(14)  |  Call(14)  |  Derive(0)  |  Import(0)

src/d/y/dycapo-HEAD/rest/wrappers/participation.py   dycapo(Download)
    def read(self, request, trip_id=None, username=None):
        if username:
            try:
                trip = server.models.Trip.objects.get(id=trip_id, active=True)
                participation = trip.get_participations().filter(author__username=username).get()
                return piston.utils.rc.NOT_FOUND
        try:
            trip = server.models.Trip.objects.get(id=trip_id, active=True)
            participations = trip.get_participations()
            for participation in participations:
    def create(self, request, trip_id):
        data = request.data
        current_user = rest.utils.get_rest_user(request)
        try:
            trip = server.models.Trip.objects.get(id=trip_id)
    def update(self, request, trip_id=None, username=None):
        data = request.data
        current_user = rest.utils.get_rest_user(request)
        try:
            trip = server.models.Trip.objects.get(id=trip_id)
    def delete(self, request, trip_id=None, username=None):
        current_user = rest.utils.get_rest_user(request)
        try:
            trip = server.models.Trip.objects.get(id=trip_id)
            person_participation = trip.get_participations().filter(author__username=username).get()

src/d/y/dycapo-HEAD/rest/wrappers/trip.py   dycapo(Download)
        else:
            try:
                trip = server.models.Trip.objects.get(id=id)
                return trip
            except server.models.Trip.DoesNotExist:
        if result.code == server.models.Response.CREATED:
            id = result.value.id
            trip = server.models.Trip.objects.get(id=id)
            trip.href = rest.utils.get_href(request, 'trip_handler', [trip.id])
            trip.preferences.href = rest.utils.get_href(request, 'preferences_handler',[trip.id,])
    def update(self, request, id=None):
        current_user = rest.utils.get_rest_user(request)
        data = request.data
        try:
            trip = server.models.Trip.objects.get(id=id)
    def delete(self, request, id=None):
        current_user = rest.utils.get_rest_user(request)
        try:
            trip = server.models.Trip.objects.get(id=id, active=True)
            if trip.author.id != current_user.id:

src/d/y/dycapo-HEAD/rest/wrappers/preferences.py   dycapo(Download)
    def read(self, request, trip_id=None):
        try:
            if trip_id:
                trip = server.models.Trip.objects.get(id=trip_id, active=True)
                return trip.preferences

src/d/y/dycapo-HEAD/rest/wrappers/modality.py   dycapo(Download)
    def read(self, request, trip_id=None):
        try:
            if trip_id:
                trip = server.models.Trip.objects.get(id=trip_id, active=True)
                return trip.modality

src/d/y/dycapo-HEAD/rest/wrappers/location.py   dycapo(Download)
            if trip_id:
                if id:
                    trip = server.models.Trip.objects.get(id=trip_id)
                    return trip.locations.filter(id=id).get()
                else:
                    trip = server.models.Trip.objects.get(id=trip_id)

src/d/y/dycapo-HEAD/rest/management/commands/restifymodels.py   dycapo(Download)
            else:
                try:
                    trip = server.models.Trip.objects.get(locations__id__exact=location.id)
                    location.href = self.get_href("location_handler", [trip.id,location.id])
                    location.save()