Friday, January 29, 2010

Django | Generic views | Django documentation

Took me forever to figure this out with generi views, but the I just don't read well. Here is an example template:
<p class=\"paginator\">
 <span class=\"step-links\">
  {% if page_obj.has_previous %}
   <a href=\"?page={{ page_obj.previous_page_number }}\"><</a>
  {% endif %}

  <span class=\"current\">
   Page <span class=\"this-page\">{{ page }}</span> of {{ paginator.num_pages }}
  </span>

  {% if page_obj.has_next %}
   <a href=\"?page={{ page_obj.next_page_number }}\">></a>
  {% endif %}
 </span>
</p>

"If the results are paginated, the context will contain these extra variables: paginator: An instance of django.core.paginator.Paginator. page_obj: An instance of django.core.paginator.Page." Django Generic views object_list:

Thursday, January 28, 2010

Dynamic Inlines Built into Django Admin in 1.2

So I was talking at a Django round table last night and talking about the fixes I did to the dynamic inlines for the admin. And someone mentioned that a)jquery is now included in Django 1.2 and b) dynmaic inlines are built in as well. /django/trunk/django/contrib/admin/media/js/inlines.js

Sunday, January 24, 2010

Friday, January 22, 2010

Django snippets: jQuery Double Click Edit ManyToMany in Admin

Take a look at my code on django snippets. Just drop this into your templates/admin/change_form.html and any select for a foreign key or many to many will allow a double click to pop up and edit

Django snippets: jQuery Double Click Edit ManyToMany in Admin

Wednesday, January 06, 2010

Multiple Inserts with a Subquery | Code Spatter

Multiple Inserts with a Subquery | Code Spatter

Django Dynamic Formset

I posted Previously about this jquery plugin. I have just figured out a very plugable way to get this working in the admin with adding just one form.
Add the following to templates/admin/APP/MODEL/change_form.html and also update the MODEL in the prefix setting.
{% extends "admin/change_form.html" %}
{% load i18n admin_modify adminmedia %}
{% block extrahead %}
{{ block.super }}

  // Define this so we don't have to bother with the admin jsi18n stuff:
  function gettext(msgid) { return msgid; }

  $(function() {
      $('.inline-related tbody tr').formset({
   prefix: 'MODEL_set',
   addText: 'Add',
   deleteText: 'Delete',
  });
  });

  .add-row {
      padding-left:18px;
      background:url({% admin_media_prefix %}img/admin/icon_addlink.gif) no-repeat left center;
  }
  .delete-row {
      float:right;
      display:block;
      padding-left:18px;
      background:url({% admin_media_prefix %}img/admin/icon_deletelink.gif) no-repeat left center;
  }

{% endblock %}
Thanks Stanislaus
Django Dynamic Formset

Friday, January 01, 2010

Download SpeedFan - Access temperature sensor in your computer

Download SpeedFan - Access temperature sensor in your computer

howto:chroot_debian - DNS323Wiki

Installing debian on the DLink DNS323 NAS is really easy, just download and extact the files to the root directory and restart it.
Default password is 12345678 make sure you reset it.
Also update your /etc/apt/source.list to lenny and apt-get update (don't forget to apt-get install debian-archive-keyring)
Files
Instructions
howto:chroot_debian - DNS323Wiki