Skip to content

Commit

Permalink
another lot of
Browse files Browse the repository at this point in the history
  • Loading branch information
danieleguido committed Mar 26, 2013
1 parent 480f6ff commit 8f1494a
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 1 deletion.
8 changes: 8 additions & 0 deletions glue/api.py
Expand Up @@ -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
Expand Down Expand Up @@ -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()
Expand Down
4 changes: 3 additions & 1 deletion glue/urls.py
Expand Up @@ -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
Expand Down
Binary file added 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.
Binary file added 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.
Binary file modified 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.
Binary file added 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.