Re: enumerate in templates

2008-12-29 Thread Vicky
command like below is not working... can u suggest a way?? {% for node in nodes %} {% ifequal nodes[(forloop.counter0)-1].node_type '2' %} On Dec 29, 9:21 am, Vicky wrote: > ya that's what i need :) thanks a lot :) :) > > On Dec 28, 8:06 pm, Daniel Roseman > wrote: > > > On Dec 27, 6:20 

Re: A Django Comic Site Issues

2008-12-29 Thread kmeta...@gmail.com
You may want to have a look at django-positions. http://code.google.com/p/django-positions/ It's easy to use and handles re-numbering automatically. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" gro

Re: enumerate in templates

2008-12-29 Thread James Bennett
On Mon, Dec 29, 2008 at 3:02 AM, Vicky wrote: > command like below is not working... can u suggest a way?? It is very, very, very, very important to read the big warning at the top of the template documentation, which states that the Django template language *is not* just Python code embedded in

Re: Newbie question - Deploying Django apps

2008-12-29 Thread Jarek Zgoda
Wiadomość napisana w dniu 2008-12-29, o godz. 07:28, przez Leslie Maclachlan: > I am using Eclipse editor to work with my django projects. > Can anyone recommend a way to deploy my django apps to an Apache web > server? > > Currently, I am manually copying the entire source folder to the > co

a error occurs while use comment framework

2008-12-29 Thread Shuge Lee
setting.py ... INSTALLED_APPS = ( ... 'django.contrib.comments', ... python manage.py syncdb ... view.py from shuge.fap_soft.models import * #Category return render_to_response( 'a.html', {'obj': obj, 'category': Category} ) a.html ... {% load comments %} {% render_comment_form for cate

Sites and Auth apps not visible on using custom AdminSite

2008-12-29 Thread raj
In the usual admin index at http://host:port/admin/ page, there are the auth and sites app visible on top of our custom app list. I'd to customize the admin index page and the AdminSite. After that those apps are not visible. The only change I made in the custom AdminSite is to add two key-value p

Re: How to populate a form field with a Select widget

2008-12-29 Thread Polat Tuzla
You can do it as follows: class MyForm: CHOICES = ( ('P', 'Pending'), ('A', 'Active'), ('D', 'Done')) status = forms.ChoiceField(choices=CHOICES,widget=forms.Select ()) Regards, Polat On Dec 29, 5:13 am, "Aaron Lee" wrote: > I would like to populate a form field which uses

Re: How to populate a form field with a Select widget

2008-12-29 Thread Polat Tuzla
A formatting error occurred while I did my previous post. Please make sure that you notice the parentheses at the last line of the code snippet, which were actually meant to be at the end of the previous line. Regards, Polat On Dec 29, 1:03 pm, Polat Tuzla wrote: > You can do it as follows: >

Re: a error occurs while use comment framework

2008-12-29 Thread Grigory Fateyev
Hello Shuge Lee! On Mon, 29 Dec 2008 01:38:26 -0800 (PST) you wrote: > > > setting.py > ... > INSTALLED_APPS = ( > ... > 'django.contrib.comments', > ... > > python manage.py syncdb > ... > > > > view.py > from shuge.fap_soft.models import * #Category > > return render_to_response( 'a.

Re: Using Django authentication for phpBB

2008-12-29 Thread Giles Thomas
Grigory Fateyev wrote: > It was written for phpbb3? > Hi Grigory, Yes, it was. I have it running under one of the later phpBB 3 release candidates, but it should be fine with 3.0 final. Cheers, Giles -- Giles Thomas MD & CTO, Resolver Systems Ltd. giles.tho...@resolversystems.com +44 (0

Re: Using Django authentication for phpBB

2008-12-29 Thread Grigory Fateyev
Hello Giles Thomas! On Mon, 29 Dec 2008 12:35:11 + you wrote: > > Grigory Fateyev wrote: > > It was written for phpbb3? > > > Hi Grigory, > > Yes, it was. I have it running under one of the later phpBB 3 > release candidates, but it should be fine with 3.0 final. My question should be

Re: Using Django authentication for phpBB

2008-12-29 Thread Giles Thomas
Grigory Fateyev wrote: > My question should be "For phpbb2 it can be rewritten?". :) > Ah, I see :-) To be honest, I don't know. I have the impression that phpBB's pluggable authentication might have only appeared in version 3.0, and if that's the case then I don't think it would be easy t

Field.default optional attribute is not working properly

2008-12-29 Thread Rama
i have a model class as below. *(please observe the red color lines)* class NewsEntry(models.Model): *noofshares = models.IntegerField(default=0)** ispopular = models.BooleanField(default=0) * pdate = models.DateField(db_index=True) publisheddate = models.DateTimeField(

Re: a error occurs while use comment framework

2008-12-29 Thread Shuge Lee
I sure I have wrote '(r'^comments/', include ('django.contrib.comments.urls')),' into /path/to/project/url.py On Dec 29, 7:47 pm, Grigory Fateyev wrote: > Hello Shuge Lee! > On Mon, 29 Dec 2008 01:38:26 -0800 (PST) you wrote: > > > > > > > setting.py > > ... > > INSTALLED_APPS = ( > > ... > > 'd

Re: Field.default optional attribute is not working properly

2008-12-29 Thread Alex Koshelev
Default values stay only on python layer. For example you can specify any callable as default value so it cannot be "mapped" into DLL. On Mon, Dec 29, 2008 at 3:50 PM, Rama wrote: > i have a model class as below. *(please observe the red color lines)* > > class NewsEntry(models.Model): > *

Re: Sites and Auth apps not visible on using custom AdminSite

2008-12-29 Thread Alex Koshelev
How have you created custom AdminSite? Have you registered auth and site models to it? On Mon, Dec 29, 2008 at 1:41 PM, raj wrote: > > In the usual admin index at http://host:port/admin/ page, there are > the auth and sites app visible on top of our custom app list. I'd to > customize the admin

Writing your first Django app

2008-12-29 Thread kallep
This is my first question here. I find it extremely difficult to follow the "Writing your first Django app tutorial". I'm now stocked on the third part. Is it possible to see the finished source code somewhere? The main difficulty is to understand what code are supposed to go where. --~--~--

Re: Writing your first Django app

2008-12-29 Thread Abdel Bolanos Martinez
what you have just done until now ??? On Mon, 2008-12-29 at 05:52 -0800, kallep wrote: > This is my first question here. I find it extremely difficult to > follow the "Writing your first Django app tutorial". I'm now stocked > on the third part. Is it possible to see the finished source code

Re: Writing your first Django app

2008-12-29 Thread kallep
that was a fast reply :) In part 3 I do not understand if I'm suppose to create a new view called detail.py or if this code should be in to the views.py. The problem is that I cant load the detail page or even figure out if I'm supposed to be able to do that. I do not know what I'm building here

Re: Writing your first Django app

2008-12-29 Thread kallep
that was a fast reply :) In part 3 I do not understand if I'm suppose to create a new view called detail.py or if this code should be in to the views.py. The problem is that I cant load the detail page or even figure out if I'm supposed to be able to do that. I do not know what I'm building here

request.user is set to None

2008-12-29 Thread madhav
As a part of django user authentication, when is request.user becomes None?? As I have read in the docs, it will either django.contrib.auth.User or AnonymousUser, but I am getting a very weird error telling request.user is None. Please help me out. When I am trying to call request.user.is_authent

Re: Strage Url Tag Problem

2008-12-29 Thread madhav
Thankyou Malcom. I understood the bottom line. On Dec 12, 6:09 am, Malcolm Tredinnick wrote: > On Thu, 2008-12-11 at 04:01 -0800, madhav wrote: > > I am facing a strage error while using 'url' tag. I am using {%url > > logout%} for getting the logout url in the template. It is telling > > "Rever

Re: Writing your first Django app

2008-12-29 Thread kallep
The problem been that it is so many steps to go through before you can test your code. Appreciate your help. I will make a new try. thanks On Dec 29, 11:05 pm, Abdel Bolanos Martinez wrote: > The code should go in views.py, take it easy, these things need to read > slowly, depending of the url

Re: Writing your first Django app

2008-12-29 Thread Briel
The quick answer: This goes into views.py (copied from the tutorial). def detail(request, poll_id): return HttpResponse("You're looking at poll %s." % poll_id) Now to understand what happens a bit better: In your views.py file you can make as many "def something(request):" as you like. This

need urls help

2008-12-29 Thread Bobby Roberts
hi group. I have an issue where I need a random quote to display on every page on my website. Writing the view is not a problem (at least I don't think it is), but how would I call the view on each page of my website in the urls file? --~--~-~--~~~---~--~~ You rec

Re: need urls help

2008-12-29 Thread Briel
A solution, not sure if it's the best, would be to make a function in basicly any file, that generates a quote. Then you can import the function to every view you want and call it to get the random quote. All you need then is to pass it to your html-file (and display it). You could just write a bi

Re: need urls help

2008-12-29 Thread Dj Gilcrease
This would be best dealt with by creating a inclusion template tag http://docs.djangoproject.com/en/dev/howto/custom-template-tags/ Dj Gilcrease OpenRPG Developer ~~http://www.openrpg.com On Mon, Dec 29, 2008 at 7:41 AM, Bobby Roberts wrote: > > hi group. > > I have an issue where I need a r

Re: need urls help

2008-12-29 Thread Bobby Roberts
On Dec 29, 10:48 am, Briel wrote: > A solution, not sure if it's the best, would be to make a function in > basicly any file, that generates a quote. Then you can import the > function to every view you want and call it to get the random quote. > All you need then is to pass it to your html-fil

A better way to filter queryset in generic view?

2008-12-29 Thread justind
Hello, If a user goes to domain.com/entries/ I'd like to show her a list of all the entries she's created. I'm wrapping the generic list view in function that filters the query set, like so: from django.views.generic.list_detail import object_ urls.py info_dict = { 'queryset': Entry.object

Re: Sites and Auth apps not visible on using custom AdminSite

2008-12-29 Thread raj
On Dec 29, 6:35 pm, "Alex Koshelev" wrote: > How have you created custom AdminSite? Have you registered auth and site > models to it? Well, I haven't done that. Just defined the class and hooked all my apps to that. I thought all such default apps would be taken care of by the parent class. Ok,

Re: Sites and Auth apps not visible on using custom AdminSite

2008-12-29 Thread raj
On Dec 29, 6:35 pm, "Alex Koshelev" wrote: > How have you created custom AdminSite? Have you registered auth and site > models to it? I haven't done that. Thought that being built-in apps they would already be hooked to the parent class AdminSite. I'll try what you suggested. But where shall th

Re: request.user is set to None

2008-12-29 Thread Antoni Aloy
2008/12/29 madhav : > > As a part of django user authentication, when is request.user becomes > None?? As I have read in the docs, it will either > django.contrib.auth.User or AnonymousUser, but I am getting a very > weird error telling request.user is None. Please help me out. When I > am trying

Re: Sites and Auth apps not visible on using custom AdminSite

2008-12-29 Thread raj
Yes, I've found the way out. Adding these lines to the admin module will help: from django.contrib.sites.models import Site from django.contrib.sites.admin import SiteAdmin from django.contrib.auth.models import User, Group from django.contrib.auth.admin import UserAdmin, GroupAdmin ## admin_sit

Looking for Django-Pinax developers for music production community

2008-12-29 Thread Pancrazio
Hi group! we are a startup working on a community-based music production website. We are looking for Django developers with some expertise in Pinax applications and Posgresql database backend. Knowledge of Ajax programming and frameworks like jQuery will be appreciated as well as playing any mu

generic view update_object not 'updating' or 'redirecting' as per dict definition

2008-12-29 Thread eldonp2
I would like to use generic view as much as possible. I have a small wrapper around 'create_update.update_object', basically to specify the 'template_name' and 'post_save_redirect'. My 'Request' model has a number of fields, but I want to update only the fields that have to do with the rating of

Re: Variables in templates

2008-12-29 Thread ro60
Jeff is correct in saying that templates are just for handling layout. Django is quite strict about enforcing this separation. Having worked with a slew of other languages myself I can understand that this can be a tad inconvenient at times (even if it is best practice). A possible solution is to

How do I get django to display the results of html tags?

2008-12-29 Thread Ana
Hello, I have the tags name around particular words in the titles of my data. When I bring the titles from the PostGres database and display on the html page the title appears with the tags (name). I am expecting the page to read the em tags and convert the name to italics, not display the tags

Re: How do I get django to display the results of html tags?

2008-12-29 Thread Ramdas S
try autoescape or {{ tag|szafe }} options On Tue, Dec 30, 2008 at 12:34 AM, Ana wrote: > > Hello, > > I have the tags name around particular words in the titles of > my data. When I bring the titles from the PostGres database and > display on the html page the title appears with the tags (name

models.py -- Convert a Web page with form controls to field definitions

2008-12-29 Thread EhVK9OAlL9oT
Hi, Is there a tool that will import an HTML page with form controls and export model.py field definitions? The form controls' attribute values, such as ID and size, would determine the field definitions. # The tool would transform the HTML form controls into field properties: class databaseOb

Re: How do I get django to display the results of html tags?

2008-12-29 Thread Ana
Hello Ramda, Here is the line of code in on my html page: {{ publication| escape }} How do I create the syntax for {{ tag|szafe }} ? I'm just learning how to create the html templates with Django, so please be patient. Thanks, Ana On Dec 29, 11:07 am, "Ramdas S" wrote: > try autoescape or

Re: How do I get django to display the results of html tags?

2008-12-29 Thread Ramdas S
sorry its safe try {{ publication| safe }} it usually works for me. Next time, can you put your code in dpaste.com, it will be easier for others to help you On Tue, Dec 30, 2008 at 1:30 AM, Ana wrote: > > Hello Ramda, > > Here is the line of code in on my html page: > > {{ publication| >

Re: How do I get django to display the results of html tags?

2008-12-29 Thread Ana
Hello Ramdas, Thank you! It worked. Ana On Dec 29, 12:08 pm, "Ramdas S" wrote: > sorry its safe > > try > {{ publication| > safe }} > > it usually works for me. > > Next time, can you put your code in dpaste.com, it will be easier for others > to help you > > > > On Tue, Dec 30, 2008 at 1:30

Re: Sites and Auth apps not visible on using custom AdminSite

2008-12-29 Thread Alex Koshelev
Right here: http://code.djangoproject.com/browser/django/trunk/django/contrib/auth/admin.py http://code.djangoproject.com/browser/django/trunk/django/contrib/sites/admin.py On Mon, Dec 29, 2008 at 8:50 PM, raj wrote: > > Yes, I've found the way out. Adding these lines to the admin module > will

Configuring mod_python and Djano on Apache2

2008-12-29 Thread webhopper
Hello, I am a new fan of Django. Enjoying the learning process. The tutorial documentation is great. Where I am stuck is on how to move my development project onto my public website which sits on Ubuntu 8.10. I was able to configure mod_python and tell it where to find my Django project and temp

Re: How do I get django to display the results of html tags?

2008-12-29 Thread alex.gay...@gmail.com
This behavior occurs because by default Django templates escape all HTML tags in variable, the safe tag marks the string as being safe, and is thus rendered with its HTML intact. Alex On Dec 29, 2:09 pm, Ana wrote: > Hello Ramdas, > > Thank you!  It worked. > > Ana > > On Dec 29, 12:08 pm, "Ram

Re: A better way to filter queryset in generic view?

2008-12-29 Thread Justin Myers
Assuming you know you'll always be filtering Entry objects (probably true, given the view's name) and using the same template, here's what I'd do: ===urls.py=== urlpatterns = patterns('', url(r'^entries/$', view_entry_list), ) ===views.py=== def view_entry_list(request): queryset = Ent

Re: wondering how to do something similar to save_model for inline.

2008-12-29 Thread Timboy
DB is sqlite3. Deleted DB file syncd and still same traceback. here is proper traceback paste: http://dpaste.com/103517/ On Dec 28, 9:10 pm, Praveen wrote: > This is your database error.. > > On Dec 28, 8:32 am, Timboy wrote: > > > Great link. I was really excited to try it. > > > Here is my ne

caching...mechanism

2008-12-29 Thread Vignesh.isquare
I find that caching the pages records lesser number of page views than what actually happensthis causes fall in the revenue for the site. What caching mechanism should be followed so that the no page view is lost from the analytics perspective... --~--~-~--~~~---~

some type of save() issue

2008-12-29 Thread Robocop
I'm processing pretty simple form data, just reading POST data and saving it to my database. I have a list of "timesheet" objects that i run through, editing and saving each object in the list. All the objects save all right except for the last one. When i process the last one i receive a valid

Re: some type of save() issue

2008-12-29 Thread Robocop
Problem solved, my template got screwed up and the POST data looked different than before. Thanks to anyone who took the time to read this! On Dec 29, 2:43 pm, Robocop wrote: > I'm processing pretty simple form data, just reading POST data and > saving it to my database.  I have a list of "time

After upload ImageField in admin creates a 'Currently: /path/to/image' link which returns ValueError

2008-12-29 Thread dojuba
Hello, I am quite new to django, and trying to solve an issue I am having with ImageField in admin. I have an attachable model to upload images, which can be then in turn attached to different models through generic relations: # in the models.py class Attachment(models.Model): filename = mo

Django with shared host FastCGI

2008-12-29 Thread James Gregory
I tried using the guide here: http://docs.djangoproject.com/en/dev/howto/deployment/fastcgi/?from=olddocs to set up Django using FastCGI. 1. It kept just hanging with a never ending loading cursor whenever I tried going to the fcgi page. I eventually discovered, through immense trial and error,

Directed graph using Django ORM

2008-12-29 Thread martin.clau...@gmail.com
I am trying to model a directed graph using the Django ORM and have a working solution (see below), but have the feeling that it could be improved upon. By "improved" I mean improved efficiency, not going against the grain of Python/Django etc. I have considered implementing this outside the Djang

Re: Subcategory field is not saving Stackline issue

2008-12-29 Thread Karen Tracey
On Fri, Dec 26, 2008 at 3:45 AM, Praveen wrote: > > Hi all i am not able to save the entry of sub_cat field > > here is my model.py > > class MainCategory(models.Model): > main_cat_code= models.CharField(max_length=20,primary_key=True) > description = models.CharField(max_length = 50,) > def __

select childless parents, i.e. base with no derived classes in model inheritance

2008-12-29 Thread pk
I have a need to select base classes that does not have derived class defined using the ORM. Using the Place/Restaurant example in the Django doc, I find that: 1) Place.objects.filter(restaurant__isnull=True) returns all places. and 2) Place.objects.filter(restaurant__serves_hotdog__isnull=True

Re: select childless parents, i.e. base with no derived classes in model inheritance

2008-12-29 Thread alex.gay...@gmail.com
The first query is correct, and obviously you need to add an extra filter for every other derived class. This is because the only way to check is to join against each derived table. Alex On Dec 29, 6:48 pm, pk wrote: > I have a need to select base classes that does not have derived class > def

Re: need urls help

2008-12-29 Thread Daniel Roseman
On Dec 29, 10:58 am, Bobby Roberts wrote: > On Dec 29, 10:48 am, Briel wrote: > > > A solution, not sure if it's the best, would be to make a function in > > basicly any file, that generates a quote. Then you can import the > > function to every view you want and call it to get the random quote.

mobileadmin

2008-12-29 Thread Guido Serra
Hi All, I'm having many problems with this interface for the iPhone http://code.google.com/p/django-mobileadmin/ I've been redirected to this mailing list, but maybe it's not a good idea to bother all about this, maybe it is just my fault ... a configuration error Who can I discuss with? IS

working with a returned object inside another class

2008-12-29 Thread garagefan
below is the code... the first def doesn't return anything... (def get_gal_teaser(self)) i'm using a custom tag to return the Gallery class to the base template file, which works... so calling the method get_gal_teaser works as well... and returns an object? when the second e = e.image.get_thumbn

django + rest

2008-12-29 Thread Ed Summers
(my apologies if you already saw this question on django-developers, I'm reposting here because it's more a users question) I was wondering if anyone else on the list has layered a RESTful service into their django applications. I'm adding an atompub interface to an existing django project, and I

Admin form got a wrong action address via lighttpd with fastcgi.

2008-12-29 Thread khsing
I have done via this link http://docs.djangoproject.com/en/dev/howto/deployment/fastcgi/ The login form is appeared, but the action of login form is wrong. I think the action should be "/admin/", but I got "/nsman.fcgi/ admin/". why? here is some configure files. * lighttpd.conf fastcgi.serv

Re: working with a returned object inside another class

2008-12-29 Thread Daniel Roseman
On Dec 29, 9:02 pm, garagefan wrote: > below is the code... the first def doesn't return anything... (def > get_gal_teaser(self)) > i'm using a custom tag to return the Gallery class to the base > template file, which works...  so calling the method get_gal_teaser > works as well... and returns a

Re: a error occurs while use comment framework

2008-12-29 Thread Shuge Lee
Is this a bug ? On Dec 29, 9:30 pm, Shuge Lee wrote: > I sure I have wrote '(r'^comments/', include > ('django.contrib.comments.urls')),' into /path/to/project/url.py > > On Dec 29, 7:47 pm, Grigory Fateyev wrote: > > > Hello Shuge Lee! > > On Mon, 29 Dec 2008 01:38:26 -0800 (PST) you wrote: >

Re: working with a returned object inside another class

2008-12-29 Thread garagefan
awesome... it was all in that [:1]! now, next issue... "OperationalError at /admin/galleries/gallery/ (1054, "Unknown column 'galleries_gallery.status' in 'field list'")" i just added the status field as i wasn't worried about any of that previously... now, it appears to be causing issues. I've

Django in runfcgi mode does not have log even is daemonize=false

2008-12-29 Thread CG
Hi, all I am using Django 1.02 + lighttpd , and I run my django app in fastCGI mode using the following runfcgi method=prefork socket=/tmp/socket.sock pidfile=/var/run/process.pid outlog=/var/log/lighttpd/out.log out.log is created but there is nothing inside. Later , I try with daemonize=fal

Re: working with a returned object inside another class

2008-12-29 Thread Daniel Roseman
On Dec 29, 11:04 pm, garagefan wrote: > awesome... it was all in that [:1]! > > now, next issue... > > "OperationalError at /admin/galleries/gallery/ > (1054, "Unknown column 'galleries_gallery.status' in 'field list'")" > > i just added the status field as i wasn't worried about any of that > pr

Re: select childless parents, i.e. base with no derived classes in model inheritance

2008-12-29 Thread pk
Alex, First I made a mistake in the original post. The first query returns *nothing*, not "all places". This is the correct "question: 1) print Place.objects.filter(restaurant__isnull=True).count() returns 0 and 2) print Place.objects.filter (restaurant__serves_hotdog__isnull=True).count() wo

Re: working with a returned object inside another class

2008-12-29 Thread garagefan
Thanks, that worked perfectly. right now i can lose the data as i'm still learning this all. I will have to look into editing the DB via the shell for future fixes On Dec 29, 11:20 pm, Daniel Roseman wrote: > On Dec 29, 11:04 pm, garagefan wrote: > > > awesome... it was all in that [:1]! > > >

Re: caching...mechanism

2008-12-29 Thread Jeff Anderson
Vignesh.isquare wrote: > I find that caching the pages records lesser number of page views than > what actually happensthis causes fall in the revenue for the site. > > What caching mechanism should be followed so that the no page view is > lost from the analytics perspective... > I'd follow

Re: a error occurs while use comment framework

2008-12-29 Thread James Bennett
On Mon, Dec 29, 2008 at 3:38 AM, Shuge Lee wrote: > return render_to_response( 'a.html', {'obj': obj, 'category': > Category} ) > > a.html > ... > {% load comments %} > {% render_comment_form for category %} The problem may be that you are passing Category -- the model which represents all categ