コード例 #1
0
ファイル: views.py プロジェクト: nicferrier/django-muphan
def photo(request, username, dbid):
    try:
        photo = Photo.objects.get(id=dbid)
    except Photo.DoesNotExist:
        raise Http404
    else:
        return render_to_response("photo.xslt", RequestContext(request, {
                    "photo": photo,
                    }))
コード例 #2
0
ファイル: views.py プロジェクト: nicferrier/castwiki
def list(request):
    """Render a list of episodes"""
    ctx = RequestContext(request, {
            "episodes": Episode.objects.all().xml(
                name="name",
                url="url"
                )
            })
    return render_to_response("episodelist.xslt", ctx)
コード例 #3
0
ファイル: views.py プロジェクト: nicferrier/castwiki
def episode(request, name):
    """Render an episode by name"""
    episode = get_object_or_404(Episode, name=name)
    if request.method == "POST":
        return episode_comment(request, episode)

    ctx = RequestContext(request, {
            "episode": episode,
            "comment": CommentForm(),
            })
    return render_to_response("episode.xslt", ctx)
コード例 #4
0
ファイル: views.py プロジェクト: foonnnnn/django-contactstore
def create_invites(request):
    # Not gonna use forms for this
    logger = logging.getLogger("create_invites")
    try:
        post = request.POST.copy()
        contact_ids = post.getlist("contact_id")

        # Make the invites... we're going to throw this list away tho
        invites = tools.make_invites(contact_ids)

        response = render_to_response("invited.xslt", RequestContext(request, {}))
        return response
    except Exception, e:
        logger.exception("whoops!")
コード例 #5
0
ファイル: views.py プロジェクト: Thinktiv/django-contactstore
def create_invites(request):
    # Not gonna use forms for this
    logger = logging.getLogger("create_invites")
    try:
        post = request.POST.copy()
        contact_ids = post.getlist("contact_id")

        # Make the invites... we're going to throw this list away tho
        invites = tools.make_invites(contact_ids)

        response = render_to_response("invited.xslt",
                                      RequestContext(request, {}))
        return response
    except Exception, e:
        logger.exception("whoops!")
コード例 #6
0
ファイル: views.py プロジェクト: Thinktiv/django-contactstore
def download_contacts(request):
    """The view that handles the display and download attempt for the importer."""
    logger = logging.getLogger("download_contacts")
    try:
        post = request.POST.copy()
        form = ContactImportForm(post)
        if not form.is_valid():
            print form.errors
            raise ValidationError("something went wrong with the form")
    except ValidationError, e:
        # Fixme!!!
        ctx = RequestContext(request, {
            "form": form,
            "error_message": e.get_message()
        })
        response = render_to_response("share.xslt", ctx)
        response.status_code = 401
        return response
コード例 #7
0
ファイル: views.py プロジェクト: foonnnnn/django-contactstore
def download_contacts(request):
    """The view that handles the display and download attempt for the importer."""
    logger = logging.getLogger("download_contacts")
    try:
        post = request.POST.copy()
        form = ContactImportForm(post)
        if not form.is_valid():
            print form.errors
            raise ValidationError("something went wrong with the form")
    except ValidationError, e:
        # Fixme!!!
        ctx = RequestContext(request, {
                "form": form,
                "error_message": e.get_message()
                })
        response = render_to_response("share.xslt", ctx)
        response.status_code = 401
        return response
コード例 #8
0
ファイル: views.py プロジェクト: Thinktiv/django-contactstore
            contacts = xmlifyiter(
                importer_contacts,
                "{http://djangoproject.com/template/xslt}contact",
                id="id",
                contact_name="name",
                email="email")

            # Where should the POST go?
            action_url = url_reverse("contactstore.views.create_invites")

            ctx = RequestContext(request, {
                "contacts": contacts,
                "action_url": action_url
            })

            response = render_to_response("share-result.xslt", ctx)
            print response.content
            return response


def create_invites(request):
    # Not gonna use forms for this
    logger = logging.getLogger("create_invites")
    try:
        post = request.POST.copy()
        contact_ids = post.getlist("contact_id")

        # Make the invites... we're going to throw this list away tho
        invites = tools.make_invites(contact_ids)

        response = render_to_response("invited.xslt",
コード例 #9
0
ファイル: views.py プロジェクト: foonnnnn/django-contactstore
                importer_contacts, 
                "{http://djangoproject.com/template/xslt}contact",
                id="id",
                contact_name="name",
                email="email"
                )

            # Where should the POST go?
            action_url = url_reverse("contactstore.views.create_invites")

            ctx = RequestContext(request, {
                    "contacts": contacts,
                    "action_url": action_url
                    })

            response = render_to_response("share-result.xslt", ctx)
            print response.content
            return response



def create_invites(request):
    # Not gonna use forms for this
    logger = logging.getLogger("create_invites")
    try:
        post = request.POST.copy()
        contact_ids = post.getlist("contact_id")

        # Make the invites... we're going to throw this list away tho
        invites = tools.make_invites(contact_ids)