Yawd website

Articles Tagged web-development

  1. The impact of Django page redirects to SEO - Fixing internationalized pattern URLs

    Django makes heavy use of page redirects to handle form submissions, manage multilingual content and accomplish many other tasks. While there's nothing wrong with that (in fact in most cases it is considered to be the best practice), careless use of page redirects might affect our website's page rank. To better understand the potential danger we should first see how redirect works and which tools does Django provide for redirecting to a new page. We will also examine & fix a case where Django does not use the optimal redirect type: the internationalized URL patterns.
    Posted on October 4th, 2012 by Pantelis Petridis
  2. 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
  3. SEO-friendly image names with sorl-thumbnail and Django

    When working with Django, I tend to use sorl-thumbnail more and more. It is a quick & easy way of generating image thumbnails for your application. As a matter of fact, I use it on almost every img tag on my templates to ensure that user-upload images will fit the page layout. But the URLs that the application generates are of the form http://media.example.com/cache/9f/0c/9f0c98435b16bcea2b9ead87.jpg. Except for being unpretty, such URLs are SEO deal-killers.

    Posted on August 20th, 2012 by Pantelis Petridis
  4. How to cache your website menu with django

    On large django projects it is more likely that to generate a single webpage multiple queries over large datasets and complex data processing must be involved. In such cases -were performance is an issue-, the use of caching techniques can really save the day. Django provides a solid framework for caching, allowing for the storage/retrieval of single values (e.g. the result of complex database queries), html code fragments (e.g. the 'footer' of your webpage) or even entire django views.

    In today's article we'll examine a way to cache our menu (consider a tree-menu application like the one described in this yawd blog article or the django-treemenus application) in order to reduce loading times and save db server load. Although this appears to be a fairly straight-forward task, a couple of decisions can be tricky.

    Posted on November 9th, 2011 by Pantelis Petridis
  5. How to automatically add taxonomy term relations when adding content in Drupal 7

    Let's suppose we want our Drupal article content type to have a parent category and a sub-category. We have defined a 'categories' vocabulary and we are also able to add new terms and set their parent elements. When using the administration UI to add a new article we can create a new category, set a new sub-category and both taxonomy terms will be saved along with the article. However, the sub-category won't be connected with its parent category automatically. We need to manually visit the taxonomy terms list and set the sub-category's parent category term.

    This is a problem I came across when working on a yawd project and to solve it I had to create a simple module that programmatically correlates the sub-category with its parent category field...

    Posted on June 29th, 2011 by Pantelis Petridis
  6. Admin widget for generic relations in django

    The contenttypes framework adds wonderful functionality for dynamic foreign keys in Django. However, it lacks of a widget to allow the user select the content object from the administrator website. This article explains how to implement such a widget and embed it to your django-powered project.

    Posted on May 26th, 2011 by Pantelis Petridis
  7. Using signals to generate a decoupled tree-menu application in django

    Although there exist several django menu applications -the excellent django-treemenus is one of them-, they all require that the user explicitly sets the menu structure. Consider the following scenario in a django CMS application: The user will probably be able to define a list of article categories -and sub-categories- and will also write a bunch of articles tied to each one of these categories. At the same time, this hypothetical user would also be able to use a blogging engine and publish his thoughts. Let's assume that the user wants to add an article category to the menu and use its sub-categories as sub-menuitems. He also wants to add a link to the blog main page and use the most popular tags as sub-menuitems. To accomplish this he must manually define a menuitem for each menu link and map it to the corresponding url, which is less than ideal. In this article, we will demonstrate a menu application that would enable the user to define a top-level item -e.g. an article category- and optionally have all children items automatically inherited from the corresponding parent element.

    Posted on May 20th, 2011 by Pantelis Petridis