Re: Nesh Thumbnail - Installation problem

2006-11-06 Thread Mark Jarecki

Thanks guys

Ended up that the Python Imaging Library was not correctly installed.  
It all works now!

Cheers


On 07/11/2006, at 2:15 AM, Nebojsa Djordjevic wrote:


* Frankie Robertson wrote, On 06.11.2006 12:59:
> On 06/11/06, Gabriel Puliatti <[EMAIL PROTECTED]> wrote:
>> On Mon, 2006-11-06 at 10:07 +, Frankie Robertson wrote:
>>> I think the "class Foo(models.Meta):" in the example is a probably
>>> typo or something. I've used ImageWithThumbnailField in in a normal
>>> model and I suggest that you do too.
>> Correct me if I'm wrong, but isn't class models.Meta back from before
>> magic-removal?

> A quck trip to the old docs
> (http://www.djangoproject.com/documentation/0_91/model_api/) reveals
> that if it was pre-MR it would be meta.Model. So yeah, it's some sort
> of mangulation of some version. I would correct it but I tried to sign
> up to the trac and I couldn't log in afterwards.

Heh, definitely a typo :), it is fixed now (models.Meta => models.Model)

And for trac log in ... well I don't know why anybody can't login  
(except me), I probably messed up account-manager
set-up somehow ;). Anon ticket posting is enabled, only wiki changes  
are forbidden (I can easily delete ticket changes,
but reverting a wiki changes is a bit more pain).


-- 
Nebojša Đorđević - nesh, ICQ#43799892
Studio Quattro - Niš - Serbia
http://studioquattro.biz/ | http://trac.studioquattro.biz/djangoutils/
Registered Linux User 282159 [http://counter.li.org]




--~--~-~--~~~---~--~~
 You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Newbie DB question

2006-11-06 Thread Jay Parlar

On 11/6/06, Russell Keith-Magee <[EMAIL PROTECTED]> wrote:
 > Also, you might want to look at the SQLAlchemy branch - This branch is
> reworking the Django ORM to use SQLAlchemy, which might open some
> different avenues for accessing views. This branch is still quite new,
> but if you're feeling adventurous and you have an itch that needs
> scratching, dive in and help.
>

I don't think the SQLAlchemy  branch has actually had any work done on
it yet. The trunk keeps getting merged into it, but that's it in the
revision log.

Jay P.

--~--~-~--~~~---~--~~
 You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Creating a table if it doesn't exist

2006-11-06 Thread Oliver Lavery
I've just finished django-izing a big geo-database (I never ever again want to hunt for a list of states or countries), and it was terribly easy. manage.py inspectdb is quite the time-saver.Building the database is non-trivial however, and the SQL for building the schema was some clever constraints that I doubt django will re-create if I build the schema from the model. I was thinking it'd be elegant to detect if the database exists before the models are referenced, and create it from SQL data if it doesn't. Right now if I ever move the app to another server I have a few ugly manual steps piping SQL into the db... this won't work for production.
I'm a little fuzzy on django's execution order, though. What would be the safest place to do this? Initialization code in the model module seems like the most obvious choice, but I'm a bit uncomfortable being in the dark as to how django initializes within mod_python. Where's the best spot for app initialization and teardown code?
Tia,~ol

--~--~-~--~~~---~--~~
 You received this message because you are subscribed to the Google Groups "Django users" group.  To post to this group, send email to django-users@googlegroups.com  To unsubscribe from this group, send email to [EMAIL PROTECTED]  For more options, visit this group at http://groups.google.com/group/django-users?hl=en  -~--~~~~--~~--~--~---


Re: Recording Changes minor problem

2006-11-06 Thread Matt H

On 11/6/06, SmileyChris <[EMAIL PROTECTED]> wrote:
>
> I'm not certain, but it could be that the status_id of the new object
> is returning as a string (because it's most likely come from web
> request). Try comparing the str() of each.
>
> Your __dict__ code is a bit messy - you shouldn't really need to use
> internal methods like this. How about just using getattr(self, f)
> instead.
>

Thanks for the help, comparing the items as strings solved the problem
I was having.



-- 
Matt H <[EMAIL PROTECTED]>

--~--~-~--~~~---~--~~
 You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Newbie DB question

2006-11-06 Thread Russell Keith-Magee
On 11/7/06, Russell Keith-Magee <[EMAIL PROTECTED]> wrote:
> On 11/6/06, Martin Bačovský <[EMAIL PROTECTED]> wrote:
> >
> > I have two questions I was unable to google:
> >  - Is Django going to support database views?
>
> We don't have any immediate plans to support views; however, if
> someone were to provide a patch that implemented the.

Bother. Hit send accidentally.

If someone were to provide a patch that implemented views and
integrated well with the existing codebase, I suspect it would be
considered favourably.

Also, you might want to look at the SQLAlchemy branch - This branch is
reworking the Django ORM to use SQLAlchemy, which might open some
different avenues for accessing views. This branch is still quite new,
but if you're feeling adventurous and you have an itch that needs
scratching, dive in and help.

Yours,
Russ Magee %-)

--~--~-~--~~~---~--~~
 You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Newbie DB question

2006-11-06 Thread Russell Keith-Magee
On 11/6/06, Martin Bačovský <[EMAIL PROTECTED]> wrote:
>
> I have two questions I was unable to google:
>  - Is Django going to support database views?

We don't have any immediate plans to support views; however, if
someone were to provide a patch that implemented the.

>  - Does Django support postgres database schema? I tried to add Meta
> class with db_table = 'my_sch.my_table' in my model, but unfortunately
> this is quoted by Django.

I'm a little unclear what you mean here. You should be able to point
Django at a legacy table without too much difficulty (as long as your
Django model definition is compatible with the existing table). If you
are having problems with quoting of table names, I would be interested
in hearing details.

Yours,
Russ Magee %-)

--~--~-~--~~~---~--~~
 You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



column value sums in Admin Interface

2006-11-06 Thread Picio

Hello,
Is there a way to have all the partial sums at the end of a vaues
column in the admin interface?
Something like the sql sum() function used with group by(...)?

I know that the admin interface was not built to be extended but this
is the only one thing I miss.
I have read many times the tutorial and some other docs and I don't
find a lot about how the Admin works (all the features, a doc like
model-api.txt). So, If anyone can point me in the right direction to
the admin docs (not just look/template related) I will be happy and of
course I stop posting question like this ;)

Thanks.
Picio

--~--~-~--~~~---~--~~
 You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Want to see your favorite branch merged? Here's how you can help!

2006-11-06 Thread Scanner


James Bennett wrote:
> Jacob mentioned this a while back, and I've just reiterated it on the
> dev list, but I feel like this is important enough to mention here as
> well: if there's a particular branch whose features you're clamoring
> for, and you're willing to pitch in and help test and improve it, let
> us know; we'll be very happy to give you commit rights to the branch
> so you can send in fixes and improvements directly, and it'll go a
> long way toward stabilizing your favorite Django branch and getting it
> merged into trunk for everyone to use.

I for one want to take this to heart. For a long time (about a year and
3 months) I had been using django at my job for some really interesting
and enjoyable work. The biggest thing that it needed was
row-level-permissions and I had been holding off until that was brought
in to the main trunk. However, as you point out, sitting here and
holding my breath is not going to make this go forward.

Unfortunately I have changed jobs so I no longer need to do this as
part of my day to day work, but I still need it for the umpteen
personal projects I have in progress (one of these days I may even
finish one.)

So, with that in mind I have moved stuff to the RLP branch of django
and am beginning to actually try to use it.

The three things, if I were to put a name to them, right now that I am
wanting in django are:

o row level permissions
o schema evolution
o working model inheritance.


--~--~-~--~~~---~--~~
 You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Problems installing

2006-11-06 Thread skipmartin

Anyone have any ideas? Would love to get this install off the ground...

-Andy

On Nov 5, 1:24 pm, "skipmartin" <[EMAIL PROTECTED]> wrote:
> Tearing my hair out here...
>
> Getting a "400 - Bad Request"
>
> I've done everything I can find in any tutorial... please help! Trying
> to run on Apache 1.3 with FastCGI
>
> 
> In my httpd.conf
> 
>
> 
> FastCGIExternalServer /home/user/public_html/mysite.fcgi -host
> 127.0.0.1:3033
> 
>
> 
> ServerAlias mywebsite.com
> ServerAdmin [EMAIL PROTECTED]
> DocumentRoot /home/myusername/public_html
> BytesLog domlogs/mywebsite.com-bytes_log
> ServerNamewww.mywebsite.com
>
> User myusername
> Group myusername
> CustomLog /usr/local/apache/domlogs/mywebsite.com combined
> ScriptAlias /cgi-bin/ /home/myusername/public_html/cgi-bin/
>
> Alias /media
> ./usr/local/lib/python2.4/site-packages/Django-0.95-py2.4.egg/django/contri­b/admin/media
>
> RewriteEngine On
> RewriteRule ^/(media.*)$ /$1 [QSA,L]
> RewriteCond %{REQUEST_FILENAME} !-f
> RewriteRule ^/(.*)$ mysite.fcgi/$1 [QSA,L]
>
> 
>
> I have my project set up under /home/myusername/content
> I started the fastcgi server with  ./manage.py fastcgi method=threaded
> host=127.0.0.1 port=3033
>
> I get no errors when starting the server, and I can see it running in
> my process list.
> 
> Any ideas??
> 
> Thanks!
> Andy


--~--~-~--~~~---~--~~
 You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



cgi handlers

2006-11-06 Thread Salvatore

Hello,

Can someone explain me how to use the cgi's handler
found in http://code.djangoproject.com/ticket/2407

Regards

Salvatore


--~--~-~--~~~---~--~~
 You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: is not JSON serializable - again

2006-11-06 Thread timc3

Well I got it to work by what you said.  Here is my example for those
that might come across this thread:

if errors or request.POST.has_key('preview'):
response_dict = {}
datetime_now = datetime.datetime.now()
comment = errors and '' or manipulator.get_comment(new_data)
response_dict.update({
'commentuser': str(comment.person_name),
'comment': str(comment.comment),
'hash': str(security_hash),
'success': True,
'year': datetime_now.year,
'month': str(datetime_now.strftime("%b")),
'day': datetime_now.strftime("%d")
})
if xhr:
return HttpResponse(simplejson.dumps(response_dict),
mimetype='application/javascript')
else:
return render_to_response('comments/free_preview.html', 
{
'comment': comment,
'comment_form': forms.FormWrapper(manipulator, 
new_data, errors),
'options': options,
'target': target,
'hash': security_hash,
}, context_instance=RequestContext(request))


--~--~-~--~~~---~--~~
 You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Screencast Moved

2006-11-06 Thread Picio

Hey,
I see a "1" at the end of the URL, when you think you will release the
"2" and so forth?
I was really impressed about how usefull was your screencast for me. I
saw It 3 times and I'm going to see It again because It's a good tool
to make my memory fresh!
Thanks.
Picio

2006/11/6, sago <[EMAIL PROTECTED]>:
>
> I've moved my introductory screencast to another server. Its now at:
>
> http://www2.lamptraining.com/screencast/1/
>
> In case you were looking.
>
> Ian.
>
>
> >
>

--~--~-~--~~~---~--~~
 You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Want to see your favorite branch merged? Here's how you can help!

2006-11-06 Thread Jay Parlar

On 11/6/06, Jeremy Dunck <[EMAIL PROTECTED]> wrote:
>
> On 11/6/06, James Bennett <[EMAIL PROTECTED]> wrote:
> >
> > There's been quite a bit of discussion on the developers list on the
> > various open branches in the Django repository right now, and what
>
>
> Info on the active branches:
> http://code.djangoproject.com/wiki/ActiveBranches

I've tested Row Level Permissions quite a bit. After various fixes
from Chris Long, it's working quite well now (for me).

Jay P.

--~--~-~--~~~---~--~~
 You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Recording Changes minor problem

2006-11-06 Thread SmileyChris

I'm not certain, but it could be that the status_id of the new object
is returning as a string (because it's most likely come from web
request). Try comparing the str() of each.

Your __dict__ code is a bit messy - you shouldn't really need to use
internal methods like this. How about just using getattr(self, f)
instead.


--~--~-~--~~~---~--~~
 You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: How i change Django Admin Title?

2006-11-06 Thread SmileyChris

It's explained in tutorial 2:
http://www.djangoproject.com/documentation/tutorial2/#customize-the-admin-form


--~--~-~--~~~---~--~~
 You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: (Admin) user logged in in model field

2006-11-06 Thread mrstone

Hi

I think you will find your answers here:
http://code.djangoproject.com/wiki/CookBookThreadlocalsAndUser

regards
Sten


--~--~-~--~~~---~--~~
 You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Want to see your favorite branch merged? Here's how you can help!

2006-11-06 Thread Jeremy Dunck

On 11/6/06, James Bennett <[EMAIL PROTECTED]> wrote:
>
> There's been quite a bit of discussion on the developers list on the
> various open branches in the Django repository right now, and what


Info on the active branches:
http://code.djangoproject.com/wiki/ActiveBranches

--~--~-~--~~~---~--~~
 You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Want to see your favorite branch merged? Here's how you can help!

2006-11-06 Thread James Bennett

There's been quite a bit of discussion on the developers list on the
various open branches in the Django repository right now, and what
needs to be done to get them merged into trunk for all to use and
enjoy. Right now the biggest stumbling block is a need for people who
will test and submit code for the branches they're interested in.

Jacob mentioned this a while back, and I've just reiterated it on the
dev list, but I feel like this is important enough to mention here as
well: if there's a particular branch whose features you're clamoring
for, and you're willing to pitch in and help test and improve it, let
us know; we'll be very happy to give you commit rights to the branch
so you can send in fixes and improvements directly, and it'll go a
long way toward stabilizing your favorite Django branch and getting it
merged into trunk for everyone to use.

-- 
"May the forces of evil become confused on the way to your house."
  -- George Carlin

--~--~-~--~~~---~--~~
 You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: is not JSON serializable - again

2006-11-06 Thread Oliver Lavery
Funny, I literally just finished debugging the same error.If you inspect the traceback you should see which dict element wouldn't serialize. Just walk up the traceback stack and inspect the locals. The bottom couple of stack frames will be within the JSON default handler (which generates the ever so helpful exception :P ), but a few frames up you should see a local that contains the name of the dict element that the serializer was processing.
Cheers,~olOn 11/6/06, timc3 <[EMAIL PROTECTED]> wrote:
I get a pop-up error saying "internal server error" - which my_javascript_ is handling and displaying.The full error in the page returned is:Exception Type:TypeErrorException Value:
t: t... is not JSON serializableException Location:/usr/lib/python2.4/site-packages/django/utils/simplejson/encoder.py indefault, line 258Then I get a traceback
--~--~-~--~~~---~--~~
 You received this message because you are subscribed to the Google Groups "Django users" group.  To post to this group, send email to django-users@googlegroups.com  To unsubscribe from this group, send email to [EMAIL PROTECTED]  For more options, visit this group at http://groups.google.com/group/django-users?hl=en  -~--~~~~--~~--~--~---


Re: is not JSON serializable - again

2006-11-06 Thread timc3

I get a pop-up error saying "internal server error" - which my
javascript is handling and displaying.

The full error in the page returned is:

Exception Type:
TypeError

Exception Value:
t: t... is not JSON serializable

Exception Location:
/usr/lib/python2.4/site-packages/django/utils/simplejson/encoder.py in
default, line 258

Then I get a traceback


--~--~-~--~~~---~--~~
 You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Re: Generic Views

2006-11-06 Thread Guillermo Fernandez Castellanos

Got it!!

I tried the code at home, and it did not work for me neither.

I then tried object_list instead of archive_index and it worked well.

So i tried archive_index again with the allow_future=True option and it worked.

My guess:
You are not on the America/Seattle time zone, and for the system your
blog post is in the future, so it does not show it.

Please, put your time zone in your settings.py or enable
allow_future=True in both archive_index and object_detail lines in the
urls.py.

Oh...  and try this URL:
(r'blog/(?P\d{4})/(?P\d{2})/(?P\w{1,2})/$',
  'django.views.generic.date_based.object_detail', dict(blog_dict,
month_format='%m',slug_field='slug', allow_future=True)),

instead of:
(r'^blog/(?P\d{4})/(?P[a-z]{3})/(?P\w{1,2})/(?P[-\w]+)/$',
'django.views.generic.date_based.object_detail', dict(blog_dict,
slug_field='slug', allow_future=True)),


Hope it helps,

G

On 11/6/06, Jay Parlar <[EMAIL PROTECTED]> wrote:
>
> On 11/6/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
> > Everything works perfectly except the Generic views.
> >
> > It throws a 404 error stating that there are no entrys. But there are
> > and I can physically see that using select * from the database tables.
> > If I alter the code and write a physical view it works perfectly.
>
> Could you try starting up the Python interpreter ('python  manage.py
> shell'), and access the model from there? Does that show the entries?
>
> Jay P.
>
> >
>

--~--~-~--~~~---~--~~
 You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



question on whether to cache my query or not?

2006-11-06 Thread Rob Hudson

I'm trying to reduce a SQL call to a MySQL database and I'm curious if 
Django tries to do some of what I'm doing or if my method makes sense. 
I'm making a ratings app to rate ideas (a 1 to 5 star type of thing).

In my template I want to list both the number of ratings and also the 
average rating.  So I've made those both methods of the idea model that 
I ented to call in my template.

I store the ratings so both calls don't run similar queries:

 cached_ratings = None

 # Methods related to ratings
 #
 def get_all_ratings(self):
 self.cached_ratings = 
Rating.objects.filter(content_type=self.get_content_type(), 
object_id=self.id)

 def get_num_ratings(self):
 if not self.cached_ratings:
 self.get_all_ratings()
 return len(self.cached_ratings)

 def get_average_rating(self):
 if not self.cached_ratings:
 self.get_all_ratings()
 sum = 0
 for rating in self.cached_ratings:
 sum += rating.rating
 return float(sum) / self.get_num_ratings()

Is this a reasonable thing to do?

I know SQL is optimized for SELECT COUNT(*) so if there were a template 
where I were showing the total count and not the average I'm generally 
curious what the difference in speed would be between doing a len() and 
just calling the count() on the QuerySet.

Thanks,
Rob

--~--~-~--~~~---~--~~
 You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



How i change Django Admin Title?

2006-11-06 Thread comechao

How can i change admin Title on header? Couse i want to put my client
name...

Sorry for my bad bad english...


--~--~-~--~~~---~--~~
 You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Custom SQL/Paginator problems

2006-11-06 Thread soundseeker

Hello,
here's a django/python newbie problem, which I could not resolve after
spending some time with reading and testing.

Assuming a method in my models.py

class VMergeDocsInfo(models.Model):
..
def by_categories(self):
from django.db import connection
cursor = connection.cursor()
cursor.execute("SELECT DISTINCT doc_title FROM t_merge_docs")
return [row for row in cursor.fetchall()]


... and following code in the views.py

def show_categories(request, col, direction):
paginate_by = 15
paginator =
ObjectPaginator(VMergeDocsInfo.objects.all().by_categories(),
paginate_by)

produces:
AttributeError Exception
Value: 'QuerySet' object has no attribute 'by_categories'


ok, let's go further:
def show_categories(request, col, direction):
paginate_by = 15
paginator =
ObjectPaginator(VMergeDocsInfo.objects.all()[0].by_categories(),
paginate_by)
objects = paginator.get_page(page)
return render_to_response('show_categories/index.html', {'objects':
objects })


.. (what means the '[0]') after .all?) shows the paginated table in the
mentioned way but leads to another problem:

return render_to_response('show_categories/index.html', {'objects':
objects, 'hits' : paginator.hits })

TypeError Exception
Value: count() takes exactly one argument (0 given)
Every access to the paginator attributes results in this exception.

Where's the crux, what am I doing wrong?

Thank you in advance,
robert


--~--~-~--~~~---~--~~
 You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Screencast Moved

2006-11-06 Thread sago

I've moved my introductory screencast to another server. Its now at:

http://www2.lamptraining.com/screencast/1/

In case you were looking.

Ian.


--~--~-~--~~~---~--~~
 You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Recording Changes minor problem

2006-11-06 Thread Matt H

Currently, I am overriding the save() method to keep records of all
changes made to objects. I've created a simplified example below.

I have two questions:

1) Is there an obvious better way?
2) When comparing the 'status_id' fields, they always are unequal even
when the status wasn't changed during modification. Any reason why?
Using the shell, they both return int which compare equally.

I'm using the following (simplified) models:
### start models.py ###
from django.db import models

class Note(models.Model):
created = models.DateTimeField(auto_now_add=True)
message = models.CharField(maxlength=1000)
def __str__(self):
return self.message
class Admin:
pass

class Status(models.Model):
name = models.CharField(maxlength=50)
def __str__(self):
return self.name
class Admin:
pass

class Order(models.Model):
created = models.DateTimeField(auto_now_add=True)
customer_name = models.CharField(maxlength=100)
status = models.ForeignKey(Status)
def save(self):
if self.id: # on update
note = Note()
note.message = ""
orig = Order.objects.filter(pk=self.id)[0]
for f in ['customer_name', 'status_id']:
if self.__dict__[f] != orig.__dict__[f]:
note.message += "%s was: %s; " % (f, orig.__dict__[f])
note.save()
super(Order,self).save()
def __str__(self):
return self.customer_name
class Admin:
pass
### end models.py ###

Thanks for your time.
-- 
Matt H <[EMAIL PROTECTED]>

--~--~-~--~~~---~--~~
 You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Re: Generic Views

2006-11-06 Thread Jay Parlar

On 11/6/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
> Everything works perfectly except the Generic views.
>
> It throws a 404 error stating that there are no entrys. But there are
> and I can physically see that using select * from the database tables.
> If I alter the code and write a physical view it works perfectly.

Could you try starting up the Python interpreter ('python  manage.py
shell'), and access the model from there? Does that show the entries?

Jay P.

--~--~-~--~~~---~--~~
 You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: ANN: Django's Trac installation has been upgraded

2006-11-06 Thread Jacob Kaplan-Moss

Hey again --

Duh, I forgot the most important part: if you've entered a valid name and 
email on the "settings" page (http://code.djangoproject.com/settings), the new 
spam filter will treat you much nicer.  So if you get something legitimate 
rejected, try entering a name and email.

Thanks!

Jacob

--~--~-~--~~~---~--~~
 You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



white space middleware bug

2006-11-06 Thread Patrick Lauber

Hi,

i fixed a whitespace middleware bug that had some problems with images
served:

import re
class StripWhitespaceMiddleware:
"""
Strips leading and trailing whitespace from response content.
"""
def __init__(self):
self.whitespace = re.compile('\s*\n')

def process_response(self, request, response):
print dir(response)
print response.headers
if("text" in response['Content-Type'] ):
new_content = self.whitespace.sub('\n', response.content)
response.content = new_content
return response
else:
return response


--~--~-~--~~~---~--~~
 You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



ANN: Django's Trac installation has been upgraded

2006-11-06 Thread Jacob Kaplan-Moss

Hi folks --

In an attempt to better deal with the spam problems we've been having, I've 
upgraded Django's Trac installation to a newer version.  More importantly, 
I've upgraded the spam filter plugin so, with luck, we'll be able to reject 
more spam and have fewer false-positives.

Many, many thanks for Christopher Lenz for the improvements to the spam 
filter, and many thanks to everyone who's been so patient as we've tried to 
find time to deal with this problem.

I know that a few things on the code site are still broken or looking ugly; 
I'm stupid when it comes to upgrading Trac and I always seem to break 
templates. I'll be working on that throughout the day.

Thanks again for your patience,

Jacob

--~--~-~--~~~---~--~~
 You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Generic Views

2006-11-06 Thread [EMAIL PROTECTED]

Thanks!

The models and urls are exactly the same as in the example in this
link.

http://fallingbullets.com/blog/2006/aug/06/wordpress-clone-27-seconds-part-1-40/

Actually my original models and project is different. But even the
example in the above popular tutorial fails on my desktop.

I have used the code from the zip file given at end of the article.
Ditto. Even that does not work.

I tried the example withy both sqlite and mysql. I did not touch the
code except the settings file where I added a database and modified the
address of the Templates folder to a folder where I had stored the
templates with base.html and the app_name folder ( in this case blog)
inside the templates directory.

Everything works perfectly except the Generic views.

It throws a 404 error stating that there are no entrys. But there are
and I can physically see that using select * from the database tables.
If I alter the code and write a physical view it works perfectly.

Even the URL views are correct. It is just that generic views does not
work

This is indeed puzzling.


Keith


--~--~-~--~~~---~--~~
 You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Creating one call for most recent entry, and another call for the restI have just set up a blog using the helpful tutorial over at

2006-11-06 Thread orestis

Just do


{% if forloop.first %}
...
{% else %}
...
{% endif %}


--~--~-~--~~~---~--~~
 You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Django Admin - "Site administration"

2006-11-06 Thread Don Arbow

On Nov 6, 2006, at 12:03 AM, Carl Holm wrote:

> Thanks. I should clarify that I am looking for the string "Site
> administration" which I did not find in the base_site.html
> template. Is should also mention that I am running the dev version.


The actual physical location of the string "Site administration" is  
in the locale files, try this path (xx is the two character ISO  
language code):

django/conf/locale/xx/LC_MESSAGES/django.po

Don


--~--~-~--~~~---~--~~
 You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Accessing request and session objects from templates

2006-11-06 Thread Jorge Gajon

Hi,

On 11/3/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
> I am wondering if there is a way to access request data and session object
> directly from Django templates, in the same way as {{ user }} for instance.
> I must admit I'm a bit lost with template context processors and so on...

You need to activate the "django.core.context_processors.request"
context processor. To do that you should add the following to your
settings.py file:

TEMPLATE_CONTEXT_PROCESSORS = (
'django.core.context_processors.auth',
'django.core.context_processors.debug',
'django.core.context_processors.i18n',
'django.core.context_processors.request',
)


Then, to actually have your context processors activated during a
template rendering, you must pass a RequestContext as the context for
your template. In other words, when you are returning a
render_to_response() in your view you should do it like this:

def my_view(request):
# do your stuff

return render_to_response('my_template.html',
  my_data,
  context_instance=RequestContext(request) )

Take a look at the documentation here:

http://www.djangoproject.com/documentation/templates_python/#subclassing-context-requestcontext

Hope it helps.

Regards,
Jorge

--~--~-~--~~~---~--~~
 You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Automatically starting the FastCGI server

2006-11-06 Thread orestis

Thanks!

I am trying to make lighttpd spawn the fcgi django processes using
bin-path but there seems to be a problem. Here is my setup:

fastcgi.server = (
"/myproject.fcgi" => (
"main" => (
# Use host / port instead of socket for TCP fastcgi
 "host" => "127.0.0.1",
 "port" => 3033,
#"socket" => "/home/user/mysite.sock",
"check-local" => "disable",
"bin-path" => "/home/path/to/myproject/start.sh",
"min-procs" => 1,
"max-procs" => 1,
"max-load-per-proc" => 0,
"idle-timeout" => 0
)
),
)

Any ideas ?

Anyway, I made my first shell script to easily type start/stop to
start/stop the fcgi server:

start.sh
=
PROJECTNAME=myproject
echo Starting $PROJECTNAME ...
DIR=`dirname $0`
exec $DIR/manage.py runfcgi method=prefork host=127.0.0.1 \
 port=3033 maxrequests=50 maxchildren=8 maxspare=3 minspare=1 \
 pidfile=/var/run/$PROJECTNAME.pid

==

stop.sh
=
#!/bin/bash
PROJECTNAME=myproject
echo Stopping $PROJECTNAME ...

kill `cat /var/run/$PROJECTNAME.pid`
rm -f /var/run/$PROJECTNAME.pid
=

I'm sure they can be more sophisticated... But they work for me. If
anyone can spot glaring omissions, stupid mistakes, easy improvements,
fire breathing dragons etc. let me know! Probably they can be included
to the django project templates after some tweaking, no ? Make it easy
for newbies (like me) to start the fcgi server in a new project.


--~--~-~--~~~---~--~~
 You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Generic Views

2006-11-06 Thread Guillermo Fernandez Castellanos

Hi,

Sorry... I might have written too fast, it does not seem to be your answer...
x
Please, send the models.py and the urls.py and we'll try to have a look.

G

On 11/6/06, Guillermo Fernandez Castellanos
<[EMAIL PROTECTED]> wrote:
> Hi,
>
> Try adding the option allow_empty=True in your urls:
> http://www.djangoproject.com/documentation/generic_views/#django-views-generic-date-based-archive-index
>
> It is false by default, and when there's nothing to show, it throws a
> 404 error :-)
>
> Hope it helps,
>
> G
>
> On 11/6/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
> >
> > Jay,
> >
> > Thanks for your attention.
> >
> > I tried it around 5 times now. From 2 machines both running Ubuntu
> > 6.06. Each time I populated the database fresh. I tried every
> > combination I could think off. I even changed the database from SQLite
> > to MySQL.
> >  Everytime I did things fresh. But I also tried all permutations and
> > combinations on each installtion/project
> > But generic views does not work.
> >
> > I can get it to work with classical views. I have a written a fairly
> > detailed app with classical views.
> >
> > I have a project coming up which has some 10 miniapps and comination of
> > about 40 url patterns. Writing 40 different view function does not seem
> > to be a great idea.
> >
> > I need to get Generic Views to work at any cost.
> >
> > Any tips will be appreciated
> >
> > Keith
> >
> >
> > > >
> >
>

--~--~-~--~~~---~--~~
 You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Generic Views

2006-11-06 Thread Guillermo Fernandez Castellanos

Hi,

Try adding the option allow_empty=True in your urls:
http://www.djangoproject.com/documentation/generic_views/#django-views-generic-date-based-archive-index

It is false by default, and when there's nothing to show, it throws a
404 error :-)

Hope it helps,

G

On 11/6/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
>
> Jay,
>
> Thanks for your attention.
>
> I tried it around 5 times now. From 2 machines both running Ubuntu
> 6.06. Each time I populated the database fresh. I tried every
> combination I could think off. I even changed the database from SQLite
> to MySQL.
>  Everytime I did things fresh. But I also tried all permutations and
> combinations on each installtion/project
> But generic views does not work.
>
> I can get it to work with classical views. I have a written a fairly
> detailed app with classical views.
>
> I have a project coming up which has some 10 miniapps and comination of
> about 40 url patterns. Writing 40 different view function does not seem
> to be a great idea.
>
> I need to get Generic Views to work at any cost.
>
> Any tips will be appreciated
>
> Keith
>
>
> >
>

--~--~-~--~~~---~--~~
 You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Generic Views

2006-11-06 Thread [EMAIL PROTECTED]

Jay,

Thanks for your attention.

I tried it around 5 times now. From 2 machines both running Ubuntu
6.06. Each time I populated the database fresh. I tried every
combination I could think off. I even changed the database from SQLite
to MySQL.
 Everytime I did things fresh. But I also tried all permutations and
combinations on each installtion/project
But generic views does not work.

I can get it to work with classical views. I have a written a fairly
detailed app with classical views.

I have a project coming up which has some 10 miniapps and comination of
about 40 url patterns. Writing 40 different view function does not seem
to be a great idea.

I need to get Generic Views to work at any cost.

Any tips will be appreciated

Keith


--~--~-~--~~~---~--~~
 You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Django Admin - "Site administration"

2006-11-06 Thread Karen Tracey

Carl Holm wrote:
> Thanks. I should clarify that I am looking for the string "Site
> administration" which I did not find in the base_site.html
> template. Is should also mention that I am running the dev version.

You are right, "Site administration" is not coming (directly) from any
of the admin templates.  It is being set as the template context
variable "title" in the index function in admin's main.py:

def index(request):
return render_to_response('admin/index.html', {'title': _('Site
administration')}, context_instance=template.RequestContext(request))

The default contents of the template block content_title (specified in
admin's base.html template) is then wrapping the title value, if set,
in an h1 tag:

{% block content_title %}{% if title %}{{ title|escape
}}{% endif %}{% endblock %}

So it's coming from the admin code via the base.html template.

Karen


--~--~-~--~~~---~--~~
 You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Newbie DB question

2006-11-06 Thread Martin Bačovský

I have two questions I was unable to google:
 - Is Django going to support database views? Solution i have found 
here: http://code.djangoproject.com/ticket/419 seems to be a bit tricky. 
I would rather like to create django.db.models.view which ancestors can 
produce SQL like 'CREATE OR REPLACE VIEW view_name AS .

 - Does Django support postgres database schema? I tried to add Meta 
class with db_table = 'my_sch.my_table' in my model, but unfortunately 
this is quoted by Django.

If you have any helpful idea, let me know.

Thanks,
Martin

--~--~-~--~~~---~--~~
 You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Nesh Thumbnail - Installation problem

2006-11-06 Thread Nebojsa Djordjevic

* Frankie Robertson wrote, On 06.11.2006 12:59:
> On 06/11/06, Gabriel Puliatti <[EMAIL PROTECTED]> wrote:
>> On Mon, 2006-11-06 at 10:07 +, Frankie Robertson wrote:
>>> I think the "class Foo(models.Meta):" in the example is a probably
>>> typo or something. I've used ImageWithThumbnailField in in a normal
>>> model and I suggest that you do too.
>> Correct me if I'm wrong, but isn't class models.Meta back from before
>> magic-removal?

> A quck trip to the old docs
> (http://www.djangoproject.com/documentation/0_91/model_api/) reveals
> that if it was pre-MR it would be meta.Model. So yeah, it's some sort
> of mangulation of some version. I would correct it but I tried to sign
> up to the trac and I couldn't log in afterwards.

Heh, definitely a typo :), it is fixed now (models.Meta => models.Model)

And for trac log in ... well I don't know why anybody can't login (except me), 
I probably messed up account-manager
set-up somehow ;). Anon ticket posting is enabled, only wiki changes are 
forbidden (I can easily delete ticket changes,
but reverting a wiki changes is a bit more pain).


-- 
Nebojša Đorđević - nesh, ICQ#43799892
Studio Quattro - Niš - Serbia
http://studioquattro.biz/ | http://trac.studioquattro.biz/djangoutils/
Registered Linux User 282159 [http://counter.li.org]

--~--~-~--~~~---~--~~
 You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Generic Views

2006-11-06 Thread Jay Parlar

On 11/5/06, Keith Mallory <[EMAIL PROTECTED]> wrote:
> I wrote a blog using classic views (writing  functions for reach
> URLpattern). It works perfectly. However when I tried to convert it using
> the same database using generic views, it does not work.
>
>
> Then  I tried using the updated code from the following link
> http://fallingbullets.com/blog/2006/aug/06/wordpress-clone-27-seconds-part-1-40/
>
>
> as well as RossP's updated blog.
>
> I have cut and pasted the code. It is throwing up 404 error saying that
> there are no entrys. But I can see at 10 of them using my admin interface.
>
> In fact I followed the instructions all over again twice and still no avail.
>
> I know I am doing something silly. But what can that be. Has anyone had
> similar experience? The code is ditto from fallingbullets article. Note, I
> have entrys in the database 2) The URLS are matching. I have my base.html
> and entry_archive.html and entry_detail.html at the right places.
>
> Is there anything which I need to do in settings.py to enable Generic Views.
> I did not see anything in Documentation.

So are you using your original models.py, plus the new urls.py from
the webpage? Or did you completely scrap your original database, and
start fresh with what's on the webpage?

Jay P.

--~--~-~--~~~---~--~~
 You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Session problems

2006-11-06 Thread Jakub Labath

Hi All,

Just to clarify few things I'm not setting either cookie nor do I have
have modified the sessions framework. The sessionid in question is the
one that django.auth sets when one logs-in into the admin. I am using
caching but not site wide I use the cache_page decorator on few views.

Are you saying that if any of the views that have cache_page decorator
were to modify the sessionid cookie, that would then get served to all
clients that would go to that view?

Hmm ... something to look into I'll research further.

Thanks

On 11/3/06, Bill de hOra <[EMAIL PROTECTED]> wrote:
>
> Bill de hOra wrote:
> >
> > http://www.djangoproject.com/documentation/cache/
>
> One other thing; be sure you are only ever issuing the initial cookie
> with POST request and not a GET.
>
> cheers
> Bill
>
> >
>


-- 
Jakub Labath

--~--~-~--~~~---~--~~
 You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Displaying ManyToMany relation in template

2006-11-06 Thread Nicolas Steinmetz

Nicolas Steinmetz wrote:

> In my views.py, do I need to set/declare anything about this ?
> 
> If I just add the previous piece of code, I have a template error with
> this line highlighted - I do not have it with me :-/ :
> {% for category in  post.category.all %}

ok my fault, I already had some variable called category so it was the mess.

After some code cleaning, it's ok - sorry for the noise.

Nicolas


--~--~-~--~~~---~--~~
 You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Creating one call for most recent entry, and another call for the restI have just set up a blog using the helpful tutorial over at

2006-11-06 Thread RajeshD

Hi Andy,

Try printing out the forloop counter inside the loop to help debug
this:

Counter: {{ forloop.counter }}

-Rajesh


--~--~-~--~~~---~--~~
 You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: how to do complex query which filters on method not database field

2006-11-06 Thread Ivan Sagalaev

Rachel Willmer wrote:
> I have a complicated query which should return the subset of a table
> whose objects match one of several conditions.
> 
> What's the easiest way of doing this, given that I can't just do a SQL
> statement, because some of the conditions require me to feed the
> object's values into a function to evaluate it.
> 
> I've had a few ideas:
> 
> a) Pulling back the entire table, and deleting from the query set
> those objects which don't match.
> 
> Is this possible? I get the feeling that using delete() would delete
> the entry from the db, which i don't want to do.

You shouldn't actually delete anything from a full list of records. Just 
filter it in a new list (and then Python promptly discards unneeded 
records from memory):

 records = [r for r in Model.objects.all() if r.check_condition()]

(this assumes that check_condition returns something sensibly evaluating 
to True or False)

> I can't find any documentation to show how to union 2 querysets - is
> it possible?

Since you anyway will get them in memory entirely you can just create 
actual lists from querysets and then concatenate them (and may be check 
for duplicates if needed):

 result = list(queryset1) + list(queryset2)

But your option a) anyway looks more reasonable.

> c) Writing a custom Manager.

Managers don't do anything magical, you still have to choose wither a) 
or b) way. Whether to place this code into a Manager or just let it lay 
somewhere in the code is the whole different question, it's the matter 
of convenience.

--~--~-~--~~~---~--~~
 You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Automatically starting the FastCGI server

2006-11-06 Thread Grigory Fateyev

Hello Norbert Wojtowicz!
On Sun, 05 Nov 2006 23:21:31 -0600 you wrote:

> I am also interested in how others have solved this. I hope I'm not 
> hijacking the thread, but could we see your Debian approach to this
> problem?

init.d file:
#! /bin/sh
### BEGIN INIT INFO
# Provides:  anastas-fcgi
# Required-Start:$local_fs $remote_fs
# Required-Stop: $local_fs $remote_fs
# Default-Start: 2 3 4 5
# Default-Stop:  S 0 1 6
# Short-Description: Anastasia FastCGI daemon
# Description:   This file should be used to construct scripts to be
#placed in /etc/init.d.
### END INIT INFO

set -e

PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
DESC="Anastasia FastCGI daemon"
NAME=manage.py
DAEMON=/var/www/vhosts/domain.com/anastas/$NAME
SCRIPTNAME=/etc/init.d/anastas-fcgi
PIDFILE=/var/www/vhosts/domain.com/anastas/anastas-fcgi.pid

MINSPARE=5
MAXSPARE=10
MAXCHILDREN=100

# Gracefully exit if the package has been removed.
test -x $DAEMON || exit 0

#
#   Function that starts the daemon/service.
#
d_start() {
start-stop-daemon --start --quiet -c anastas7
--pidfile=$PIDFILE \ --exec $DAEMON -- runfcgi host=127.0.0.1 port=8000
daemonize=true \ pidfile=$PIDFILE \
minspare=$MINSPARE maxspare=$MAXSPARE
maxchildren=$MAXCHILDREN \ method=prefork \
|| echo -n " already running"
}

#
#   Function that stops the daemon/service.
#
d_stop() {
start-stop-daemon --stop --quiet -c anastas7 --pidfile=$PIDFILE
\ || echo -n " not running"
}

case "$1" in
  start)
echo -n "Starting $DESC: $NAME"
d_start
echo "."
;;
  stop)
echo -n "Stopping $DESC: $NAME"
d_stop
echo "."
;;
  restart|force-reload)
#
#   If the "reload" option is implemented, move the
"force-reload" #   option to the "reload" entry above. If not,
"force-reload" is #   just the same as "restart".
#
echo -n "Restarting $DESC: $NAME"
d_stop
# One second might not be time enough for a daemon to stop,
# if this happens, d_start will fail (and dpkg will break if
# the package is being upgraded). Change the timeout if needed
# be, or change d_stop to have start-stop-daemon use --retry.
# Notice that using --retry slows down the shutdown process
somewhat. sleep 2
d_start
echo "."
;;
  *)
echo "Usage: $SCRIPTNAME {start|stop|restart|force-reload}" >&2
exit 3
;;
esac

exit 0

then:
sudo update-rc.d anastas-fcgi defaults

-- 
Всего наилучшего! Григорий
greg [at] anastasia [dot] ru
Письмо отправлено: 2006/11/06 16:38

--~--~-~--~~~---~--~~
 You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: How would you do this on Django?

2006-11-06 Thread Carlos Yoder

Thank you Frankie.

I guess I'm OK with the i18n part of the idea. Not so sure about the
'best practises' to implement, though (that was the general idea of
this post).

But many thanks for the links anyway. Regards,

-- 
Carlos Yoder
http://blog.argentinaslovenia.com/


>> Hello people, I have a question for you.
>>
>> I've been developing (in my head) a multilang, multisite, multiuser
>> blog application, that -at least for me- sounds like a very cool idea.
>> On to the details:
>>
>> The project is actually a group of sister websites dealing with a
>> common subject, localised for different languages/cultures. It's
>> centered around the old "you learn a thing a day" saying, so Authors
>> would be able to post the thing they learned that day on a -usually
>> small- post. Of course, they would have to be able to post in many
>> different languages (initially either English, Slovenian or Spanish).
>>
>> As to URLs, I'd need to support at least the following three schemes:
>>
>>  * Language codes mapped to directories (http://maindomain.com/en/ and
> > http://maindomain.com/sl/ and  http://maindomain.com/es/)
> >  * Language codes mapped to subdomains (http://en.maindomain.com/ and
> > http://sl.maindomain.com/ and http://es.maindomain.com)
> >  * Completely different starting URLs (http://athingaday.com/ and
> > http://nekajnovega.com and httpd://algonuevo.com/
> >
> > As to the post themselves, each different version would have to be
> > aware of its 'sister' posts in other languages, but that's already a
> > template thing I believe.
> >
> > It goes without saying that these multiple localised versions would
> > have to get data off a single database.
> >
> > OK, enough details for now, we all have work to do :-)
> >
> > Anyway, I thought about the "sites" app on Django, but never used it
> > and I'm at a loss. I must admit I first too a look at Polyglot, a
> > plugin for Wordpress, but I really want to stay away from PHP and do
> > things right.
> >
> > Could anyone help me a bit on how to approach this? Thanks a million,
> > and best regards,
>
> I personally know nothing about this. But I will give you some links
> to get started (in order of importance):
>
> http://www.djangoproject.com/documentation/i18n/
> http://trac.studioquattro.biz/djangoutils/wiki/TranslationService
> http://trac.studioquattro.biz/djangoutils
>
> That might give you a some general ideas.
>
> --
> http://grimboy.co.uk
>

--~--~-~--~~~---~--~~
 You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



how to do complex query which filters on method not database field

2006-11-06 Thread Rachel Willmer

I have a complicated query which should return the subset of a table
whose objects match one of several conditions.

What's the easiest way of doing this, given that I can't just do a SQL
statement, because some of the conditions require me to feed the
object's values into a function to evaluate it.

I've had a few ideas:

a) Pulling back the entire table, and deleting from the query set
those objects which don't match.

Is this possible? I get the feeling that using delete() would delete
the entry from the db, which i don't want to do.

b) Doing multiple querysets and making a union out of the results.

I can't find any documentation to show how to union 2 querysets - is
it possible?

c) Writing a custom Manager.

Any pointers welcome
Rachel

--~--~-~--~~~---~--~~
 You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: is not JSON serializable - again

2006-11-06 Thread Rachel Willmer

What specifically does the error message say is not JSON serializable?

Try setting it to be a string in the response dict...

For example:
 if errors or request.POST.has_key('preview'):
 response_dict = {}
# datetime_now = datetime.datetime.now()
 datetime_now = str(datetime.datetime.now())
... etc...

Rachel

--~--~-~--~~~---~--~~
 You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: How would you do this on Django?

2006-11-06 Thread Frankie Robertson

On 06/11/06, Carlos Yoder <[EMAIL PROTECTED]> wrote:
>
> Hello people, I have a question for you.
>
> I've been developing (in my head) a multilang, multisite, multiuser
> blog application, that -at least for me- sounds like a very cool idea.
> On to the details:
>
> The project is actually a group of sister websites dealing with a
> common subject, localised for different languages/cultures. It's
> centered around the old "you learn a thing a day" saying, so Authors
> would be able to post the thing they learned that day on a -usually
> small- post. Of course, they would have to be able to post in many
> different languages (initially either English, Slovenian or Spanish).
>
> As to URLs, I'd need to support at least the following three schemes:
>
>  * Language codes mapped to directories (http://maindomain.com/en/ and
> http://maindomain.com/sl/ and  http://maindomain.com/es/)
>  * Language codes mapped to subdomains (http://en.maindomain.com/ and
> http://sl.maindomain.com/ and http://es.maindomain.com)
>  * Completely different starting URLs (http://athingaday.com/ and
> http://nekajnovega.com and httpd://algonuevo.com/
>
> As to the post themselves, each different version would have to be
> aware of its 'sister' posts in other languages, but that's already a
> template thing I believe.
>
> It goes without saying that these multiple localised versions would
> have to get data off a single database.
>
> OK, enough details for now, we all have work to do :-)
>
> Anyway, I thought about the "sites" app on Django, but never used it
> and I'm at a loss. I must admit I first too a look at Polyglot, a
> plugin for Wordpress, but I really want to stay away from PHP and do
> things right.
>
> Could anyone help me a bit on how to approach this? Thanks a million,
> and best regards,

I personally know nothing about this. But I will give you some links
to get started (in order of importance):

http://www.djangoproject.com/documentation/i18n/
http://trac.studioquattro.biz/djangoutils/wiki/TranslationService
http://trac.studioquattro.biz/djangoutils

That might give you a some general ideas.

>
> --
> Carlos Yoder
> http://blog.argentinaslovenia.com/
>
> >
>


-- 
http://grimboy.co.uk

--~--~-~--~~~---~--~~
 You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Nesh Thumbnail - Installation problem

2006-11-06 Thread Frankie Robertson

On 06/11/06, Gabriel Puliatti <[EMAIL PROTECTED]> wrote:
> On Mon, 2006-11-06 at 10:07 +, Frankie Robertson wrote:
> > I think the "class Foo(models.Meta):" in the example is a probably
> > typo or something. I've used ImageWithThumbnailField in in a normal
> > model and I suggest that you do too.
>
> Correct me if I'm wrong, but isn't class models.Meta back from before
> magic-removal?

A quck trip to the old docs
(http://www.djangoproject.com/documentation/0_91/model_api/) reveals
that if it was pre-MR it would be meta.Model. So yeah, it's some sort
of mangulation of some version. I would correct it but I tried to sign
up to the trac and I couldn't log in afterwards.

Yup.

>
> --
> No violence, gentlemen -- no violence, I beg of you!  Consider the
> furniture!
>-- Sherlock Holmes
>
> Gabriel Puliatti
> [EMAIL PROTECTED]
> predius.org
>
>
>


-- 
http://grimboy.co.uk

--~--~-~--~~~---~--~~
 You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Nesh Thumbnail - Installation problem

2006-11-06 Thread Gabriel Puliatti
On Mon, 2006-11-06 at 10:07 +, Frankie Robertson wrote:
> I think the "class Foo(models.Meta):" in the example is a probably
> typo or something. I've used ImageWithThumbnailField in in a normal
> model and I suggest that you do too. 

Correct me if I'm wrong, but isn't class models.Meta back from before
magic-removal?

-- 
No violence, gentlemen -- no violence, I beg of you!  Consider the
furniture!
-- Sherlock Holmes

Gabriel Puliatti
[EMAIL PROTECTED]
predius.org


signature.asc
Description: This is a digitally signed message part


How would you do this on Django?

2006-11-06 Thread Carlos Yoder

Hello people, I have a question for you.

I've been developing (in my head) a multilang, multisite, multiuser
blog application, that -at least for me- sounds like a very cool idea.
On to the details:

The project is actually a group of sister websites dealing with a
common subject, localised for different languages/cultures. It's
centered around the old "you learn a thing a day" saying, so Authors
would be able to post the thing they learned that day on a -usually
small- post. Of course, they would have to be able to post in many
different languages (initially either English, Slovenian or Spanish).

As to URLs, I'd need to support at least the following three schemes:

 * Language codes mapped to directories (http://maindomain.com/en/ and
http://maindomain.com/sl/ and  http://maindomain.com/es/)
 * Language codes mapped to subdomains (http://en.maindomain.com/ and
http://sl.maindomain.com/ and http://es.maindomain.com)
 * Completely different starting URLs (http://athingaday.com/ and
http://nekajnovega.com and httpd://algonuevo.com/

As to the post themselves, each different version would have to be
aware of its 'sister' posts in other languages, but that's already a
template thing I believe.

It goes without saying that these multiple localised versions would
have to get data off a single database.

OK, enough details for now, we all have work to do :-)

Anyway, I thought about the "sites" app on Django, but never used it
and I'm at a loss. I must admit I first too a look at Polyglot, a
plugin for Wordpress, but I really want to stay away from PHP and do
things right.

Could anyone help me a bit on how to approach this? Thanks a million,
and best regards,

-- 
Carlos Yoder
http://blog.argentinaslovenia.com/

--~--~-~--~~~---~--~~
 You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Get paid to do Django on Times Square.

2006-11-06 Thread [EMAIL PROTECTED]

It looks like my efforts to make python our base service oriented
architecture technology and Django as the core web framework is coming
through. I now need to hire a New York based developer to be the tech
lead for much of this effort. I can't reveal the company name yet but
you've heard of us and this is a high profile effort.

If you'd like to apply for the spot, you need to be able to
demonstrate strong python skills and actual usage of Django to build
real systems. This is core infrastructure work so awareness of role
based capabilty authorizations, talking to disparate
services/applications on various platforms (windows & linux), and
general management of complex interconnected systems is going to be
key. Nothing we do will be stand alone.

We're definitely an Agile shop and are trying to move even further
in that regard. Experience here is a plus as well. You'll need to be
able to work within and extend our new architecture and be able to
clearly specify requirements to other developers. Your team will exist
in New York as well as Bangkok (yes there will be some opportunity to
travel to BKK later) so co-ordinating across time zones means you have
to know what you're talking about and be able to make yourself
understood. Its an issue of delegation and coaching as much as pure
technical ability.

Please send me your resume, cv, and salary requirements. I will
make sure that all qualified candidates get a response. Thanx for your
consideration,

-- Ben


--~--~-~--~~~---~--~~
 You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Re: Bugtracker sucks?

2006-11-06 Thread James Bennett

On 11/6/06, orestis <[EMAIL PROTECTED]> wrote:
> If there is an option of signing up, why don't we close the
> non-logged-in user ticket submission ?

Largely because A) I'm still working on getting the user sign-up stuff
the way we want it,  and B) I don't know if we want to go the
completely closed route.


-- 
"May the forces of evil become confused on the way to your house."
  -- George Carlin

--~--~-~--~~~---~--~~
 You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Displaying ManyToMany relation in template

2006-11-06 Thread Nicolas Steinmetz

Nikolaus Schlemm a écrit :
> hi,
> 
> try something like the following:
> 
>> {% if latest_posts %}
>> {% for post in latest_posts %}
>> 
>> {{ post.title }}
>> 
>> publié le {{
>> post.pub_date|date:"l d F Y à H:i" }}, dans la catégorie
> 
> {% for category in  post.category.all %}
>   {{ category.title }}
> {% endfor %}

In my views.py, do I need to set/declare anything about this ?

If I just add the previous piece of code, I have a template error with 
this line highlighted - I do not have it with me :-/ :
{% for category in  post.category.all %}

Nicolas


--~--~-~--~~~---~--~~
 You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Bugtracker sucks?

2006-11-06 Thread orestis

If there is an option of signing up, why don't we close the
non-logged-in user ticket submission ?

Anyway, Akismet still leaves a lot of spam in.


--~--~-~--~~~---~--~~
 You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Problems with template IFs and generic views

2006-11-06 Thread Ivan Sagalaev

[EMAIL PROTECTED] wrote:
> I'm using django.views.generic.list_detail.object_detail to show a
> page. Beside text it has optional "leftmenu" field. What I want to do
> is to show it in a html block if it exists (there is somethign in
> "leftmenu"). The problem is that it shows always or never.
> 
> I have:
> ###
> {% if object.leftmenu %}
> {% block leftmenu %}
> 
> 
> Menu Strony
> 
> {{ object.leftmenu|restructuredtext }}
> 
> 
> {% endblock %}
> {% endif %}
> 
> And it shows always.

This might be or might not be the case but what is definitely wrong here 
is that all content in a template extending some parent template should 
go inside {% block %}. Put your {% if %} like this:

 {% block leftmenu %}
 {% if object.leftmenu %}
 {% endif %}
 {% endblock %}

I believe that the other way around {% if %} is just ignored...

--~--~-~--~~~---~--~~
 You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Nesh Thumbnail - Installation problem

2006-11-06 Thread Mark Jarecki

Hi all,

I'm new to Django and Python - been at it for 4 days now - and have  
found it quite straightforward. However, I've come into difficulty  
trying to install Nesh Thumbnail according to the instructions at:  
http://trac.studioquattro.biz/djangoutils/wiki/AppInst

And for the life of me I can't get it to work. I've tried many other  
combinations as well, but to no avail - i.e. placing the files in  
different directories, calling the files in a variety of fashions  
from model.py.

At present, I'm calling it from my model.py file, in my app folder  
called 'Main', with "from nesh.thumbnail import field". When I run  
manage.py syncdb I get no errors. Then when i log into my Admin site,  
all the links to my model objects have disappeared. When I delete  
"from nesh.thumbnail import field" the Admin returns to normal. I've  
not called nesh.thumbnail anywhere else - I.e. settings.py.

The file structure of the project is:

 >>MyProject
>>Main
>>nesh
>>thumbnails


I'm running on OSX 10.4.8, Python 2.5, Latest Apache 2.2, Latest  
mod_python, Latest Postgres, Django Latest SVN, Nesh Utils/Thumbnail  
Latest SVN. If that helps.

Can someone give me explicit directions on how to get it installed?  
I.e. exactly where to put the files, where on the Pythonpath they  
should live relative to my Project files, exactly how to call them  
from my model (want the ImageWithThumbnailField for my Admin pages),  
any other settings to be aware of, common mistakes.

I was also wondering what:
class Foo(models.Meta):

does as per the example on http://trac.studioquattro.biz/djangoutils/ 
wiki/Thumbnail

as opposed to:
class Meta:

and

class Foo(models.Model):


Cheers and thanks in advance!

Mark

--~--~-~--~~~---~--~~
 You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Django Admin - "Site administration"

2006-11-06 Thread Carl Holm

Thanks. I should clarify that I am looking for the string "Site 
administration" which I did not find in the base_site.html
template. Is should also mention that I am running the dev version.


James Bennett wrote:
>> Carl Holm wrote:
>> It's probably obvious, but after searching the docs and beyond, I have
>> not been able to locate the origin of  "Site administration",
>> which appears in the title and as an h1 heading on the initial admin page.
>> 
>
> It's in this template:
> http://code.djangoproject.com/browser/django/trunk/django/contrib/admin/templates/admin/base_site.html
>
>   

--~--~-~--~~~---~--~~
 You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---