Re: DB queries with filter and exclude

2007-08-07 Thread Nis Jørgensen

[EMAIL PROTECTED] skrev:
> Wow, thanks for the reply. I can't get this to work though--I get an
> "iteration over non-sequence". Can you take a look?
>   
author.book_set is a Manager. You need author.book_set.all()  (or
author.book_set.all in a template) to get a QuerySet which you can
iterate over.

Nis



--~--~-~--~~~---~--~~
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: startproject errors with Ubuntu

2007-08-07 Thread Brett Parker

On Mon, Aug 06, 2007 at 11:08:08AM -0700, john wrote:
> 
> On Aug 6, 9:48 am, Brett Parker <[EMAIL PROTECTED]> wrote:
> > On Mon, Aug 06, 2007 at 06:07:16AM -0700, john wrote:
> >
> > > On Aug 5, 10:46 pm, "James Bennett" <[EMAIL PROTECTED]> wrote:
> > > > On 8/5/07, john <[EMAIL PROTECTED]> wrote:
> >
> > > > > thks - the tutorial shows the .py extension and that was giving the
> > > > > error.
> >
> > > > The file's name is 'django-admin.py', not 'django-admin', and the
> > > > tutorial is correct; the problem was that you did not have the
> > > > executable bit set on django-admin.py, and so you did not have
> > > > permission to execute that file from the command line.
> >
> > > Okay,  but who is the Ubuntu package manager contact  for django? -
> > > how can we get the packaging straightened out so new people to django
> > > don't face the same problem I did.  As I mentioned before, it seems
> > > the packaging can be improved.
> >
> > Err, it's not an "official" ubuntu package, it's a compile of the debian
> > package you can find that with a simple "apt-cache show
> > python-django". Bugs, apparently, should be mailed to
> > "[EMAIL PROTECTED]", I'm in the "Original-Maintainer" field.
> >
> > The packaging just uses python support - there's nothing clever going on
> > there - the only thing we (me and raphael, my sponsor for that package)
> > do is rename django-admin.py to django-admin and drop it in /usr/bin for
> > convienience. (Oh, and change /usr/bin/env python -> /usr/bin/python,
> > modify the bash completion to deal with django-admin.
> >
> > If you've got any suggestions for the packaging, I'm willing to listen!
> 
> 
> just as suggestions:
> 1) the /django/bin/ files are in 3 locations (perhaps because I
> loaded from respository and from tarball) - the 3 locations are:
> a) /usr/lib//python2.5/site-packages/ 

Shouldn't be there - I'm guessing that's your tarball version...

> b) /usr/lib/python-django/..   (the folder is symlinked but all
> the files are still underneath.

It's just a symlink, and it's because it's a lot easier to type than...

> c) /usr/share/python-support/.

/usr/share/python-support/python-django/django/bin/

> if there's a good reason for them to be in all 3 places fine, just is
> confusing
> 
> 2) whether ".py" or not to be ".py" doesn't really matter - just an
> explanation on the tutorial for debian/ubuntu users will help avoid
> the constant frustration I had trying to get it to run (and to avoid
> future support msgs on the same issue).

Agreed.

> thks for the support - I am now exploring Django and seeing if it can
> convert me from rails.

Cool,
-- 
Brett Parker

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Accessing {{ request }} in the login view

2007-08-07 Thread Ross Poulton

I have a custom context processor that sets request.myfield, so it can
be used elsewhere such as views, templates, etc. It's a very regularly
accessed piece of information that is required just about everywhere,
so a middleware seemed to be a nifty place to put it.

My TEMPLATE_CONTEXT_PROCESSORS contains
django.core.context_processors.request, and it appears to be working
correctly in most places.

However, the login view (django.contrib.auth.views.login), which calls
RequestContext(request), doesn't appear to have {{ request }}
available in the template - request.path, request.myfield,
request.user are all just non-existant.

It's got to be something simple that I've missed. Does anybody have
any suggestions?

Ross


--~--~-~--~~~---~--~~
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: Question about {% url %}

2007-08-07 Thread Margaret

anyone resolved this question???

On 7/29/07, Malcolm Tredinnick <[EMAIL PROTECTED]> wrote:
>
> On Sun, 2007-07-29 at 06:55 +, ZhangshenPeng wrote:
> > when you use url pattern [a-z]+ and named it , then use in {% url
> > %} ,everything is all right .
> > when I change
> > [a-z]+
> > into
> > (title|attachment|date)
> > django report error "unbalanced parenthesis".
> > how to fix my code to do the right thing ?
> > think
> >
> > code as below
> > ###
> > url.py:
> >
> > urlpatterns = patterns('',
> > url(
> >   r'^order_by_(?P-?(title|attachment|date))/(?
> > P[0-9]+)/',
> >   object_list,
> >   name="white_paper_list"
> >),
> > )
>
> I suspect this is caused by the slightly limited reverse reg-exp parsing
> we have at the moment. Ticket #2977 has a patch to try and fix this.
> Hopefully I'll be checking in something very close to that this week. In
> the meantime, you might want to try the patch on your local system to
> see if it does handle that case.
>
> Regards,
> Malcolm
>
>
>
> >
>


-- 
[EMAIL PROTECTED]
13585201588

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Changing filter_interface for groups in User model?

2007-08-07 Thread Jarek Zgoda

In my Django-0.96, groups when editing User object are displayed using
HTML list allowing multiple selections. Can I (anyhow) change the
display to one of filter interfaces?

Cheers
J.


--~--~-~--~~~---~--~~
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: Question about {% url %}

2007-08-07 Thread Margaret

the question is

 r'^order_by_(?P-?(title|attachment|date))/(?P[0-9]+)/',

regex error

On 7/29/07, Malcolm Tredinnick <[EMAIL PROTECTED]> wrote:
>
> On Sun, 2007-07-29 at 06:55 +, ZhangshenPeng wrote:
> > when you use url pattern [a-z]+ and named it , then use in {% url
> > %} ,everything is all right .
> > when I change
> > [a-z]+
> > into
> > (title|attachment|date)
> > django report error "unbalanced parenthesis".
> > how to fix my code to do the right thing ?
> > think
> >
> > code as below
> > ###
> > url.py:
> >
> > urlpatterns = patterns('',
> > url(
> >   r'^order_by_(?P-?(title|attachment|date))/(?
> > P[0-9]+)/',
> >   object_list,
> >   name="white_paper_list"
> >),
> > )
>
> I suspect this is caused by the slightly limited reverse reg-exp parsing
> we have at the moment. Ticket #2977 has a patch to try and fix this.
> Hopefully I'll be checking in something very close to that this week. In
> the meantime, you might want to try the patch on your local system to
> see if it does handle that case.
>
> Regards,
> Malcolm
>
>
>
> >
>


-- 
[EMAIL PROTECTED]
13585201588

--~--~-~--~~~---~--~~
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: full-text indexing

2007-08-07 Thread Kai Kuehne

http://www.rkblog.rk.edu.pl/w/p/django-lupy/

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Overriding save methot problem

2007-08-07 Thread Arnaldur

Hi

I'm trying to override the save method in the django admin interface,
I have no problems getting values for the normal fields but when I try
to access the values for multiple choice fields (many to many fields),
I only get the last values, not the new values selected. This goes for
both calling object.field.values() and going through the _meta.fields.

Is there a way to access the parameters submitted from the admin form
to the model's save method?

A


--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Dynamic values for BaseForm

2007-08-07 Thread Robert

Hi,

I'm using form_for_model & form_for_instance with my specific
BaseForm.

The problem is that depending on some value, I need to display form
with
values limited.

There's a model:

class SomeGroup(models.Model):
name = models.CharField(primary_key=True)

class Place(models.Model):
name = models.CharField()
display_for = models.ManyToManyField(SomeGroup)

class News(models.Model):
somegroup = models.ForeignKey(SomeGroup)
content = models.TextField()

For example if group name is "children" the form will display/validate
only values
for which display_for has an appropriate SomeGroup(name=children)
value.

I get gropu name from url.. so it's  a variable in my view.

For example:
/children/news/add/ which means: Add a new news in children group,
when displaying
form display/validate only places available for Somegroup=children.

This can be modified by self.fields['place'].choices = [(p.id, p.name)
for p in Place.objects.filter(display_for__pk=somegroup)

I've read the:
http://groups.google.com/group/django-users/browse_frm/thread/79e4c8fda31388e3/66b7a638054d68bc?lnk=gst=base_fields=1#66b7a638054d68bc
but it doesn't work as I'm getting error that the form got multiple
value for somegropu key.

Here's what I'm doing:

NewsForm = form_for_instance(News, form=NewsOfferForm)

if request.method == "POST":
form = NewsForm(request.POST, somegroup=somegroup)
if form.is_valid()

else:
form = NewsForm(somegroup=somegroup) # this one works fine, the
problem appears on POST

My forms.py
--
class NewsBaseForm(BaseForm):
def __init__(self, somegroup, *args, **kwargs):
super(NewsBaseForm, self).__init__(*args, **kwargs)
self.fields['place'].choices = [(p.id, p.name) for p in
Place.objects.filter(display_for__pk=somegroup)]

It would be the best If I could use the "somegroup" variable name in
my url,
and If I could provide it to the form under the same name so the form
can use it.( I may set it in my view via
form.cleaned_data['somegroup'] as well.) Also I don't want to
display the "somegroup" selector in form (I know how to work out this
problem).

Can anyone please help?

Thanks,

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
-~--~~~~--~~--~--~---



Re: Question about {% url %}

2007-08-07 Thread Tim Chase

>  r'^order_by_(?P-?(title|attachment|date))/(?P[0-9]+)/',
> 
> regex error


While I'm not sure on it, you might try making that a
non-capturing group using "(?:...)":

r'^order_by_(?P-?(?:title|attachment|date))/(?P[0-9]+)/'

which may be less ambiguous to a reverse regexp-parser (which it
sounds like might be used here).  However, with multiple
possibilities, reversal of the regexp may not be feasible.  You
may have to uglify them as multiple URLs:

r'^order_by_(?P-?title)/(?P[0-9]+)/'
r'^order_by_(?P-?attachment)/(?P[0-9]+)/'
r'^order_by_(?P-?date)/(?P[0-9]+)/'

in your urls.py that they're more uniquely identifiable...even if
they each point to the same view.

-tim






--~--~-~--~~~---~--~~
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: DateField() , AttributeError: 'str' object has no attribute 'strftime'

2007-08-07 Thread Russell Keith-Magee

On 8/6/07, justquick <[EMAIL PROTECTED]> wrote:
>
> AttributeError: 'str' object has no attribute '_meta'

This problem is unrelated to Image or FileFields - the problem is your
ForeignKey.

String-form foreign key references only work with models defined in
the same application. If you want to reference the User model, you
will need to add

from django.contrib.auth.models import User

to the top of your file, and change your ForeignKey reference to:

 owner = ForeignKey(User)

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
-~--~~~~--~~--~--~---



how to implement image catalog

2007-08-07 Thread tit4

Hi,

I would like to store some image files related to one object.
For example: object "City" can have several pictures
Now I do so:

class ImageCatalog(models.Model):
name = models.CharField(maxlength=255)

class Image(models.Model):
source = models.ImageField(upload_to="...")
catalog = models.ForeignKey(ImageCatalog,
edit_inline=models.TABULAR)

class City(modesl.Model):
...
name = models.CharField(maxlength=255)
images = models.ForeignKey(ImageCatalog)
def save(self):
if (self.id is None):
ic = ImageCatalog(name='[city]%s'%self.name)
ic.save()
self.images = ic
models.Model.save(self)

but a problem in, whether that to add a new file to "City" object I
have to use "ImageCatalog" object.
Is there any other solution, how to manage Images in the same "City"
object 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
-~--~~~~--~~--~--~---



Problem whit slung filter on Object_list genric view

2007-08-07 Thread Marco A.
Hi !

I doesnt undestand why , the slug by filters doesnt run .

error :NameError at /marco/ name 'user' is not defined Request Method:
GET  Request
URL: http://127.0.0.1:8000/marco/  Exception Type: NameError  Exception
Value: name 'user' is not defined  Exception Location:
/home/tulap/cit2/../cit2/urls.py
in , line 15  Python Executable: /usr/bin/python  Python Version:
2.5.1
my URL.PY is :



from saying.models import Cit

info_dict = {
'queryset': Cit.objects.all(),
}

urlpatterns = patterns('',

('^(?P\w+)/', 'django.views.generic.list_detail.object_list',
{'queryset': Cit.objects.all(),'slug_field':user}),

My model is :

class Cit(models.Model):
idfrase = models.IntegerField()# the id of the saying
testo = models.TextField()  #text of the saying in
that lenguage
user = models.CharField(maxlength=12)  #the user who write the saying

def __unicode__(self):
return self.user

def myself(self):
 return self.testo




Thanks to all , for the help

Marco

--~--~-~--~~~---~--~~
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 app for managing sending email to users...

2007-08-07 Thread James Tauber

On 06/08/2007, at 9:40 AM, Fabien Schwob wrote:
> How is it possible to help ? I'm about to write somethink like
> django-mailer for a website I maintain, so I think it's better to
> contribute to django-mailer.
>
> Does you already have an idea of the architecture of this future app ?

First of all look at the notes on http://code.google.com/p/django- 
mailer/

Here are some more thoughts below which I'll add to the project wiki  
soon:

I'm a big believe in a step-by-step approach so I was going to  
postpone support for deferred sending (e.g. send this email out at  
3am tomorrow morning), recurring email (e.g. password change  
reminders) and for box-carring (i.e. putting multiple notifications  
in a single email) until later releases -- especially as a believe  
these can be cleanly layered on top of the basic functionality.

With these features initially removed, the models I have in mind is  
fairly straight forward.

The main model will just be a queue of fully resolved messages to  
send as soon as possible. By "fully resolved" I mean that any  
template processing will take place before the message gets added to  
this model. So, in other words, the model will contain the literal  
to, from, subject and message body as well as a datetime of when the  
message was added to the queue. I'm also thinking of a three-way  
priority -- high, medium, low (see below for what this means).

I'm thinking of implementing the "don't send" list at this level, so  
even if you put an email to someone in this low-level queue, it won't  
get sent if the email address is on the don't send list. From  
experience, it's worth implementing this kind of opt-out support  
right from the beginning, so the initial version will have this  
second model, a simple list of email address not to send to, perhaps  
along with a datetime of when the opt-out was added.

The third model for this initial version is a log. Regardless of  
whether a send succeeds or not, it is logged in this model. A  
separate process can be responsible for retries, rolling to file- 
based logs, archiving or whatever. I am inclined to include  
everything in this model that is included in the first model  
(including the message body). In additional there would be a datetime  
of when the send was attempted, a status code and some free-text  
field to capture an exception.

I believe that all other features including retries, deferral and box- 
carring can be implemented on top of this layer with little or no  
modification.

One thing I haven't thought enough about is how this bottom layer  
would handle (or integrate with handling of) mail delivery failures  
that come back as email (rather than exceptions thrown by SMTP  
subsystem). Things to consider are how to correlate the mail delivery  
failure email and exactly what to correlate it with (the entry in the  
log model?)

One thing the above models do not consider is the possibility of  
multiple queues. I'm calling YAGNI on that at the moment.

So there would need to be one process that, when invoked would simply  
go through the queue, attempting to send each email (after checking  
the don't send list) and logging the result.

My thoughts about priorities are that the "sender process" should  
first go through any "high" priority sorted by age (how long they'd  
been in the queue), then any "medium" sorted by age, then any "low"  
similarly sorted by age.

Finally there should be a view and template for showing basic status  
of the django-mailer system.

Obviously later releases will add functionality on top, mostly  
concerned with how to get things in the queue and when to put them  
there.

So my initial plan is to implement what I've described above.

But there needs to still be, for the system to be usable for more  
than just one-off emails to individuals, a basic mechanism for adding  
bulk mail to the queue. The simplest case is one where an identical  
(i.e. no templating) text email is sent to all users. Adding  
templating support is only a small step from that, assuming that the  
template just receives a user object in the context. Then what is  
needed is a query set of what users to mail to. So bulk email is  
achieved by running a choice of query set + template and adding each  
result to the message queue in the layer described above.

So after a first pass of the lowest layer (described above) is done,  
I plan to add this kind of bulk email support per the previous  
paragraph.

Thoughts? (again, I'm happy to take this to a dedicated list if  
people prefer)

James

--~--~-~--~~~---~--~~
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

MAKE $50,000 IN A MONTH!!!

2007-08-07 Thread Manny

MAKE $5 IN A MONTH!!! Take 2 minutes to read


Take five minutes to read this and it WILL change your life.

I just read an article in an internet newsgroup describing how to make
$50,000.00 in only one month from a $5.00 investment.

Of course I thought this was ridiculous, or some type of pyramid. I
talked it over with my family, an attorney, and my friends, and they
all agreed it was some sort of scam. I hate scams because usually
someone gets burned, and I didn't want it to be me! I blew it off for
a few weeks then saw another one in a newsgroup I go a lot and
thought, " maybe this is legitimate", besides whats $5.00 , I spend
more than that in the morning on my way to work on coffee and cigs for
the day!

Well, two weeks later, I began receiving money in the mail!,  I
couldn't  believe it!
Not just a little, I mean big bucks!!. At first only a few hundred
dollars, then a week later a couple of thousand, then BOOM., By the
end of the fourth week, I had received nearly $47,000.00. It came from
all over the world. And every bit of it perfectly legal and on the up
and up. I've been able to pay off all my bills and still had enough
left over for a nice vacation for me and my family.

Not only does it work for me, it works for other folks as well. Marcus
Valppu says he made $57,883 in four weeks, Dave Manning claims he made
$53,664 in the same amount of time. Dan Shepstone says it was only
$17,000.00 for him. Do I know these
Folks?. No, but when I read how they say they did it, it made sense to
me. Enough sense that I'm taking a similar chance with $5 of my own
money. Not a big chance, I admit-but one with incredible potential,
because $5 is all anyone ever invests in this system. Period. That's
all Markus, Dave or Dan invested, yet their $5 netted them tens of
thousands of dollars each, in a safe, legal and completely legitimate
way. Here's how it works in 3 easy steps:

STEP 1.

 Invest your $5 by writing your name and address on five separate
pieces of paper along  with the words, " PLEASE ADD ME TO YOUR MAILING
LIST".
(In this way, you're not just sending a dollar to someone; you're
paying for a legitimate service). Fold a $1 dollar bill, money order,
or bank note inside each paper, and mail them by standard U.S. Mail to
the following five addressees:




1.  Vic Williams
 14307 Virtue Rd.
 Lenoir City, Tn. 37772

2.  Bill Brown
 148 South Downlen #796
  Beaumont, Tx. 77707

3.  Marco Monet
  409 N.E. 107 St.
  Miami, Fla. 33161

4.  Alain Renaud
  2638 Augustin-Cantin
   Montreal, QC, Canada
H3K 1E1

5.  Manny Alfaro
   4554 Conwell Dr.
Annandale, Va. 22003

Step  2.

Now remove the top name from the list, and move the other names up.
This way , #5 becomes #4 and so on. Put your name in as the fifth one
on the list.


Step  3.

Post the article to at least 200 newsgroups. There are at least 17000
newsgroups at any given moment in time. Try posting to as many
newsgroups as you can. Remember the more groups you post to, the more
people will see your article and send you cash!


Step  4.

You are now in business for yourself, and should start seeing returns
within 7 to 14 days!!. Remember, the internet is new and huge!. There
is no way you can loose.

Now here is how and why this system works:

Out of every block of 200 posts I made, I got back 5 responces.
Yes, that's right. Only 5. You make $5.00 in cash, not checks or money
orders, but real cash with your name at #5.
Each additional person who sent you $1.00 now also makes 200
additional postings with your name at #4, 1000 postings. On average
then, 50 people will send you $1.00 with your name at #4, ... $50.00 in
your pocket!!

Now these 50 new people will make 200 postings with your name at #3 or
10,000 postings. Average return, 500 people = $500., they make 200
postings with your name at #2 = 100,00 postings = 5000 returns at
$1.00 each that's
$5,000.00 in cash!!

Finally, 5,000 people make 200 postings each with your name at #1 and
you get a return of $50,000 before your name drops off the list. And
that's only
If everyone down the line makes only 200 postings each! Your total
income for this one cycle is $55,000.00

>From time to time when you see your name is no longer on the list, you
take the latest posting you can find and start all over again.

So that's it. Pretty simple sounding stuff, huh? But believe me it
works!
There are millions of people surfing the net everyday, all day, all
over the world. And 100,000 new people get on the net every day. You
know it, you've seen the stories in the papers. So, my friend, read
and follow the simple instructions and play fair. That's the key, and
that's all there is to it.
Print this out right now so you can refer back to this article easily.
Try to keep an eye on all the postings you made to make sure everyone
is playing fairly. You know where your name should be.

REMEMBER 

Re: Problem whit slung filter on Object_list genric view

2007-08-07 Thread KpoH

'slug_field':'user'

Marco A. пишет:
>
> Hi !
>
> I doesnt undestand why , the slug by filters doesnt run .
>
> error :
>
>
>   NameError at /marco/
>
>
> name 'user' is not defined
>
> Request Method:   GET
> Request URL:  http://127.0.0.1:8000/marco/
> Exception Type:   NameError
> Exception Value:  name 'user' is not defined
> Exception Location:   /home/tulap/cit2/../cit2/urls.py in ,
> line 15
> Python Executable:/usr/bin/python
> Python Version:   2.5.1
>
>
> my URL.PY is :
>
>
> 
> from saying.models import Cit
>
> info_dict = {
> 'queryset': Cit.objects.all(),
> }
>
> urlpatterns = patterns('',
>
> ('^(?P\w+)/',
> 'django.views.generic.list_detail.object_list', {'queryset':
> Cit.objects.all(),'slug_field':user}),
>
> My model is :
>
> class Cit(models.Model):
> idfrase = models.IntegerField()# the id of the saying
> testo = models.TextField()  #text of the
> saying in that lenguage
> user = models.CharField(maxlength=12)  #the user who write the saying
>
> def __unicode__(self):
> return self.user
>
> def myself(self):
>  return self.testo
>
>
>
>
> Thanks to all , for the help
>
> Marco
>
>
>
>
>
> >

-- 
Artiom Diomin, Development Dep, "Comunicatii Libere" S.R.L.
http://www.asterisksupport.ru
http://www.asterisk-support.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
-~--~~~~--~~--~--~---



Re: django app for managing sending email to users...

2007-08-07 Thread James Tauber

Also posted to

http://code.google.com/p/django-mailer/wiki/InitialDesignThoughts

I'll check in some initial models in the next day or so.

James


On 07/08/2007, at 9:04 AM, James Tauber wrote:
> Here are some more thoughts below which I'll add to the project wiki
> soon:

[snip]

--~--~-~--~~~---~--~~
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: full-text indexing

2007-08-07 Thread Thomas Guettler

Am Dienstag, 7. August 2007 12:02 schrieb Kai Kuehne:
> http://www.rkblog.rk.edu.pl/w/p/django-lupy/

Hi,

Does lupy support transactions? Do both (SQL und text database)
syncronize their transactions (commit or rollback both)?

 Thomas

--~--~-~--~~~---~--~~
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 app for managing sending email to users...

2007-08-07 Thread Kai Kuehne

Hi James,

On 8/7/07, James Tauber <[EMAIL PROTECTED]> wrote:
>
> Also posted to
>
> http://code.google.com/p/django-mailer/wiki/InitialDesignThoughts
> From the site:
> So after a first pass of the lowest layer (described above) is done, I plan
> to add this kind of bulk email support per the previous paragraph.

Just a question:
Why not add this bulk-email-support in the first place? E.g., the function would
take a list of contrib.auth.models.User objects and iterate over it. You could
check whether it's a QuerySet and cast it to list if needed.

I'm relatively new to both python and django so I'm probably missing
some important point here.

Kai

--~--~-~--~~~---~--~~
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: full-text indexing

2007-08-07 Thread Kai Kuehne

Hi Thomas,

On 8/7/07, Thomas Guettler <[EMAIL PROTECTED]> wrote:
>
> Am Dienstag, 7. August 2007 12:02 schrieb Kai Kuehne:
> > http://www.rkblog.rk.edu.pl/w/p/django-lupy/
>
> Hi,
>
> Does lupy support transactions? Do both (SQL und text database)
> syncronize their transactions (commit or rollback both)?

Unfornately this is not my blog, so I don't know. I would suggest to look
at their website at http://divmod.org/trac/wiki/WhitherLupy. You could
also use pylucene instead: http://pylucene.osafoundation.org/.
I don't know if pylunce supports transactions.

>
>  Thomas

Greetings
Kai

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



No superuser account

2007-08-07 Thread hongqing

Hi,

I just start to play with django, and I am following the tutorial to
create mysite.  however, at one point, the tutorial says the "python
manage.py syncdb" will ask for superuser account name and password.
but it did not happen in my case.  the consequence is that when I
setup the admin site, I can not login.

Anyone have suggestions about this problem?

thanks,

hongqing


--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Using **?

2007-08-07 Thread Greg

Can somebody please help me understand what ** does?

I have the following code:

>>> mydict = {}
>>> if 1 != "---":
... mydict['id'] = 2
...
>>> b = Blog.objects.filter(mydict)
>>> b

This prints out an error 'AttributeError: 'dict' object has no
attribute 'get_sql''

/

However, if I do the following then i get no errors:

>>> mydict = {}
>>> if 1 != "---":
... mydict['id'] = 2
...
>>> b = Blog.objects.filter(**mydict)
>>> b

///

The only thing that is different is that I have '**' in front of my
mydict variable.

Thanks


--~--~-~--~~~---~--~~
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: No superuser account

2007-08-07 Thread Kai Kuehne

Hi,

On 8/7/07, hongqing <[EMAIL PROTECTED]> wrote:
> Hi,
> [Problem]
> Anyone have suggestions about this problem?

>From the tutorial:
"you'd like to create a superuser account for the authentication system."

On the first-time-sync you type in username and password
as superuser account for your django project. Use that account
to login to your admin page.

Kai

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



15KG BOOBS WORLD RECORD

2007-08-07 Thread Sania Mirza


15KG BOOBS
http://www.exactearning.com/index.php?ref=1113


Sania Mirza slipped her boobs in playing in MANCHESTER Indian Tennis
star sania MIrza

http://www.mehndi123.com/index.php?ref=1113
Rape with 2 girls by 23 boys real
http://www.jobshutt.com/index.php?ref=1118


--~--~-~--~~~---~--~~
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: Using **?

2007-08-07 Thread Robin Becker

Greg wrote:
..

The ** thing can be used in two ways

1) to allow extra keyword arguments to be collected into a single dictionary 
inside a function.

eg

def func0(a0,a1,a2,b0=30,b1=31,**kwds):
 print a0,a1,a2,b0,b1,kwds

func0(0,1,2,c0=40,c1=42)

should print

0 1 2 30 31 {'c1': 42, 'c0': 40}

2) You can pass a dictionary into a function as though the keys were passed as 
key=value.

eg

D=dict(a0=-0,a1=-1,a2=-2,b0=-30,b1=-31,c0=-40,c1=-41)
func0(**D)

0 -1 -2 -30 -31 {'c1': -41, 'c0': -40}


note that you can pass fixed arguments as though they were keywords. In the 
function the **kwds argument picks up keywords that are not known in the 
definition. If the dictionary didn't contain the fixed arguments (ie the ones 
without defaults) we'd still have to pass those positionally

eg

D=dict(c0=50)
func0(10,11,12,**D)


10 11 12 30 31 {'c0': 50}


theer's an equivalent concept for positional arguments that uses a single *
-- 
Robin Becker

--~--~-~--~~~---~--~~
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: No superuser account

2007-08-07 Thread hongqing

That is when nothing happened with my experience.  Frist-time-sync did
not ask me to create the superuser account.

On Aug 7, 10:44 am, "Kai Kuehne" <[EMAIL PROTECTED]> wrote:
> Hi,
>
> On 8/7/07, hongqing <[EMAIL PROTECTED]> wrote:
>
> > Hi,
> > [Problem]
> > Anyone have suggestions about this problem?
>
> From the tutorial:
> "you'd like to create a superuser account for the authentication system."
>
> On the first-time-sync you type in username and password
> as superuser account for your django project. Use that account
> to login to your admin page.
>
> Kai


--~--~-~--~~~---~--~~
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: No superuser account

2007-08-07 Thread Ramdas S
Do you have 'django.contrib.admin' in your apps in settings.py?

On 8/7/07, hongqing <[EMAIL PROTECTED]> wrote:
>
>
> That is when nothing happened with my experience.  Frist-time-sync did
> not ask me to create the superuser account.
>
> On Aug 7, 10:44 am, "Kai Kuehne" <[EMAIL PROTECTED]> wrote:
> > Hi,
> >
> > On 8/7/07, hongqing <[EMAIL PROTECTED]> wrote:
> >
> > > Hi,
> > > [Problem]
> > > Anyone have suggestions about this problem?
> >
> > From the tutorial:
> > "you'd like to create a superuser account for the authentication
> system."
> >
> > On the first-time-sync you type in username and password
> > as superuser account for your django project. Use that account
> > to login to your admin page.
> >
> > Kai
>
>
> >
>

--~--~-~--~~~---~--~~
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: Dynamic values for BaseForm

2007-08-07 Thread Doug B

form = NewsForm(request.POST, somegroup=somegroup)

given your form __init__ definition, you are passing POST into the
spot for somegroup.

What I did to get around this was something like this:

class NewsBaseForm(BaseForm):
def __init__(self, *args, **kwargs):
nkwargs = kwargs.copy()
if nkwargs.has_key('somegroup'):
   somegroup=kwargs.pop('somegroup')
else:
   somegroup=None
super(NewsBaseForm, self).__init__(*args, **nkwargs)
self.fields['place'].choices = [(p.id, p.name) for p in
Place.objects.filter(display_for__pk=somegroup)]

There may be easier ways


--~--~-~--~~~---~--~~
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 app for managing sending email to users...

2007-08-07 Thread Ramdas S

I am not very sure whether the bulk-mail support personalization.

I think that should be an important feature.

More importantly, is there any way to scale it up to handle large
volumes of mails a day without falling into the spam black list trap

RS

On Aug 7, 7:16 pm, "Kai Kuehne" <[EMAIL PROTECTED]> wrote:
> Hi James,
>
> On 8/7/07, James Tauber <[EMAIL PROTECTED]> wrote:
>
>
>
> > Also posted to
>
> >http://code.google.com/p/django-mailer/wiki/InitialDesignThoughts
> > From the site:
> > So after a first pass of the lowest layer (described above) is done, I plan
> > to add this kind of bulk email support per the previous paragraph.
>
> Just a question:
> Why not add this bulk-email-support in the first place? E.g., the function 
> would
> take a list of contrib.auth.models.User objects and iterate over it. You could
> check whether it's a QuerySet and cast it to list if needed.
>
> I'm relatively new to both python and django so I'm probably missing
> some important point here.
>
> Kai


--~--~-~--~~~---~--~~
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: weird django orm behavior

2007-08-07 Thread Tim Chase

> `emplyoee_contract_id`=None,`employee_assignment_id`=10
> 
> as you can see the last update statement has employee_contract_id =
> None ... which I don't know what make it happen?

While it was likely just a transcription error, did you mean 
"emplyoee_contract_id" or "employee_contract_id"...I don't know 
if that (the transposition of "y" and "o" in the first) is the 
problem, but it's better to be clear and know that you've sent a 
direct copy rather than transcribing out an error.

-tim





--~--~-~--~~~---~--~~
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: Overriding save methot problem

2007-08-07 Thread Arnaldur

Also tried grabbing the post save signal...

the object that is sent with the signal is the old object, eg. the
object before updates.

as this is the post_save signal I tried loading the object again from
database and there also it is the old version.

Any thoughts about how I can get the updated object or the new data
for the object?

A

On Aug 7, 10:31 am, Arnaldur <[EMAIL PROTECTED]> wrote:
> Hi
>
> I'm trying to override the save method in the django admin interface,
> I have no problems getting values for the normal fields but when I try
> to access the values for multiple choice fields (many to many fields),
> I only get the last values, not the new values selected. This goes for
> both calling object.field.values() and going through the _meta.fields.
>
> Is there a way to access the parameters submitted from the admin form
> to the model's save method?
>
> A


--~--~-~--~~~---~--~~
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: No superuser account

2007-08-07 Thread Hongqing Li
Hi Ramdas,

I figured out that I need more previliges for the website account in the
database to create a superuser account.

thanks for all your replies,

On 8/7/07, Ramdas S <[EMAIL PROTECTED]> wrote:
>
> Do you have 'django.contrib.admin' in your apps in settings.py?
>
> On 8/7/07, hongqing <[EMAIL PROTECTED] > wrote:
> >
> >
> > That is when nothing happened with my experience.  Frist-time-sync did
> > not ask me to create the superuser account.
> >
> > On Aug 7, 10:44 am, "Kai Kuehne" <[EMAIL PROTECTED]> wrote:
> > > Hi,
> > >
> > > On 8/7/07, hongqing < [EMAIL PROTECTED]> wrote:
> > >
> > > > Hi,
> > > > [Problem]
> > > > Anyone have suggestions about this problem?
> > >
> > > From the tutorial:
> > > "you'd like to create a superuser account for the authentication
> > system."
> > >
> > > On the first-time-sync you type in username and password
> > > as superuser account for your django project. Use that account
> > > to login to your admin page.
> > >
> > > Kai
> >
> >
> >
> >
> >
>
> >
>

--~--~-~--~~~---~--~~
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 app for managing sending email to users...

2007-08-07 Thread Jökull

I have an implementation of a mass mailing functionality. Basically a
"campaign" is constructed in the admin interface. There is a preview
field and if filled it short-circuits the save functionality. If the
preview is left blank users and a campaign id are put into a
"dispatch" table where each entry is marked as "not-sent". There is a
cronjob on my box that runs a standalone Django script that sends off
batches of x emails at y interval from the "not-sent" entries in the
dispatch table. I've also written code so that admins can follow the
progress of the dispatches (in percentages). I also have a simple sign-
up and unsubscribe feature that ties in.

Some other features I'd like to incorporate:
Fexibility with templates of emails. Maybe pick from a drop-down.
A "mailbug" feature. This is a hidden .gif in each email. When
downloaded it hits a counter on the server with a hash that
corresponds to that dispatch and marks it as read. Of course this is
only when images are downloaded but a good indicator of the emails
"success" if you want.
Optional verification of email addresses.

If anyone is interested in this code I'll happily contribute!


--~--~-~--~~~---~--~~
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: Overriding save methot problem

2007-08-07 Thread Chris Moffitt
I've had a similar problem in the past and have been unable to solve it.
I'm not sure that there is any simple solution.

-Chris

--~--~-~--~~~---~--~~
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: MySQL and InnoDB

2007-08-07 Thread Rob Hudson

On Aug 6, 4:16 am, Matti Haavikko <[EMAIL PROTECTED]> wrote:
> Hi,
>
> Can you get the same result with "default-storage-engine=InnoDB" in your
> my.cnf?
>
>  - Haavikko

I believe you can but for other various reasons I'm not able to make
this change globally.

Does anyone know if adding the DATABASE_OPTIONS config setting adds
any unneeded overhead?

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
-~--~~~~--~~--~--~---



Re: django app for managing sending email to users...

2007-08-07 Thread Kai Kuehne

Hi,

On 8/7/07, Ramdas S <[EMAIL PROTECTED]> wrote:
>
> I am not very sure whether the bulk-mail support personalization.
>
> I think that should be an important feature.
>
> More importantly, is there any way to scale it up to handle large
> volumes of mails a day without falling into the spam black list trap
>
> RS

I don't understand you. Please don't quote me, if you're
not answering to my post.

Greetings
Kai

--~--~-~--~~~---~--~~
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_SETTINGS_MODULE ERROR using Django models from python shell

2007-08-07 Thread Bruno Tikami
Hi everybody (specially Malcom),

After a long period, I had time to delte the unecessary variables and test
it. So, finally, the goes the list of settigns you must include on you
default settings file in order to use you application models outside Django
web context (a python server side script for instance).

gettext_noop = lambda s: s
DATABASE_OPTIONS = {}
URL_VALIDATOR_USER_AGENT = "Django/0.96pre (http://www.djangoproject.com)"

It works on my actual project.

Good luck!

Tkm


On 5/11/07, Bruno Tikami <[EMAIL PROTECTED]> wrote:
>
> Malcolm, it works
>
>
> Thanks a lot, I shall delete the unecessary global settings.
>
> TKS!!!
>
>
> Tkm
>
> On 5/11/07, Malcolm Tredinnick <[EMAIL PROTECTED]> wrote:
> >
> >
> > Hi Bruno,
> >
> > On Fri, 2007-05-11 at 11:11 -0300, Bruno Tikami wrote:
> > > Hello Malcolm
> > >
> > > Thanks for you fast reply
> > >
> > > I'll try to put the missing settings on my project.settings . Do I
> > > have to call configure() in some diferent way after I do that? I mean,
> > > if my settings have all the global settings...
> >
> > No. The first argument to configure() is a class or a module, so that
> > the code can access each of the settings as an attribute. So if you
> > project settings contains every single global setting, you will be able
> > to pass that in (boy is that going to be a big file, though). Note that
> > you may not actually need every single global setting, but you will need
> > a fair chunk of them, I expect.
> >
> > Regards,
> > Malcolm
> >
> >
> >
> > > >
> >
>

--~--~-~--~~~---~--~~
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: MySQL and InnoDB

2007-08-07 Thread Nimrod A. Abing

On 8/8/07, Rob Hudson <[EMAIL PROTECTED]> wrote:
>
> On Aug 6, 4:16 am, Matti Haavikko <[EMAIL PROTECTED]> wrote:
> > Hi,
> >
> > Can you get the same result with "default-storage-engine=InnoDB" in your
> > my.cnf?
> >
> >  - Haavikko
>
> I believe you can but for other various reasons I'm not able to make
> this change globally.
>
> Does anyone know if adding the DATABASE_OPTIONS config setting adds
> any unneeded overhead?

init_command is run every time a connection is established through
MySQLdb.connection.Connection() so anything you put into init_command
will be executed each time a connection is made to the database. "SET
storage_engine=INNODB" would be "unneeded overhead" under normal
circumstances since it sets a system variable that only affects table
creation.

This is why the docs say that you remove init_command from
DATABASE_OPTIONS once you have created your tables.
-- 
_nimrod_a_abing_

http://abing.gotdns.com/
http://www.preownedcar.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
-~--~~~~--~~--~--~---



Re: Composing an URL using the current search query

2007-08-07 Thread Filipe Correia

I think an example may illustrate what I mean a little better.

Having a view with an url like the following:
http://domain.com/objects/123/rels/?name=zyx=xyz

Considering this same view produces hyperlinks (to be sent to it's
template) that add extra query parameters to it's URL, like for
example:
http://domain.com/objects/123/rels/?name=zyx=xyz=2

Is there a simpler way to achieve this than reading the parsed
parameters from the "request" object, reconstructing the original URL,
and finally adding the extra parameter?

thanks,
Filipe


On Aug 2, 12:20 pm, Filipe Correia <[EMAIL PROTECTED]> wrote:
> Hi,
>
> I'm struggling with an issue similar to the one presented on this
> thread:http://groups.google.com/group/django-users/browse_frm/thread/536c0a7...
>
> In a view, getting the various elements that compose the current URL's
> query string is easy, one only needs to use the "request" object:
>
> request.GET['name']
>
> however, in my case I would like to preserve the current querystring,
> whichever it is, replacing (or adding) only the value for a certain
> variable (say, the value for "page"). So I would be reading the parsed
> query string only to compose it again with very little change.
>
> Is there a more elegant way to do this?
>
> thanks in advance,
> Filipe Correia


--~--~-~--~~~---~--~~
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: The Django Book

2007-08-07 Thread Chris Hoeppner

I have already pre-ordered from amazon.

2007/8/6, Jeremy Dunck <[EMAIL PROTECTED]>:
>
> On 8/6/07, Tim Chase <[EMAIL PROTECTED]> wrote:
> > My understanding is that the djangobook project has either
> >
> > 1) been put on hold until the 1.0 API solidifies or
> > 2) doing some pre-press stuff that's not interesting and thus not
> > public
> >
>
> There's some non-public pre-press stuff going on, and there's
> significant editing already done.  I don't think there'll be another
> site update until the book is ready for press; at that point, the
> preferred url will be / rather than /beta (or similar).
>
> >
>


-- 
Best Regards,
Chris Hoeppner - www.pixware.org // My weblog

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Single-line comment doesn't seem to work

2007-08-07 Thread [EMAIL PROTECTED]

I've the following template and when I render it, the single line
comment doesn't get commented out.
Am I missing something; I'm new to Django and just start playing with
the templates.

 template
Test single line and multi-lines comments

Test1
hello {# This should be commented out #} hello
{{ link|escape }}

{% comment %}
The following two lines should be commented out
Test2
{{ link|urlencode }}
{% endcomment %}

Test3
{{ html|escape }}


### Render output
>>> print render_to_response('testtmpl.html', {'link':link, 'html':html})
Content-Type: text/html; charset=utf-8

Test single line and multi-lines comments

Test1
hello {# This should be commented out #} hello  <<<---
http://172.27.78.97:/is/launch_calendar/event/?type__id__exact=3



Test3
this is a quote statment  some other \stuff

Thanks,
~Carmen


--~--~-~--~~~---~--~~
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: value for choices arguments for newforms.MultipleSelectField

2007-08-07 Thread Chris Brand

> def my_view(request):
> 
> class MyForm(forms.Form)
>  emails = forms.ModelMultipleChoiceField(queryset=
>   MyDBModel.objects.filter(user=request.user.id)
> 
> 
> But I'd like to have form declaration out of this view na pass user's
> ID as an argument - is there any way how to supply queryset in
> runtime? I tried to assign queryset later to form's instance having no
> success.

If ModelMultipleChoiceField behaves the same as ModelChoiceField, you'll
have to explicitly set the choices on the widget, too. Here's an extract
from my code :
 self.fields[f].queryset = queryset
 # Have to force the widget to update itself (bug 4787)
 self.fields[f].widget.choices = self.fields[f].choices

http://code.djangoproject.com/ticket/4787 doesn't mention
ModelMultipleChoiceField, so if you do need to do this, you should probably
update the ticket to say so.

Chris




--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Using Filter on a list of objects?

2007-08-07 Thread Greg

I am trying to develop some functionality so that a user is able to
query by a color.  I have a form drop-down menu where the user can
select one color type to appear.  They are also able to leave it blank
so that it returns all the available colors.  I have my form returning
the right results when a color type is selected.  However, I am having
problems displaying the results when no color is selected (because I'm
using a filter).

Here is part of my view

if request['color'] == "---": # This means no color was
selected
mycolor = ColorCategory.objects.all()
else:
mycolor = request['color']
...
i = Choice.objects.get(id=h.id).style_set.filter(color_cat=mycolor)



So, as you can probably see when a color type is selected then mycolor
is set to request['color'].  However, when a color is not selected
then mycolor is set to 'ColorCategory.objects.all().  Then later in my
view when I try to do a

filter(color_cat=mycolor)

It errors out because mycolor is equal to a list of ColorCategory
objects.  I need mycolor to equal any ColorCategory number.  Does
anybody know how to do that?

Thanks


--~--~-~--~~~---~--~~
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: Setting value in admin interface

2007-08-07 Thread Kai Kuehne

Hi,

On 8/7/07, Rishtastic <[EMAIL PROTECTED]> wrote:
>
> Hi!
>
> I have a teacherProfile which links back to a user. I want each
> classroom to have a teacher associated with it and each teacherProfile
> can add a classroom. The issue is when the teacher goes to create a
> classroom, under the "teacher" field, it creates a drop down box of
> all the teacherProfile Objects, rather than just one teacherProfile
> object.
>
> teacherProfiles are considered staff on the admin page, so is there
> any way to limit teacherProfiles so they can only select themselves in
> the "create classroom" page?

This could probably work with limit_choices_to described here:
http://www.djangoproject.com/documentation/model-api/

> Thanks!

HTH
Kai

--~--~-~--~~~---~--~~
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: Instant Django

2007-08-07 Thread zorba

> If you get a chance, check it out and drop me an email telling me what
> you think.

One small problem with instant-django and old local python
installation:

- Instant django (latest version)
- local python 2.4.3 (!) installation

Problem:
When using sqlite db backend. It seems that django have been looking
for an old module because it has got error on db backend file (sqlite)
about not
finding pysqlite2 (and not sqlite3 module from python 2.5).

After locally upgrading from 2.4.3 to 2.5.1 everything seems to work
just fine.

Author was notified about this issue.

--
Slawek Mikula


--~--~-~--~~~---~--~~
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 does the database modeling work?

2007-08-07 Thread eggie5

Hi,

I'm not a python or django user, but in the past couple days I've
become fascinated with Django. Mostly how the database modeling works.
It seems so elegant, something that doesn't exist in asp.net world.

I've been looking at the source to see how it's implemented because I
wanted to recreate parts of it i my C# asp.net app.

My main focus right now is the Model class. This is the base class of
any models the user creates. e.g.:

class Person(models.Model):
first_name = models.CharField(max_length=30)
last_name = models.CharField(max_length=30)

This is sub classing the Model Class right. This is my C# duplicate:

 public class Person : Model
{
public Person(int contentID, Subscriber subscriber, DateTime
timeSent, bool confirmed, string fileSent, int adIDDelivered)
{
this.first_name = contentID;
this.last_name = subscriber;;
}
   }

And this is my model class so far:

 public class Model
{
public Model()
{

}

public static Manager Objects;

public void Save()
{

}

public void Delete()
{
}

}

My question is how does django get the field names for the DB. Does it
do some type of reflection on People class?


--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



test

2007-08-07 Thread fritz

testing


--~--~-~--~~~---~--~~
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: MySQL and InnoDB

2007-08-07 Thread ludo

On Aug 7, 6:50 pm, Rob Hudson <[EMAIL PROTECTED]> wrote:
> > Can you get the same result with "default-storage-engine=InnoDB" in your
> > my.cnf?
>
> I believe you can but for other various reasons I'm not able to make
> this change globally.

You can let django create myisam tables, and convert them with one
line of shell:

for t in $(mysql --batch -e "show tables" mydb |grep -v Tables_in); do
mysql -e "alter table $t engine=innodb" mydb; done

Of course, then you need to add foreign key constraints by hand, but
it's pretty easy to do, and you get more control on ON CASCADE / ON
DELETE statements.

Ludo


--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Windows XP optimization tricks

2007-08-07 Thread John Travolta
Collection of very useful tips and tricks
http://windowsxpsp2pro.blogspot.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
-~--~~~~--~~--~--~---



Re: How does the database modeling work?

2007-08-07 Thread Nicola Larosa

eggie5 wrote:
> I'm not a python or django user,

Why not consider becoming one? :-) You may start with IronPython.


> but in the past couple days I've
> become fascinated with Django. Mostly how the database modeling works.
> It seems so elegant, something that doesn't exist in asp.net world.

No ORMs for any CLR language? Peculiar. Try running Django on IronPython. :-)


> I've been looking at the source to see how it's implemented because I
> wanted to recreate parts of it i my C# asp.net app.

You're going the wrong direction. ;-)


> My question is how does django get the field names for the DB. Does it
> do some type of reflection on People class?

Try looking at this:

http://code.djangoproject.com/wiki/DevModelCreation


-- 
Nicola Larosa - http://www.tekNico.net/

These three disciplines - writing, engineering, and artistry - are not
so different from one another. [...] When you're able to think easily
in all three modes one by one, you will soon find yourself thinking in
all three simultaneously. The writer, engineer and artist overlap and
merge, Voltron-style, to form The Designer. -- Craig Cook, January 2007



--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Page generation times

2007-08-07 Thread TheMaTrIx

In PHP its handy and easy to setup a function to use during
development where you can see page generation times, your linux load
averages, a count for database calls in a page and compare between how
much time spent between generating the PHP output and waiting for the
database.

Is there something like this available in the Django framework?
If not is there an easy way to do this with Python?

Any info and pointers is much appreciated.
I'm constructing a site that is really heavy on data (it won't grow to
GB's of data, it'll actually start with around 8GB, not counting
images and files ...) and knowing all details on how python and django
react to loading alot of data and types of data to a page will be
really helpful


--~--~-~--~~~---~--~~
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 does the database modeling work?

2007-08-07 Thread SH

> My question is how does django get the field names for the DB. Does it
> do some type of reflection on People class?

Yep - It just looks for Field instances in the model's class dict. You
can do this pretty easily using a python metaclass.

SH


--~--~-~--~~~---~--~~
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: Using Filter on a list of objects?

2007-08-07 Thread Tim Chase

> if request['color'] == "---": # This means no color was
> selected
> mycolor = ColorCategory.objects.all()
> else:
> mycolor = request['color']
> ...
> i = Choice.objects.get(id=h.id).style_set.filter(color_cat=mycolor)
> 
> 
> 
> So, as you can probably see when a color type is selected then mycolor
> is set to request['color'].  However, when a color is not selected
> then mycolor is set to 'ColorCategory.objects.all().  Then later in my
> view when I try to do a
> 
> filter(color_cat=mycolor)
> 
> It errors out because mycolor is equal to a list of ColorCategory
> objects.  I need mycolor to equal any ColorCategory number.  Does
> anybody know how to do that?

It sounds like you just want to filter selectively:

   NO_COLOR = ''
   styles = Choice.objects.get(id=h.id).style_set
   if 'color' in request and request['color'] <> NO_COLOR:
 styles = styles.filter(color_cat=request['color'])

   for style in styles:
 do_something(style)

-tim




--~--~-~--~~~---~--~~
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: full-text indexing

2007-08-07 Thread Jarek Zgoda

I don't know what do you mean by "transactions" in case of full-text
search engine as it doesn't do any multi-step updates (only single-
step deletes or inserts in case of PyLucene).

Anybody who wants to use PyLucene, be aware that you cann't embed (iow
"use", "import") PyLucene in your Django application code if your web
server is either forking or threadinig one. You have to build a
service that is separated from any threading or forking. Does it still
seems reasonable to anybody? Well, if yes, welcome to pylucene-dev
mailing list. ;)

On 7 Sie, 16:24, "Kai Kuehne" <[EMAIL PROTECTED]> wrote:
> Hi Thomas,
>
> On 8/7/07, Thomas Guettler <[EMAIL PROTECTED]> wrote:
>
>
>
> > Am Dienstag, 7. August 2007 12:02 schrieb Kai Kuehne:
> > >http://www.rkblog.rk.edu.pl/w/p/django-lupy/
>
> > Hi,
>
> > Does lupy support transactions? Do both (SQL und text database)
> > syncronize their transactions (commit or rollback both)?
>
> Unfornately this is not my blog, so I don't know. I would suggest to look
> at their website athttp://divmod.org/trac/wiki/WhitherLupy. You could
> also use pylucene instead:http://pylucene.osafoundation.org/.
> I don't know if pylunce supports transactions.
>
>
>
> >  Thomas
>
> Greetings
> Kai


--~--~-~--~~~---~--~~
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: Slug field prepopulated from more than one field?

2007-08-07 Thread Jarek Zgoda

OK, it works... if the fields are "local" to model (not Foreign-keyed
nor M2M related). I'm gonna file documentation patch, as the docs
currently say anything on DateTimeField only.

On 5 Sie, 15:01, Jarek Zgoda <[EMAIL PROTECTED]> wrote:
> Is it possible to get slug field prepopulated from more than one
> field? The docs say that yes, but I seem to not be able to get any
> prepopulation if I have prepopulated_from=('field1', 'field2') in my
> model. Should I file a ticket?
>
> I use SVN trunk (rev 5804).
>
> Cheers
> Jarek Zgoda


--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



RadioSelect in a MultiWidget

2007-08-07 Thread Marco Antonio Valenzuela

Hi, I need to implement a MultiValueField that contains a
HiddenField() and a ChoiceField(widget=RadioSelect()), but I can't
create a MultiWidget that contains a RadioSelect because render()
doesn't return a string for a RadioSelect, it returns a
RadioFieldRenderer.

if I overload render and change this line:
output.append(widget.render(name + '_%s' % i, widget_value, attrs))
with this one:
output.append(str(widget.render(name + '_%s' % i, widget_value,
attrs)))
it works.

is there another way to do this?

thanks in advance

here is the code, just in case you want to see it:

from django import newforms as forms

class Pregunta
def __init__(self, id_pregunta, id_respuesta):
self.id_pregunta = id_pregunta
self.id_respuesta = id_respuesta

class PreguntaWidget(forms.MultiWidget):
def __init__(self, attrs=None):
widgets = (forms.HiddenInput(), forms.RadioSelect())
super(PreguntaWidget, self).__init__(widgets, attrs)

def decompress(self, value):
if value:
return [value.id_pregunta, value.id_respuesta]
return [None, None]


--~--~-~--~~~---~--~~
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 does the database modeling work?

2007-08-07 Thread eggie5

Wow, that's pretty deep stuff for never really looking at python
before...

On Aug 7, 1:04 pm, Nicola Larosa <[EMAIL PROTECTED]> wrote:
> eggie5 wrote:
> > I'm not a python or django user,
>
> Why not consider becoming one? :-) You may start with IronPython.
>
> > but in the past couple days I've
> > become fascinated with Django. Mostly how the database modeling works.
> > It seems so elegant, something that doesn't exist in asp.net world.
>
> No ORMs for any CLR language? Peculiar. Try running Django on IronPython. :-)
>
> > I've been looking at the source to see how it's implemented because I
> > wanted to recreate parts of it i my C# asp.net app.
>
> You're going the wrong direction. ;-)
>
> > My question is how does django get the field names for the DB. Does it
> > do some type of reflection on People class?
>
> Try looking at this:
>
> http://code.djangoproject.com/wiki/DevModelCreation
>
> --
> Nicola Larosa -http://www.tekNico.net/
>
> These three disciplines - writing, engineering, and artistry - are not
> so different from one another. [...] When you're able to think easily
> in all three modes one by one, you will soon find yourself thinking in
> all three simultaneously. The writer, engineer and artist overlap and
> merge, Voltron-style, to form The Designer. -- Craig Cook, January 2007


--~--~-~--~~~---~--~~
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: Page generation times

2007-08-07 Thread Udi

I think this is what you're after:
http://www.djangosnippets.org/snippets/358/

And for more serious profiling:
http://www.djangosnippets.org/snippets/186/



On Aug 7, 1:10 pm, TheMaTrIx <[EMAIL PROTECTED]> wrote:
> In PHP its handy and easy to setup a function to use during
> development where you can see page generation times, your linux load
> averages, a count for database calls in a page and compare between how
> much time spent between generating the PHP output and waiting for the
> database.
>
> Is there something like this available in the Django framework?
> If not is there an easy way to do this with Python?
>
> Any info and pointers is much appreciated.
> I'm constructing a site that is really heavy on data (it won't grow to
> GB's of data, it'll actually start with around 8GB, not counting
> images and files ...) and knowing all details on how python and django
> react to loading alot of data and types of data to a page will be
> really helpful


--~--~-~--~~~---~--~~
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: cascading delete and generic relations

2007-08-07 Thread Jonathan Wood



On Aug 1, 12:30 pm, Jonathan Wood <[EMAIL PROTECTED]> wrote:

>
> Do I need to somehow clean up the "test_group_perms" table when Ideletea 
> subject? Or am I coding my modules incorrectly?

Followup:

After a bit more digging, it looks like Django is not emulating
cascading deletes properly here (SQLite does not support foreign key
constraints so it is up to either my code or Django to do it). We have
implemented some code suggested on the SQLite wiki [1] to maintain
relational integrity, and things are working now.

Jon

[1] http://www.sqlite.org/cvstrac/wiki?p=ForeignKeyTriggers


--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Colleen Robledo is no longer with the company

2007-08-07 Thread crobledo


I will be out of the office starting  08/07/2007 and will not return until
09/30/2007.

For assistance, please contact David Medzerian at [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: Using Filter on a list of objects?

2007-08-07 Thread Greg

Tim,
I added your code into my view.  However, it seems to error out on me
when I get to the line 'if 'color' in request and request['color'] <>
NO_COLOR: '.  The error says:

KeyError at /rugs/searchresult/
'0 not found in either POST or GET'

//

Here is my view

def searchresult(request):
if request.method == 'POST':
myprice = {}
mysize = {}
if request['price'] == "---":
f = Price.objects.all()
else:
myprice['price_cat'] = request['price']
f = Price.objects.filter(**myprice)
if request['size'] == "---":
e = Size.objects.all()
else:
mysize['size_cat'] = request['size']
e = Size.objects.filter(**mysize)
dict = {}
for a in f:
for b in e:
g = Choice.objects.filter(price=a, size=b)
for h in g:
NO_COLOR = "---"
styles = 
Choice.objects.get(id=h.id).style_set
if 'color' in request and 
request['color'] <> NO_COLOR:
styles = 
styles.filter(color_cat=request['color'])
for j in styles:
dict[j] = j
return render_to_response('searchresult.html', {'s': dict})

/

Also, when I do a 'assert False, styles' after the line 'styles =
Choice.objects.get(id=h.id).style_set'

I get the following error:

'

Don't I want styles to bring back a style?

///

Thanks for you help



On Aug 7, 3:33 pm, Tim Chase <[EMAIL PROTECTED]> wrote:
> > if request['color'] == "---": # This means no color was
> > selected
> > mycolor = ColorCategory.objects.all()
> > else:
> > mycolor = request['color']
> > ...
> > i = Choice.objects.get(id=h.id).style_set.filter(color_cat=mycolor)
>
> > 
>
> > So, as you can probably see when a color type is selected then mycolor
> > is set to request['color'].  However, when a color is not selected
> > then mycolor is set to 'ColorCategory.objects.all().  Then later in my
> > view when I try to do a
>
> >filter(color_cat=mycolor)
>
> > It errors out because mycolor is equal to alistof ColorCategory
> > objects.  I need mycolor to equal any ColorCategory number.  Does
> > anybody know how to do that?
>
> It sounds like you just want tofilterselectively:
>
>NO_COLOR = ''
>styles = Choice.objects.get(id=h.id).style_set
>if 'color' in request and request['color'] <> NO_COLOR:
>  styles = styles.filter(color_cat=request['color'])
>
>for style in styles:
>  do_something(style)
>
> -tim


--~--~-~--~~~---~--~~
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 add a javascript calendar to date textboxes

2007-08-07 Thread Noam

Hello,

I wanted to add a javascript calendar (like the one you have in
Django's admin) to a date textbox in a form.
I found this post, which says how to do it:
http://groups.google.com/group/django-users/browse_frm/thread/3328829f1ed7f788/27557f8194b84134

I thought I might share with you how I did it - I think that it's
simpler than what's described there.

To add the calendar, you only need to:

1. Make sure that the admin interface is enabled.
2. Add this to the  element in your HTML template:







Note that this assumes that your admin media sits in "/media". If it's
not the case, you need to replace "/media" with your admin media path.

3. Add an attribute class="vDateField" to your 
element.
If you're using the newforms library, you can do it by using a line
like this in your form definition:
date =
forms.DateField(widget=forms.TextInput(attrs={'class':"vDateField"}))

Have a good day,
Noam


--~--~-~--~~~---~--~~
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 }} in the login view

2007-08-07 Thread Ross Poulton

I'm not sure what I did wrong with my middleware, however I created a
new context processor that set 'myfield', so it's accessible properly
from all templates that are fed a RequestContext.  I've kept the
middleware intact to set request.myfield as early as possible in the
request/response cycle, as I use that field regularly within my views.
It's left me with a bit of duplicated code but I've got the results
I'm after.

Ross


--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Templates escaping ampersand

2007-08-07 Thread Kynatro

I'm fairly new to dJango and I'm having a problem with the templating
system. I'm replacing a block in my base template and trying to pass
over apostrophe characters as their entity codes (), but the
template system is converting the ampersand to its entity so the end
result is  in the rendered HTML. Anyone have any ideas on
what is causing this?


--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



multiple user account login

2007-08-07 Thread james_027

Hi,

How do I enable multiple user account login in one computer? I don't
know what is the disadvantage if this works this way, I just need it
for development and testing purpose.

Thanks
james


--~--~-~--~~~---~--~~
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: multiple user account login

2007-08-07 Thread Nic

james_027 <[EMAIL PROTECTED]> writes:

> How do I enable multiple user account login in one computer? I don't
> know what is the disadvantage if this works this way, I just need it
> for development and testing purpose.

I normally provide a little hook overide wherever I need a user so
that I can say, from the url:

   http://myapp?_username=somebodyelse

of course... the trick is to remember to turn this off in production.


-- 
Nic Ferrier
http://prooveme.com - easy, simple, certificated OpenID

--~--~-~--~~~---~--~~
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: multiple user account login

2007-08-07 Thread Kai Kuehne

Hi James!

On 8/8/07, james_027 <[EMAIL PROTECTED]> wrote:
> How do I enable multiple user account login in one computer? I don't
> know what is the disadvantage if this works this way, I just need it
> for development and testing purpose.

If I understood your question right, you don't have to enable it. :-)
Just create a new user in the adminpanel (or in the shell) and login
with that username to your site or to the adminpanel.

Make sure to add ''django.contrib.auth' to your
INSTALLED_APPS in your settings.py, if it isn't in there.

> Thanks
> james

Greetings
Kai

--~--~-~--~~~---~--~~
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: multiple user account login

2007-08-07 Thread Tim Chase

>> How do I enable multiple user account login in one computer?
>> I don't know what is the disadvantage if this works this
>> way, I just need it for development and testing purpose.
> 
> If I understood your question right, you don't have to enable
> it. :-) Just create a new user in the adminpanel (or in the
> shell) and login with that username to your site or to the
> adminpanel.

I think the OP is asking for the ability to have more than one
different user simultaneously logged into the web app.  This
isn't conventionally feasible.  You can use multiple browsers
(I've used FireFox, IE, Lynx, and Dillo for testing various users
at the same time) or possibly even a browser such as FF that
supports multiple profiles (I don't know if you can start
multiple profiles simultaneously in FF, and have them keep
sessions separate).

>From a testing framework perspective, you certainly can have
multiple "users" in your tests.  This is helpful for testing
concurrency scenarios.  However, this "browsing" is merely
scripting.  If you're asking for multiple user account logins
from the same computer, just so you can make testing easy, I
recommend looking into Django's (and Python's) unit testing
framework.  This allows you to do this sort of testing in a
repeatable, automated way.

-tim





--~--~-~--~~~---~--~~
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: multiple user account login

2007-08-07 Thread james_027

Hi,

> I think the OP is asking for the ability to have more than one
> different user simultaneously logged into the web app.  This
> isn't conventionally feasible.  You can use multiple browsers
> (I've used FireFox, IE, Lynx, and Dillo for testing various users
> at the same time) or possibly even a browser such as FF that
> supports multiple profiles (I don't know if you can start
> multiple profiles simultaneously in FF, and have them keep
> sessions separate).
>
> From a testing framework perspective, you certainly can have
> multiple "users" in your tests.  This is helpful for testing
> concurrency scenarios.  However, this "browsing" is merely
> scripting.  If you're asking for multiple user account logins
> from the same computer, just so you can make testing easy, I
> recommend looking into Django's (and Python's) unit testing
> framework.  This allows you to do this sort of testing in a
> repeatable, automated way.
>
> -tim

Yes, that's what I mean. Thanks again Tim

cheers,
james


--~--~-~--~~~---~--~~
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: multiple user account login

2007-08-07 Thread Michael

On 8/8/07, Tim Chase <[EMAIL PROTECTED]> wrote:
>
> >> How do I enable multiple user account login in one computer?
> >> I don't know what is the disadvantage if this works this
> >> way, I just need it for development and testing purpose.
> >
> > If I understood your question right, you don't have to enable
> > it. :-) Just create a new user in the adminpanel (or in the
> > shell) and login with that username to your site or to the
> > adminpanel.
>
> I think the OP is asking for the ability to have more than one
> different user simultaneously logged into the web app.  This
> isn't conventionally feasible.  You can use multiple browsers
> (I've used FireFox, IE, Lynx, and Dillo for testing various users
> at the same time) or possibly even a browser such as FF that
> supports multiple profiles (I don't know if you can start
> multiple profiles simultaneously in FF, and have them keep
> sessions separate).

Yes you can using:

firefox -P default

in the other xterm:
firefox -P testprofile

etc. as many as you wish (If you have lot's of RAM)


-- 
--
Michael

--~--~-~--~~~---~--~~
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: Single-line comment doesn't seem to work

2007-08-07 Thread [EMAIL PROTECTED]

The templates are html...so to comment you would use 

On Aug 7, 2:32 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote:
> I've the following template and when I render it, the single line
> comment doesn't get commented out.
> Am I missing something; I'm new to Django and just start playing with
> the templates.
>
>  template
> Test single line and multi-lines comments
>
> Test1
> hello {# This should be commented out #} hello
> {{ link|escape }}
>
> {% comment %}
> The following two lines should be commented out
> Test2
> {{ link|urlencode }}
> {% endcomment %}
>
> Test3
> {{ html|escape }}
>
> ### Render output>>> print render_to_response('testtmpl.html', {'link':link, 
> 'html':html})
>
> Content-Type: text/html; charset=utf-8
>
> Test single line and multi-lines comments
>
> Test1
> hello {# This should be commented out #} hello  
> <<<---http://172.27.78.97:/is/launch_calendar/event/?type__id__exact=3
>
> Test3
> this is a quote statment  some other \stuff
>
> Thanks,
> ~Carmen


--~--~-~--~~~---~--~~
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: Single-line comment doesn't seem to work

2007-08-07 Thread SmileyChris

On Aug 8, 4:12 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]>
wrote:
> The templates are html...so to comment you would use 

The templates are rendered by Django, so {##} should work. I just
tested it and it's working fine for me...

>>> from django.template import Template, Context
>>> content = ''' Test single line and multi-lines comments

Test1
hello {# This should be commented out #} hello
{{ link|escape }}

{% comment %}
The following two lines should be commented out
Test2
{{ link|urlencode }}
{% endcomment %}

Test3
{{ html|escape }} '''
>>> print Template(content).render(Context())
 Test single line and multi-lines comments

Test1
hello  hello




Test3


--~--~-~--~~~---~--~~
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: Single-line comment doesn't seem to work

2007-08-07 Thread Nicola Larosa

[EMAIL PROTECTED] wrote:
> The templates are html...so to comment you would use 

HTML comments are included in the output that goes to the user, so careful
with what you write in there. :-)

Django comments, OTOH, do not exit the system.


-- 
Nicola Larosa - http://www.tekNico.net/

These three disciplines - writing, engineering, and artistry - are not
so different from one another. [...] When you're able to think easily
in all three modes one by one, you will soon find yourself thinking in
all three simultaneously. The writer, engineer and artist overlap and
merge, Voltron-style, to form The Designer. -- Craig Cook, January 2007



--~--~-~--~~~---~--~~
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: Templates escaping ampersand

2007-08-07 Thread Nimrod A. Abing

On 8/8/07, Kynatro <[EMAIL PROTECTED]> wrote:
>
> I'm fairly new to dJango and I'm having a problem with the templating
> system. I'm replacing a block in my base template and trying to pass
> over apostrophe characters as their entity codes (), but the
> template system is converting the ampersand to its entity so the end
> result is  in the rendered HTML. Anyone have any ideas on
> what is causing this?

Hard to tell what's happening from the limited details you gave but I
have two guesses:

http://www.djangoproject.com/documentation/templates/#escape

or

http://www.djangoproject.com/documentation/templates/#fix-ampersands

HTH.
-- 
_nimrod_a_abing_

http://abing.gotdns.com/
http://www.preownedcar.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
-~--~~~~--~~--~--~---



using chaining filter() and select_related()

2007-08-07 Thread james_027

hi,

I am doing something like this

params = request.GET['name'].split()
employees = Employee.objects.all().select_related()

for p in params:
employees = employees.filter(Q(firstname = p) | Q(lastname
= p))

the query is fine but when I look at the connection.queries django
still is not using join selects ...

Any idea?

james


--~--~-~--~~~---~--~~
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: using chaining filter() and select_related()

2007-08-07 Thread james_027

Hi,

On Aug 8, 1:37 pm, Udi <[EMAIL PROTECTED]> wrote:
> Try doing the select_related() at the end
>
> Remove the first use of it and then after the loop add this:
> employees = employees.select_related()
>
> I think that'll work?
>

I try but it didn't work ...

james


--~--~-~--~~~---~--~~
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: using chaining filter() and select_related()

2007-08-07 Thread Margaret

how


employees = employees.join(employees.filter(Q(firstname = p) | Q(lastname= p)))



On 8/8/07, james_027 <[EMAIL PROTECTED]> wrote:
>
> Hi,
>
> On Aug 8, 1:37 pm, Udi <[EMAIL PROTECTED]> wrote:
> > Try doing the select_related() at the end
> >
> > Remove the first use of it and then after the loop add this:
> > employees = employees.select_related()
> >
> > I think that'll work?
> >
>
> I try but it didn't work ...
>
> james
>
>
> >
>


-- 
[EMAIL PROTECTED]
13585201588

--~--~-~--~~~---~--~~
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: using chaining filter() and select_related()

2007-08-07 Thread james_027

hi

On Aug 8, 1:45 pm, Margaret <[EMAIL PROTECTED]> wrote:
> how
>
> employees = employees.join(employees.filter(Q(firstname = p) | Q(lastname= 
> p)))
>

is this something new that hasn't been yet documented?

james


--~--~-~--~~~---~--~~
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: multiple user account login

2007-08-07 Thread [EMAIL PROTECTED]


Hi,

On Aug 8, 5:02 am, james_027 <[EMAIL PROTECTED]> wrote:
> How do I enable multiple user account login in one computer? I don't
> know what is the disadvantage if this works this way, I just need it
> for development and testing purpose.


I am using a little different approach on my dev. server. I've created
2 aliased for localhost (thanks its easy on Unix, just added entries
to /etc/hosts) and now I am working on 2 URLs:

http://dev.version:PORT/
http://admin.dev.version:PORT/

and I am running my app with:

../manage.py runserver dev.version:PORT

This means that I can login as typical user and as admin from the same
browser instance. Since domains are different, cookies are sent to
different domains and they do not mix.



--~--~-~--~~~---~--~~
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: using chaining filter() and select_related()

2007-08-07 Thread Udi

Try doing the select_related() at the end

Remove the first use of it and then after the loop add this:
employees = employees.select_related()

I think that'll work?


On Aug 7, 10:25 pm, james_027 <[EMAIL PROTECTED]> wrote:
> hi,
>
> I am doing something like this
>
> params = request.GET['name'].split()
> employees = Employee.objects.all().select_related()
>
> for p in params:
> employees = employees.filter(Q(firstname = p) | Q(lastname
> = p))
>
> the query is fine but when I look at the connection.queries django
> still is not using join selects ...
>
> Any idea?
>
> james


--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---