Yawd website

Articles Tagged ajax

  1. Managing files with django - a yawd-elfinder tutorial

    File management with django and yawd-elfinderFile management with django and yawd-elfinder.

    I've always liked elFinder. It is a jQuery application that allows for managing files through a web page. elFinder is capable of uploading, moving, previewing and editing all kinds of files on the fly. In version 2 you can also resize, rotate and crop your images online, so it is a perfect solution for your django website's administration interface. To integrate elfinder with django we created a reusable django application, the yawd-elfinder. In this simple tutorial we will install yawd-elfinder and connect it to our models. For more control over your files, please advice the documentation.

    Posted on September 24th, 2012 by Pantelis Petridis
  2. Ajax Coin Slider: A jquery image slider with asynchronous image loading

    Ajax coin slider - screenshot from the yawd websiteFigure 1. Ajax coin slider - screenshot from the yawd website

    While working on my latest project, I was in need for a jquery slider capable of loading images asynchronously. When you run a big website with heavy pages and you need a slider with, say, 10 slide images, you are in trouble. Let's do the math: Suppose each image is sized 100KB, then you need to put an extra weight of 1MB to your homepage! Traditionally, image sliders load all images from the html code and as soon as the page loads, a javascript comes in to make the magic happen. This means that a user must wait a long time before the webpage loads. Moreover, it is always better to display content on demand rather than pre-load it. It saves you from the extra bandwith and lets the web server breathe!

    Posted on January 10th, 2012 by Pantelis Petridis
  3. Using class-based views to process a django form through ajax

    Field-specific errors with the JSONFormView class-based view Since Django 1.3 class-based views have been introduced to allow for code reusability. Class-based views have been criticized for their poor documentation (count me in) and their amazing ability to grow our code size instead of reducing it! The latter appears to be true only if we are not careful with sub-classing. On the other hand class-based views finally deliver django what has been missing: a consistent way of coding all your models, forms and views.
    Unfortunately, django's generic class-based views do not provide a mechanism for implementing JSON views. Ajax requests are the standard way of doing things these days and I feel that django needs some work towards this direction. However, the official documentation offers the implementation of a simple JSONResponseMixin that we will use as a base for our own view. What we try to achieve here is create a view that will process a form, return the errors when the form is not valid or save the form and return a success message otherwise. This is a fairly common scenario and extremely useful when a full page reload is not acceptable (e.g. a newsletter subscription form).
    Posted on August 30th, 2011 by Pantelis Petridis