Skip to content
Browse files

another lot of

  • Loading branch information...
1 parent 480f6ff commit 8f1494a653abe39acbe1f6251a3b7fe84423fd0d @danieleguido committed
View
8 glue/api.py
@@ -5,6 +5,7 @@
from django.contrib.auth.decorators import login_required
from django.db.models.loading import get_model
from django.db import IntegrityError
+from django.http import HttpResponse
from django.utils.translation import ugettext as _
from django.utils.translation import get_language
from django.template.defaultfilters import slugify
@@ -362,6 +363,13 @@ def pin( request, pin_id ):
return response.single( Pin, {'id':pin_id} ).json()
+def pins_plaintext( request ):
+ response = Epoxy(request)
+ return HttpResponse( "".join( [p.plaintext() for p in Pin.objects.filter( **response.filters )]) , content_type="text/plain")
+
+def pin_plaintext( request, pin_id ):
+ return HttpResponse( Pin.objects.get( id=pin_id ).plaintext(), content_type="text/plain")
+
def pin_by_slug( request, pin_slug, pin_language ):
return Epoxy( request ).single( Pin, {'slug':pin_slug,'language':pin_language} ).json()
View
4 glue/urls.py
@@ -15,13 +15,15 @@
url(r'^page/(?P<page_slug>[a-zA-Z\d\-]+)/(?P<page_language>[a-zA-Z]{2})/$', 'glue.api.page_by_slug', name='glue_api_page_by_slug'),
url(r'^pin/$', 'glue.api.pins', name='glue_api_pins'), # get list, post single page
+ url(r'^pin/plaintext/$', 'glue.api.pins_plaintext', name='glue_api_pins_plaintext'), # get list, post single page
url(r'^pin/(?P<pin_id>\d+)/$', 'glue.api.pin', name='glue_api_pin'),
+ url(r'^pin/(?P<pin_id>\d+)/plaintext/$', 'glue.api.pin_plaintext', name='glue_api_pin_plaintext'),
url(r'^pin/(?P<pin_id>\d+)/tag/$', 'glue.api.pin_tags', name='glue_api_pin_tags'),
url(r'^pin/(?P<pin_id>\d+)/alchemy/$', 'glue.api.pin_alchemy', name='glue_api_pin_alchemy'),
url(r'^pin/(?P<pin_slug>[a-zA-Z\d\-]+)/(?P<pin_language>[a-zA-Z]{2})/$', 'glue.api.pin_by_slug', name='glue_api_pin_by_slug'),
url(r'^pin/(?P<pin_id>\d+)/publish/$', 'glue.api.publish_pin', name='glue_api_publish_pin'),
url(r'^pin/(?P<pin_id>\d+)/clean/$', 'glue.api.pin_clean', name='glue_api_pin_clean'),
- url(r'^pin/upload/$', 'glue.api.pin_upload', name='glue_api_pin_upload'),
+ url(r'^pin/upload/$', 'glue.api.pin_upload', name='glue_api_pin_upload'),
url(r'^serie/$', 'glue.api.series', name='glue_api_series'), # get list, post single serie
View
BIN static/img/bin.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN static/img/edit.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN static/img/link.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN static/img/tag.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 8f1494a

Please sign in to comment.
Something went wrong with that request. Please try again.