Пример #1
0
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
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
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
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
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
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
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
            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
                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)