Re: Admin URL for filtering

2008-02-22 Thread sanrioyt

Thanks Julien for the reply. However, it does not work.

When I go to:
http://:8000/project/app/student__id__in=15__id__in=2

It only displays the student whose id is 2 (i.e., takes the second
part and ignores
the first part).

And if I go to:
http://:8000/project/app/student__id__in=2__id__in=15

Then, it displays the students whose id is 1 or whose id is 5. It
disregards
that student whose id is 2.

I guess I could always pass the following to the url:
http://:8000/project/app/student__id__in=215

and that would display those students whose id is either 2, 1 or 5. It
would have
worked if I only have one digit for student. However, I have hundreds
of students, so that would
not work.

Is there hope for a solution? Thanks,

sanrioyt

On Feb 22, 4:35 pm, Julien <[EMAIL PROTECTED]> wrote:
> Hi,
>
> If I recal, you need to repeat the variable name in the URL to
> actually pass a list of values. Try this and see how you go:
> http://:8000/project/app/student__id__in=15__id__in=2
>
> On Feb 23, 7:55 am, [EMAIL PROTECTED] wrote:
>
> > Hi all.
>
> > Is it possible to pass the following using the admin url:
> > http://:8000/project/app/student__id__in=15,2
>
> > I am looking for a value of 15. Currently, both admin and newadmin
> > translates it to the query: student__id__in ('1','5',','2')
>
> > Is there a way to only let it translate to: student__id__in('15','2')
>
> > It seems very simple, but I did not know how to do it.
>
> > Thank you for your responses.
>
> > sanrioyt
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: How to compare between two attributes of the model?

2008-02-22 Thread johan de taeye

An extra clause allows you to do this:
Project.objects.extra(where=['expected_start_date >
actual_start_date'])


On Feb 23, 8:16 am, shabda <[EMAIL PROTECTED]> wrote:
> I have a model like,
>
> class Project(models.Model):
>    name = models.CharField()
>    expected_start_date = models.DateField()
>    actual_start_date = models.DateField()
>
> I want to translate the SQL query,
> SELECT * FROM project WHERE expected_start_date > actual_start_date,
>
> I cant do something like
> Project.objects.filter(   expected_start_date__gt =
> actual_start_date), so how can I translate the above sql query?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: How to compare between two attributes of the model?

2008-02-22 Thread Malcolm Tredinnick


On Fri, 2008-02-22 at 23:16 -0800, shabda wrote:
> I have a model like,
> 
> class Project(models.Model):
>name = models.CharField()
>expected_start_date = models.DateField()
>actual_start_date = models.DateField()
> 
> I want to translate the SQL query,
> SELECT * FROM project WHERE expected_start_date > actual_start_date,
> 
> I cant do something like
> Project.objects.filter(   expected_start_date__gt =
> actual_start_date), so how can I translate the above sql query?

At the moment you have to write the SQL directly and execute it using
cursor.execute(). There are plans in the works to add a comparison field
for situations like this.

Malcolm

-- 
Why be difficult when, with a little bit of effort, you could be
impossible. 
http://www.pointy-stick.com/blog/


--~--~-~--~~~---~--~~
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: TestClient assertFormError method.

2008-02-22 Thread Russell Keith-Magee

On Sat, Feb 23, 2008 at 9:43 AM, Ian Macdonald <[EMAIL PROTECTED]> wrote:
>
> If I separate the form out from the dictionary however, the test
> works, so it appears that it's the secondary lookup that this
> assertion cannot handle. Does anyone know if that's correct, and/or if
> there's a work-around or something I'm doing wrong?

You've pretty much identified the problem: assertFormError doesn't
expand context dot notation in the same way that templates do. The
name that is provided to the second argument of assertFormError is
used directly as a key on the top level of the context dictionary.This
also yields the immediate workaround - put the form in the top level
of the context.

There is some merit to the suggestion that the dot notation should be
expanded in this case. Feel free to open a ticket to suggest this
enhancement. If you're feeling particularly enthusiastic, the
definition for assertFormError is in
django/trunk/django/test/testcases.py; adding this functionality
shouldn't be too difficult (remembering that the dot notation can
represent a number of possible lookup alternatives).

Yours,
Russ Magee %-)

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



Re: Issues with IE7 and {% for %} {% endfor %} tag

2008-02-22 Thread John M

for those of us who don't know enough about cookies and IE7, could you
expand on the issue, and how u found it was cookies please.

John

On Feb 21, 8:30 am, merric <[EMAIL PROTECTED]> wrote:
> It was a cookie issue.   I had looked over this... but missed it on
> first glance.  My apologies
>
> MerMer
>
> On Feb 21, 4:17 pm, merric <[EMAIL PROTECTED]> wrote:
>
> > I've commented out all the HTML on the template,  so my template now
> > reads as follows
>
> > {% for i in prizes %}  {{i.id }}  {% endfor %}
>
> > There is nothing else on the page except the commented out HTML.
>
> > In firefox this displays without any problem, in IE7 I get a blank
> > page, even when looking at the source HTML.
>
> > When I make any other changes to the template, IE7 picks it up,
> > straight away.  It is only the {% for %} tag that seems to be coming
> > up blank.
> > I'm completely baffled.
>
> > On Feb 21, 3:37 pm, kevinski <[EMAIL PROTECTED]> wrote:
>
> > > > This iterates fine in Firefox, but in IE7 it keeps coming up blank.
> > > > I can't see any html issues.  I am working off my localhost.   Is this
> > > > a IE7 security issue or something else I have not thought of?
>
> > > I had a the similar problem once with IE7. It ended up being due to
> > > CSS incompatibility that caused the text to be hidden in IE. Try
> > > loading the page without any markup, if you see the text you will know
> > > this is the problem.
>
> > > Kin
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



mysqldb fails to import after following directions

2008-02-22 Thread newbiedoobiedoo

Hello,

I am running Mac OS X 10.4, have installed Python 2.3, and MySQL 14.7,
Distrib 4.1.22

Am in the process of setting up the mysqldb and it succeeds to install
and build,
however, the import mysqldb test command still fails.

I downloaded the folder MySQL-python-1.2.2 from the sourceforge link
provided (thanks!)
There were directions on two web pages: open landscape
http://openlandscape.wordpress.com/2007/11/16/setting-up-mysql-for-python-mysqldb-on-mac-os-x/

and spike source
http://blog.spikesource.com/mysqldb.htm

which say "basically" the same thing.  I grepped the files and did not
find a "popen"
command to modify.  So I simply did the build.   Then did the install.
Sadly, it still did not work.

THe good news that the directory site-packages now contains the files
MySQL_python-1.2.2-py2.3-macosx-10.4-ppc.egg
setuptools-0.6c5-py2.3.egg

All comments/suggestions will be VERY WELCOME!!
Translation... AUGH!  I'm going crazy!
Do I need to dump the mac?   We got django/mysql to work on fedora, no
problem,
even got a model and view created.   I'd not worry, but MY machine is
a MAC.
In fact, I have 2 macs.

OYE VEY!

Cheers,
Still HOPEFUL

--~--~-~--~~~---~--~~
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: inspect models in view

2008-02-22 Thread Malcolm Tredinnick


On Fri, 2008-02-22 at 16:49 -0800, Carl wrote:
> Hi there,
> 
> I don't find a solution to this problem even if it sounds quite simple
> to me. I want to inspect a model, that means a class derived from
> django.db.models.Model in order to get it's fields and their types -
> that's all!

Look at the _meta attribute on the model. It's an instance of
django.db.models.options.Options. Note that _meta is part of the
internal API and intentionally isn't documented (we don't want to commit
to it being stable for all time). However, it's mostly stable and we
will, over time, expose some of the more useful bits as public API.

Malcolm

-- 
Telepath required. You know where to apply... 
http://www.pointy-stick.com/blog/


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



inspect models in view

2008-02-22 Thread Carl

Hi there,

I don't find a solution to this problem even if it sounds quite simple
to me. I want to inspect a model, that means a class derived from
django.db.models.Model in order to get it's fields and their types -
that's all!

Anyone an idea?

Thanks in advance!

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



TestClient assertFormError method.

2008-02-22 Thread Ian Macdonald

I'm fairly new to Django, but seem to be getting the hang of it.

I do have a small issue that's been bugging me a bit with the test  
client: I've been writing tests for a form on a small site using the  
TestClient. When I test for invalid data in the form I'm getting odd  
errors. The problem seems to be that I'm passing the form to the  
template in a dictionary, like so:

context['feedback'] = {
   'form' : ContactUsForm(),
   'message' : "Thanks for the feedback!",
   'with_email' : True
}

The template adds the message and does a bit of special processing if  
the 'with_email' key is set, but nothing fancy.
When I try and run the following line in a test though

self.assertFormError(response, 'feedback.form', 'reply_to', [u"Enter a  
valid e-mail address."])

I get this error
  "AssertionError: The form 'contactus.form' was not used to render  
the response"

I tried different approaches to the form name ('form' or 'contactus')  
but each generated an error

If I separate the form out from the dictionary however, the test  
works, so it appears that it's the secondary lookup that this  
assertion cannot handle. Does anyone know if that's correct, and/or if  
there's a work-around or something I'm doing wrong? I'd rather not  
take apart the dictionary just for the sake of getting the tests to  
run (that seems a bit backward) but I also really like having a test  
suite I can rely on.

Any ideas or suggestions greatly appreciated.
Thanks

Ian.
  

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



زواج وتعارف

2008-02-22 Thread seo
أكبر موقع زواج وتعارف
http://www.zw2j.com/ar

--~--~-~--~~~---~--~~
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: Need some help with a query if you can :)

2008-02-22 Thread Julien

If you look at my code, I put "related_name='threads'"
If you don't specify that, then it is automatically set to
"thread_set" (see here: 
http://django.tomsk.ru/documentation/models/reverse_lookup/)

Also, in your view, do this instead:
return render_to_response('people/threads.html', { "friends" :
friends}, context_instance=RequestContext(request))

Your template should then be:
{% for friend in friends %}
{{ friend }}
{{ friend.thread_set|join:", " }}
{% endfor %}

All that is if you want to display all the threads for each friend.

On Feb 23, 9:55 am, Darthmahon <[EMAIL PROTECTED]> wrote:
> Ok, just tried this:
>
> View:
> -
> # get threads for friends
> threads = []
> for friend in friends:
> threads.append([friend, friend.thread_set.all()])
> -
>
> This appears to print something back, but it looks like it is just
> printing my friends.
>
> Not sure how to loop through this result properly in the template. At
> the moment I am doing this - but the template is probably completely
> wrong in terms of printing my friends, within each thread:
>
> -
> View:
> -
> # get threads for friends
> threads = []
> for friend in friends:
> threads.append([friend, friend.thread_set.all()])
>
> return render_to_response('people/threads.html', { "thread_list" :
> threads }, context_instance=RequestContext(request))
> -
>
> -
> Template:
> -
> {% for thread in thread_list %}
>
> {{ thread.title }}
> {{ thread.friends|join:", " }}
>
> {% endfor %}
> -
>
> On Feb 22, 10:44 pm, Darthmahon <[EMAIL PROTECTED]> wrote:
>
>
>
> > Hi Julien,
>
> > Just gave that a go, getting an error:
>
> > 'User' object has no attribute 'threads'
>
> > I'm guessing that because I am referring to the User model, which has
> > no direct relation to the Thread module, this won't work?
>
> > Julien wrote:
> > > Hi, how about this? (I haven't tested it myself)
>
> > > Models:
> > > ---
>
> > > class UserProfile(models.Model):
> > > user = models.ForeignKey(User, unique=True)
> > > friends = models.ManyToManyField(User, blank=True,
> > > related_name='friends')
>
> > > class Thread(models.Model):
> > > title = models.CharField(maxlength=200)
> > > users   = models.ManyToManyField(User, related_name='threads')
>
> > > View:
> > > -
>
> > > # get profile
> > > profile = get_object_or_404(UserProfile,
> > > user__id__exact=request.user.id)
>
> > > # get friends for user
> > > friends = profile.friends.all()
>
> > > # get threads for friends
> > > threads = []
> > > for friend in friends:
> > > thread.append([friend, friend.threads.all()])
>
> > > On Feb 23, 8:34 am, Darthmahon <[EMAIL PROTECTED]> wrote:
> > > > Hey,
>
> > > > I have three models but I can only handle the relationship between two
> > > > at any one time.
>
> > > > Basically I have a page that needs to show a threads the current
> > > > user's friends are currently participating in. I.E. something like
> > > > this:
>
> > > > Thread: ABC
> > > > Participating: Friend 1
>
> > > > Thread: XYZ
> > > > Participating: Friend 1, Friend 2, Friend 3
>
> > > > Here are my models (both of which refer to the default Auth model):
>
> > > > --
> > > > File: /people/models.py
> > > > --
>
> > > > class UserProfile(models.Model):
>
> > > > user= models.ForeignKey(User, unique=True)
> > > > friends = models.ManyToManyField(User, blank=True,
> > > > related_name='friend_set')
>
> > > > --
> > > > File: /thread/models.py
> > > > --
>
> > > > class Thread(models.Model):
>
> > > > title   = models.CharField(maxlength=200)
> > > > users   = models.ManyToManyField(User, related_name='users')
>
> > > > --
>
> > > > Now here is my view file:
>
> > > > --
> > > > File: /people/views.py
> > > > --
>
> > > > def index(request):
>
> > > > # get profile
> > > > profile = get_object_or_404(UserProfile,
> > > > user__id__exact=request.user.id)
>
> > > > # get friends for user
> > > > friends = profile.friends.all()
>
> > > > # get threads for friends
> > > > ???
>
> > > > --
>
> > > > As you can see, I don't know what to do now I need to get the threads
> > > > for each individual user. I don't need to group them in a special way,
> > > > I just want to print the threads my friends are currently
> > > > participating in an alphabetical list.
>
> > > > I did wonder if I should just edit the UserProfile model like this?
>
> > > > --
> > > > File: /people/models.py
> > > > --
>
> > > > class UserProfile(models.Model):
>
> > > > user= models.ForeignKey(User, unique=True)
> > > > friends = 

Re: Need some help with a query if you can :)

2008-02-22 Thread Darthmahon

Ok, just tried this:

View:
-
# get threads for friends
threads = []
for friend in friends:
threads.append([friend, friend.thread_set.all()])
-

This appears to print something back, but it looks like it is just
printing my friends.

Not sure how to loop through this result properly in the template. At
the moment I am doing this - but the template is probably completely
wrong in terms of printing my friends, within each thread:

-
View:
-
# get threads for friends
threads = []
for friend in friends:
threads.append([friend, friend.thread_set.all()])

return render_to_response('people/threads.html', { "thread_list" :
threads }, context_instance=RequestContext(request))
-

-
Template:
-
{% for thread in thread_list %}

{{ thread.title }}
{{ thread.friends|join:", " }}

{% endfor %}
-

On Feb 22, 10:44 pm, Darthmahon <[EMAIL PROTECTED]> wrote:
> Hi Julien,
>
> Just gave that a go, getting an error:
>
> 'User' object has no attribute 'threads'
>
> I'm guessing that because I am referring to the User model, which has
> no direct relation to the Thread module, this won't work?
>
> Julien wrote:
> > Hi, how about this? (I haven't tested it myself)
>
> > Models:
> > ---
>
> > class UserProfile(models.Model):
> > user = models.ForeignKey(User, unique=True)
> > friends = models.ManyToManyField(User, blank=True,
> > related_name='friends')
>
> > class Thread(models.Model):
> > title = models.CharField(maxlength=200)
> > users   = models.ManyToManyField(User, related_name='threads')
>
> > View:
> > -
>
> > # get profile
> > profile = get_object_or_404(UserProfile,
> > user__id__exact=request.user.id)
>
> > # get friends for user
> > friends = profile.friends.all()
>
> > # get threads for friends
> > threads = []
> > for friend in friends:
> > thread.append([friend, friend.threads.all()])
>
> > On Feb 23, 8:34 am, Darthmahon <[EMAIL PROTECTED]> wrote:
> > > Hey,
>
> > > I have three models but I can only handle the relationship between two
> > > at any one time.
>
> > > Basically I have a page that needs to show a threads the current
> > > user's friends are currently participating in. I.E. something like
> > > this:
>
> > > Thread: ABC
> > > Participating: Friend 1
>
> > > Thread: XYZ
> > > Participating: Friend 1, Friend 2, Friend 3
>
> > > Here are my models (both of which refer to the default Auth model):
>
> > > --
> > > File: /people/models.py
> > > --
>
> > > class UserProfile(models.Model):
>
> > > user= models.ForeignKey(User, unique=True)
> > > friends = models.ManyToManyField(User, blank=True,
> > > related_name='friend_set')
>
> > > --
> > > File: /thread/models.py
> > > --
>
> > > class Thread(models.Model):
>
> > > title   = models.CharField(maxlength=200)
> > > users   = models.ManyToManyField(User, related_name='users')
>
> > > --
>
> > > Now here is my view file:
>
> > > --
> > > File: /people/views.py
> > > --
>
> > > def index(request):
>
> > > # get profile
> > > profile = get_object_or_404(UserProfile,
> > > user__id__exact=request.user.id)
>
> > > # get friends for user
> > > friends = profile.friends.all()
>
> > > # get threads for friends
> > > ???
>
> > > --
>
> > > As you can see, I don't know what to do now I need to get the threads
> > > for each individual user. I don't need to group them in a special way,
> > > I just want to print the threads my friends are currently
> > > participating in an alphabetical list.
>
> > > I did wonder if I should just edit the UserProfile model like this?
>
> > > --
> > > File: /people/models.py
> > > --
>
> > > class UserProfile(models.Model):
>
> > > user= models.ForeignKey(User, unique=True)
> > > friends = models.ManyToManyField(User, blank=True,
> > > related_name='friend_set')
> > > threads = models.ManyToManyField(Thread, blank=True,
> > > related_name='thread_set')
>
> > > --
>
> > > Any ideas on how to do this? I'm guessing it's probably fairly basic
> > > but I can't think how I would get around this at the moment (it's been
> > > a long week!) ;)
>
> > > Cheers,
> > > Chris

On Feb 22, 10:44 pm, Darthmahon <[EMAIL PROTECTED]> wrote:
> Hi Julien,
>
> Just gave that a go, getting an error:
>
> 'User' object has no attribute 'threads'
>
> I'm guessing that because I am referring to the User model, which has
> no direct relation to the Thread module, this won't work?
>
> Julien wrote:
> > Hi, how about this? (I haven't tested it myself)
>
> > Models:
> > ---
>
> > class 

Re: Need some help with a query if you can :)

2008-02-22 Thread Darthmahon

Hi Julien,

Just gave that a go, getting an error:

'User' object has no attribute 'threads'

I'm guessing that because I am referring to the User model, which has
no direct relation to the Thread module, this won't work?

Julien wrote:
> Hi, how about this? (I haven't tested it myself)
>
> Models:
> ---
>
> class UserProfile(models.Model):
> user = models.ForeignKey(User, unique=True)
> friends = models.ManyToManyField(User, blank=True,
> related_name='friends')
>
> class Thread(models.Model):
> title = models.CharField(maxlength=200)
> users   = models.ManyToManyField(User, related_name='threads')
>
> View:
> -
>
> # get profile
> profile = get_object_or_404(UserProfile,
> user__id__exact=request.user.id)
>
> # get friends for user
> friends = profile.friends.all()
>
> # get threads for friends
> threads = []
> for friend in friends:
> thread.append([friend, friend.threads.all()])
>
>
> On Feb 23, 8:34 am, Darthmahon <[EMAIL PROTECTED]> wrote:
> > Hey,
> >
> > I have three models but I can only handle the relationship between two
> > at any one time.
> >
> > Basically I have a page that needs to show a threads the current
> > user's friends are currently participating in. I.E. something like
> > this:
> >
> > Thread: ABC
> > Participating: Friend 1
> >
> > Thread: XYZ
> > Participating: Friend 1, Friend 2, Friend 3
> >
> > Here are my models (both of which refer to the default Auth model):
> >
> > --
> > File: /people/models.py
> > --
> >
> > class UserProfile(models.Model):
> >
> > user= models.ForeignKey(User, unique=True)
> > friends = models.ManyToManyField(User, blank=True,
> > related_name='friend_set')
> >
> > --
> > File: /thread/models.py
> > --
> >
> > class Thread(models.Model):
> >
> > title   = models.CharField(maxlength=200)
> > users   = models.ManyToManyField(User, related_name='users')
> >
> > --
> >
> > Now here is my view file:
> >
> > --
> > File: /people/views.py
> > --
> >
> > def index(request):
> >
> > # get profile
> > profile = get_object_or_404(UserProfile,
> > user__id__exact=request.user.id)
> >
> > # get friends for user
> > friends = profile.friends.all()
> >
> > # get threads for friends
> > ???
> >
> > --
> >
> > As you can see, I don't know what to do now I need to get the threads
> > for each individual user. I don't need to group them in a special way,
> > I just want to print the threads my friends are currently
> > participating in an alphabetical list.
> >
> > I did wonder if I should just edit the UserProfile model like this?
> >
> > --
> > File: /people/models.py
> > --
> >
> > class UserProfile(models.Model):
> >
> > user= models.ForeignKey(User, unique=True)
> > friends = models.ManyToManyField(User, blank=True,
> > related_name='friend_set')
> > threads = models.ManyToManyField(Thread, blank=True,
> > related_name='thread_set')
> >
> > --
> >
> > Any ideas on how to do this? I'm guessing it's probably fairly basic
> > but I can't think how I would get around this at the moment (it's been
> > a long week!) ;)
> >
> > Cheers,
> > 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: Problem with custom filter

2008-02-22 Thread Julien

And don't forget to create an emtpy __init__.py file in that
templatetags/ or you may still get the same error.

On Feb 23, 8:14 am, Malcolm Tredinnick <[EMAIL PROTECTED]>
wrote:
> On Fri, 2008-02-22 at 22:11 +0100, Florian Lindner wrote:
> > Hello,
> > I want to write a custom filter.
>
> > I have a file called markdown.py inside my application directory with:
>
> Inside your application directory isn't the correct place. It must be
> inside a directory called templatetags/ which is inside one of your
> application directories.
>
> Malcolm
>
> --
> The cost of feathers has risen; even down is 
> up!http://www.pointy-stick.com/blog/
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Admin URL for filtering

2008-02-22 Thread Julien

Hi,

If I recal, you need to repeat the variable name in the URL to
actually pass a list of values. Try this and see how you go:
http://:8000/project/app/student__id__in=15__id__in=2

On Feb 23, 7:55 am, [EMAIL PROTECTED] wrote:
> Hi all.
>
> Is it possible to pass the following using the admin url:
> http://:8000/project/app/student__id__in=15,2
>
> I am looking for a value of 15. Currently, both admin and newadmin
> translates it to the query: student__id__in ('1','5',','2')
>
> Is there a way to only let it translate to: student__id__in('15','2')
>
> It seems very simple, but I did not know how to do it.
>
> Thank you for your responses.
>
> sanrioyt
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: How to query ManyToManyFields

2008-02-22 Thread Albert Hopkins


On Thu, 2008-02-21 at 17:17 -0600, Brett Hoerner wrote:
> On Thu, Feb 21, 2008 at 5:06 PM, Albert Hopkins <[EMAIL PROTECTED]> wrote:
> >  I have a model with a M2M field and I want to filter based on the field
> >  being empty.  How do I do this?  I tried
> >  MyModel.objects.filter(m2mfield=[]) but that raises a (MySQL) exception.
> 
> Is this what you want?
> 
> MyModel.objects.filter(m2mfield__pk__isnull=True)
> 

Well that certainly gives me the correct results, but doesn't seem
obvious (or Pythonic) at all :(



--~--~-~--~~~---~--~~
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: Need some help with a query if you can :)

2008-02-22 Thread Julien

Hi, how about this? (I haven't tested it myself)

Models:
---

class UserProfile(models.Model):
user = models.ForeignKey(User, unique=True)
friends = models.ManyToManyField(User, blank=True,
related_name='friends')

class Thread(models.Model):
title = models.CharField(maxlength=200)
users   = models.ManyToManyField(User, related_name='threads')

View:
-

# get profile
profile = get_object_or_404(UserProfile,
user__id__exact=request.user.id)

# get friends for user
friends = profile.friends.all()

# get threads for friends
threads = []
for friend in friends:
thread.append([friend, friend.threads.all()])


On Feb 23, 8:34 am, Darthmahon <[EMAIL PROTECTED]> wrote:
> Hey,
>
> I have three models but I can only handle the relationship between two
> at any one time.
>
> Basically I have a page that needs to show a threads the current
> user's friends are currently participating in. I.E. something like
> this:
>
> Thread: ABC
> Participating: Friend 1
>
> Thread: XYZ
> Participating: Friend 1, Friend 2, Friend 3
>
> Here are my models (both of which refer to the default Auth model):
>
> --
> File: /people/models.py
> --
>
> class UserProfile(models.Model):
>
> user= models.ForeignKey(User, unique=True)
> friends = models.ManyToManyField(User, blank=True,
> related_name='friend_set')
>
> --
> File: /thread/models.py
> --
>
> class Thread(models.Model):
>
> title   = models.CharField(maxlength=200)
> users   = models.ManyToManyField(User, related_name='users')
>
> --
>
> Now here is my view file:
>
> --
> File: /people/views.py
> --
>
> def index(request):
>
> # get profile
> profile = get_object_or_404(UserProfile,
> user__id__exact=request.user.id)
>
> # get friends for user
> friends = profile.friends.all()
>
> # get threads for friends
> ???
>
> --
>
> As you can see, I don't know what to do now I need to get the threads
> for each individual user. I don't need to group them in a special way,
> I just want to print the threads my friends are currently
> participating in an alphabetical list.
>
> I did wonder if I should just edit the UserProfile model like this?
>
> --
> File: /people/models.py
> --
>
> class UserProfile(models.Model):
>
> user= models.ForeignKey(User, unique=True)
> friends = models.ManyToManyField(User, blank=True,
> related_name='friend_set')
> threads = models.ManyToManyField(Thread, blank=True,
> related_name='thread_set')
>
> --
>
> Any ideas on how to do this? I'm guessing it's probably fairly basic
> but I can't think how I would get around this at the moment (it's been
> a long week!) ;)
>
> Cheers,
> 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: self referential manytomany

2008-02-22 Thread Michael Newman

I was afraid of that. Thanks Malcolm.

On Feb 22, 4:10 pm, Malcolm Tredinnick <[EMAIL PROTECTED]>
wrote:
> On Thu, 2008-02-21 at 08:44 -0800, Michael Newman wrote:
> > I am a bit confused as to why it is that this gives me an error. I
> > hope someone could explain it to me.
>
> > Let's say I have users with Profiles that can be connected to the one
> > Web page that they can author. The other Users can bookmark that page.
> > So my models look like this:
>
> > profiles.models.py
>
> > from bookmarks.models import Bookmark
>
> > class Profile(models.Model):
> > ...bookmarks = models.ManyToManyField(Webpage)
>
> > 
> > bookmarks.models.py
>
> > from profiles.models import Profile
> > ...author = models.ForeignKey(Profile)
>
> These two models look too tightly coupled to be able to exist in
> separate applications. What your code is saying is that before it can
> construct the Profile model, it needs the Webpage model, because it
> needs to create a foreign key. However, before it can create that model,
> it needs the Profile model because of the foreign key in
> bookmarks.models.
>
> If A depends directly on B *and* B depends directly on A, then they
> aren't orthogonal models and trying to put them in separate applications
> isn't really gaining you anything (it's not like one can ever exist
> without the other).
>
> Django supports forward reference within the same file (via "string"
> names ,rather than object references), however we don't support such
> references across files because (a) it's a lot harder to implement
> correctly because you need to track when to resolve the forward
> references and (b) it's not really needed at the moment for the above
> reason (two tightly coupled models in separate applications isn't
> particularly good design).
>
> Now, I could see myself arguing in favour of string/forward references
> for models within the same application (but in different models files)
> one day, because it makes splitting things up a bit cleaner. But not in
> separate applications. However, that's also not a change that's
> particularly high priority at the moment, given all the other stuff
> we've got going on.
>
> For now, if you've got this type of very tight coupling, put them in the
> same file.
>
> Malcolm
>
> --
> The hardness of butter is directly proportional to the softness of the
> bread.http://www.pointy-stick.com/blog/
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Need some help with a query if you can :)

2008-02-22 Thread Darthmahon

Hey,

I have three models but I can only handle the relationship between two
at any one time.

Basically I have a page that needs to show a threads the current
user's friends are currently participating in. I.E. something like
this:

Thread: ABC
Participating: Friend 1

Thread: XYZ
Participating: Friend 1, Friend 2, Friend 3

Here are my models (both of which refer to the default Auth model):

--
File: /people/models.py
--

class UserProfile(models.Model):

user= models.ForeignKey(User, unique=True)
friends = models.ManyToManyField(User, blank=True,
related_name='friend_set')

--
File: /thread/models.py
--

class Thread(models.Model):

title   = models.CharField(maxlength=200)
users   = models.ManyToManyField(User, related_name='users')

--

Now here is my view file:

--
File: /people/views.py
--

def index(request):

# get profile
profile = get_object_or_404(UserProfile,
user__id__exact=request.user.id)

# get friends for user
friends = profile.friends.all()

# get threads for friends
???

--

As you can see, I don't know what to do now I need to get the threads
for each individual user. I don't need to group them in a special way,
I just want to print the threads my friends are currently
participating in an alphabetical list.

I did wonder if I should just edit the UserProfile model like this?

--
File: /people/models.py
--

class UserProfile(models.Model):

user= models.ForeignKey(User, unique=True)
friends = models.ManyToManyField(User, blank=True,
related_name='friend_set')
threads = models.ManyToManyField(Thread, blank=True,
related_name='thread_set')

--

Any ideas on how to do this? I'm guessing it's probably fairly basic
but I can't think how I would get around this at the moment (it's been
a long week!) ;)

Cheers,
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: Problem with custom filter

2008-02-22 Thread Malcolm Tredinnick


On Fri, 2008-02-22 at 22:11 +0100, Florian Lindner wrote:
> Hello,
> I want to write a custom filter.
> 
> I have a file called markdown.py inside my application directory with:

Inside your application directory isn't the correct place. It must be
inside a directory called templatetags/ which is inside one of your
application directories.

Malcolm

-- 
The cost of feathers has risen; even down is up! 
http://www.pointy-stick.com/blog/


--~--~-~--~~~---~--~~
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 with custom filter

2008-02-22 Thread Florian Lindner

Hello,
I want to write a custom filter.

I have a file called markdown.py inside my application directory with:

register = Library()

@register.filter
def markdown(value, arg):
 print type(value)
 return value


settings.py contains:

INSTALLED_APPS = (
 'django.contrib.auth',
 'django.contrib.contenttypes',
 'django.contrib.sessions',
 'django.contrib.sites',
 'django.contrib.admin',
 'xgm.Blog.markdown',  # <---
 'xgm.AbbrDB',
 'xgm.Blog',
)

now I want to load the filter lib in my template:

{% load markdown %}

which produces an error:

'markdown' is not a valid tag library: Could not load template library  
from django.templatetags.markdown, No module named markdown

What is wrong here?

Thanks,

Florian

--~--~-~--~~~---~--~~
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: self referential manytomany

2008-02-22 Thread Malcolm Tredinnick


On Thu, 2008-02-21 at 08:44 -0800, Michael Newman wrote:
> I am a bit confused as to why it is that this gives me an error. I
> hope someone could explain it to me.
> 
> Let's say I have users with Profiles that can be connected to the one
> Web page that they can author. The other Users can bookmark that page.
> So my models look like this:
> 
> profiles.models.py
> 
> from bookmarks.models import Bookmark
> 
> class Profile(models.Model):
> ...bookmarks = models.ManyToManyField(Webpage)
> 
> 
> bookmarks.models.py
> 
> from profiles.models import Profile
> ...author = models.ForeignKey(Profile)

These two models look too tightly coupled to be able to exist in
separate applications. What your code is saying is that before it can
construct the Profile model, it needs the Webpage model, because it
needs to create a foreign key. However, before it can create that model,
it needs the Profile model because of the foreign key in
bookmarks.models.

If A depends directly on B *and* B depends directly on A, then they
aren't orthogonal models and trying to put them in separate applications
isn't really gaining you anything (it's not like one can ever exist
without the other).

Django supports forward reference within the same file (via "string"
names ,rather than object references), however we don't support such
references across files because (a) it's a lot harder to implement
correctly because you need to track when to resolve the forward
references and (b) it's not really needed at the moment for the above
reason (two tightly coupled models in separate applications isn't
particularly good design).

Now, I could see myself arguing in favour of string/forward references
for models within the same application (but in different models files)
one day, because it makes splitting things up a bit cleaner. But not in
separate applications. However, that's also not a change that's
particularly high priority at the moment, given all the other stuff
we've got going on.

For now, if you've got this type of very tight coupling, put them in the
same file.

Malcolm

-- 
The hardness of butter is directly proportional to the softness of the
bread. 
http://www.pointy-stick.com/blog/


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



Admin URL for filtering

2008-02-22 Thread sanrioyt

Hi all.

Is it possible to pass the following using the admin url:
http://:8000/project/app/student__id__in=15,2

I am looking for a value of 15. Currently, both admin and newadmin
translates it to the query: student__id__in ('1','5',','2')

Is there a way to only let it translate to: student__id__in('15','2')

It seems very simple, but I did not know how to do it.

Thank you for your responses.

sanrioyt
--~--~-~--~~~---~--~~
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: MEDIA_URL doesnt work

2008-02-22 Thread Justin Lilly
You should def. read those articles. A quick fix (if you're in a time
crunch) is to add this to your base urls.py inserting the proper values:


if settings.DEBUG:
urlpatterns += patterns('',
(r'^my_sites_media_folder/(?P.*)$', 'django.views.static.serve',
{'document_root': '/path/to/my/media/folder'}),
)

which would allow you to go to
http://localhost:8000/my_sites_media_folder/ and serve static files
out of /path/to/my/media/folder.

again.. you should still read the articles to figure out WHY this works.

-justin

On Fri, Feb 22, 2008 at 3:19 PM, Pete Crosier <[EMAIL PROTECTED]>
wrote:

>
> Have a look at the links below, I think you're over-estimating what
> MEDIA_URL does for you -
> http://www.djangoproject.com/documentation/static_files/
> http://www.djangoproject.com/documentation/settings/#media-url
>
> On Feb 22, 7:54 pm, troeten <[EMAIL PROTECTED]> wrote:
> > Hi,
> > i have a problem with the MEDIA_URL in django.
> > My settings.py section looks like this:
> >
> > # Absolute path to the directory that holds media.
> > # Example: "/home/media/media.lawrence.com/"
> > MEDIA_ROOT = '/Users/stefan/Development/ju_amerang/media/'
> >
> > # URL that handles the media served from MEDIA_ROOT.
> > # Example: "http://media.lawrence.com;
> > MEDIA_URL = 'http://127.0.0.1:8000/media/'
> >
> > but, when i want to go tohttp://127.0.0.1:8000/media/with my browser
> > i get every time a 404 Error with the following message:
> > Using the URLconf defined in ju_amerang.urls, Django tried these URL
> > patterns, in this order:
> > ^mitglieder/
> > ^admin/
> > The current URL, /media/, didn't match any of these.
> >
> > can anyone help me?
> >
> > sorry for my bad englisch, but i hope you understand my
> >
> > regards stefan
> >
>


-- 
Justin Lilly
Web Developer

--~--~-~--~~~---~--~~
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: MEDIA_URL doesnt work

2008-02-22 Thread Pete Crosier

Have a look at the links below, I think you're over-estimating what
MEDIA_URL does for you -
http://www.djangoproject.com/documentation/static_files/
http://www.djangoproject.com/documentation/settings/#media-url

On Feb 22, 7:54 pm, troeten <[EMAIL PROTECTED]> wrote:
> Hi,
> i have a problem with the MEDIA_URL in django.
> My settings.py section looks like this:
>
> # Absolute path to the directory that holds media.
> # Example: "/home/media/media.lawrence.com/"
> MEDIA_ROOT = '/Users/stefan/Development/ju_amerang/media/'
>
> # URL that handles the media served from MEDIA_ROOT.
> # Example: "http://media.lawrence.com;
> MEDIA_URL = 'http://127.0.0.1:8000/media/'
>
> but, when i want to go tohttp://127.0.0.1:8000/media/with my browser
> i get every time a 404 Error with the following message:
> Using the URLconf defined in ju_amerang.urls, Django tried these URL
> patterns, in this order:
> ^mitglieder/
> ^admin/
> The current URL, /media/, didn't match any of these.
>
> can anyone help me?
>
> sorry for my bad englisch, but i hope you understand my
>
> regards stefan
--~--~-~--~~~---~--~~
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: MEDIA_URL doesnt work

2008-02-22 Thread Alex Koshelev

http://www.djangoproject.com/documentation/static_files/

troeten wrote:
> Hi,
> i have a problem with the MEDIA_URL in django.
> My settings.py section looks like this:
>
> # Absolute path to the directory that holds media.
> # Example: "/home/media/media.lawrence.com/"
> MEDIA_ROOT = '/Users/stefan/Development/ju_amerang/media/'
>
> # URL that handles the media served from MEDIA_ROOT.
> # Example: "http://media.lawrence.com;
> MEDIA_URL = 'http://127.0.0.1:8000/media/'
>
>
> but, when i want to go to http://127.0.0.1:8000/media/ with my browser
> i get every time a 404 Error with the following message:
> Using the URLconf defined in ju_amerang.urls, Django tried these URL
> patterns, in this order:
> ^mitglieder/
> ^admin/
> The current URL, /media/, didn't match any of these.
>
> can anyone help me?
>
> sorry for my bad englisch, but i hope you understand my
>
> regards stefan
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



MEDIA_URL doesnt work

2008-02-22 Thread troeten

Hi,
i have a problem with the MEDIA_URL in django.
My settings.py section looks like this:

# Absolute path to the directory that holds media.
# Example: "/home/media/media.lawrence.com/"
MEDIA_ROOT = '/Users/stefan/Development/ju_amerang/media/'

# URL that handles the media served from MEDIA_ROOT.
# Example: "http://media.lawrence.com;
MEDIA_URL = 'http://127.0.0.1:8000/media/'


but, when i want to go to http://127.0.0.1:8000/media/ with my browser
i get every time a 404 Error with the following message:
Using the URLconf defined in ju_amerang.urls, Django tried these URL
patterns, in this order:
^mitglieder/
^admin/
The current URL, /media/, didn't match any of these.

can anyone help me?

sorry for my bad englisch, but i hope you understand my

regards stefan
--~--~-~--~~~---~--~~
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: wordpress hooks and actions system in django?

2008-02-22 Thread [EMAIL PROTECTED]

I had an idea about this, I would just like to say it is porbably un-
pythonic, scary, and completely untested, here goes:

Create a model for plugins, it should have a filefield and a few other
fields for meta data(these should not be editable), plus a boolean
field for enabled. Essentially what should happen is the file will
contain a class and some meta data that gives information about
itself.  When you upload the file it gets read to get the meta data
out(for example it might have a title, description, author, and some
way of telling your application what it expects for input).  This can
be done using the __import__ feautre of python, here is an example:
http://dpaste.com/36440/ in the .py file there should be a variable
with a generic name that is a copy of the class, that way the class
can be whatever you want, then each plugin's class just needs to
implement a generic interface, and a inner class with the meta info,
then when you want to use it you could do something like this:
http://dpaste.com/36442/

On Feb 22, 11:18 am, canen <[EMAIL PROTECTED]> wrote:
> Just chiming in here. There is a Wordpress 'clone' written in Python
> called Textpress [1]. It implements
> a lightweight events/actions system[2] akin to the one you mentioned.
>
> [1]http://textpress.pocoo.org/
> [2]http://dev.pocoo.org/projects/textpress/browser/textpress/application...
>
> On Feb 22, 11:27 am, Kyle Fox <[EMAIL PROTECTED]> wrote:
>
> > The part that I'm struggling to wrap my head around is how to make
> > plugins "installable".
>
> > I think one of the reasons Wordpress's plugin framework is so
> > successful is how easy it is to manage your plugins: install /
> > uninstall buttons on a page means the user doesn't have to write any
> > glue code or even do anything from the command line.
>
> > I guess you could have an empty 'plugins' app somewhere, and simply
> > drop py files into it for each plugin.  What are your guys' thoughts
> > on how to accomplish 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
-~--~~~~--~~--~--~---



Re: django.test.client.Client returns HttpResponse/ How to make the test client follow 302 status codes?

2008-02-22 Thread shabda

Please ignore the previous message. I think I am too sleepy now, and
am seeing things which do not exist. :) .

On Feb 22, 11:57 pm, shabda <[EMAIL PROTECTED]> wrote:
> Aww, I seems a call to c.get('/dashboard/') gets an object of type
> HttpResponse while c.get('/dashboard/', {}) gets a Response object.
>
> On Feb 22, 11:50 pm, shabda <[EMAIL PROTECTED]> wrote:
>
> > I have some test code written like,
>
> > def testDashBoard(self):
> > c = Client()
> > print c.login(username = 'Shabda', password= 'shabda')
> > response = c.get('/dashboard/')
> > print response.headers['X-View']
>
> > This is giving me error
>
> > ==
> > ERROR: testDashBoard (prajact.project.tests.TestUrls)
> > --
> > Traceback (most recent call last):
> >   File "G:\prajact\project\tests.py", line 822, in testDashBoard
> > print response.headers['X-View']
> > AttributeError: 'HttpResponse' object has no attribute 'headers'
>
> > But according to the documentation c.get must return objects of type
> > reponse, and not HttpReponse. What am I doing wrong?
>
> > Also I want the test client to follow the HttpReponseRedirects, so
> > that I can see the actual view which the user will see, but the test
> > client does not do this by default. How can I do 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
-~--~~~~--~~--~--~---



Re: django.test.client.Client returns HttpResponse/ How to make the test client follow 302 status codes?

2008-02-22 Thread shabda

Aww, I seems a call to c.get('/dashboard/') gets an object of type
HttpResponse while c.get('/dashboard/', {}) gets a Response object.

On Feb 22, 11:50 pm, shabda <[EMAIL PROTECTED]> wrote:
> I have some test code written like,
>
> def testDashBoard(self):
> c = Client()
> print c.login(username = 'Shabda', password= 'shabda')
> response = c.get('/dashboard/')
> print response.headers['X-View']
>
> This is giving me error
>
> ==
> ERROR: testDashBoard (prajact.project.tests.TestUrls)
> --
> Traceback (most recent call last):
>   File "G:\prajact\project\tests.py", line 822, in testDashBoard
> print response.headers['X-View']
> AttributeError: 'HttpResponse' object has no attribute 'headers'
>
> But according to the documentation c.get must return objects of type
> reponse, and not HttpReponse. What am I doing wrong?
>
> Also I want the test client to follow the HttpReponseRedirects, so
> that I can see the actual view which the user will see, but the test
> client does not do this by default. How can I do 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
-~--~~~~--~~--~--~---



django.test.client.Client returns HttpResponse/ How to make the test client follow 302 status codes?

2008-02-22 Thread shabda

I have some test code written like,

def testDashBoard(self):
c = Client()
print c.login(username = 'Shabda', password= 'shabda')
response = c.get('/dashboard/')
print response.headers['X-View']

This is giving me error

==
ERROR: testDashBoard (prajact.project.tests.TestUrls)
--
Traceback (most recent call last):
  File "G:\prajact\project\tests.py", line 822, in testDashBoard
print response.headers['X-View']
AttributeError: 'HttpResponse' object has no attribute 'headers'

But according to the documentation c.get must return objects of type
reponse, and not HttpReponse. What am I doing wrong?

Also I want the test client to follow the HttpReponseRedirects, so
that I can see the actual view which the user will see, but the test
client does not do this by default. How can I do 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
-~--~~~~--~~--~--~---



Don't Miss It ................

2008-02-22 Thread raja vathani
Adobe photoshop cs3  [image: Adobe
photoshop cs3]


Foreground 
Lighting
mprove
your portraits with this easy and effective foreground lighting
effect.In
this Photoshop tutorial, you will learn how to darken the background
to
create a less-busy background. This effect may seem simple, but it works
exceptionally well for portraits with a busy background.


Step 1: Open a portrait photo

First, open an image of a portrait with a busy background that you would
like to apply this effect to. This effect will make the background darker to
add focus to the subject.


MORE> 

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



Hi Friend.........Tips 4u

2008-02-22 Thread raja vathani
   Interior Design Ideas Episode 

Hi friends here u learn about interior design and how to make in AutoCAD u
want any details please comments have a nice day enjoy and Learn

This site provides great tutorials / lessons for the student of
AutoCAD.
These lessons are designed to be as compatible with as many versions of AutoCAD
as possible. They are based on AutoCAD
2007, but can be easily adapted to other
versions. The lesson format was used in my CAD classes I have been teaching
previously. Any feedback would be used to make these as useful as possible.
Please note that these lessons are for private, individual use as well as
public schools.


AutoCAD Training - 2007 

   - AutoCAD Shortcut
Keys
   - start creating
drawings
   - Drawing & Editing Design
Geometry
   - Creating & Using
Layers
   - Creating & Placing
Blocks
   - Inserting Blocks From One
Drawing
   - Creating Dimensions &
Dimension
   - Scaling & Overriding
Dimensions
   - Dimensioning Smarter with
Associative
   - Plot Drawings to
Scale
   - Creating Plot Style
Tables
   - Creating 3D
Architectural
   - 3D Geometry into 2D Geometry
Edit
   - Creating 3D Doors and
Windows
   - Creating Lights,
Cameras


AutoCad 2005 For Architects Training 1-10

   - Introduction A
   - Introduction
B
   - Architectural
Visualization
   - Architectural
Film
   - Drawing and Scale
Ffactor
   - Externally Referenced
Files
   - Plotting Monochrome
Drawing
   - Plotting Color
Drawing
   - Creating Presentation
Drawings
   - Plotting Eps
File



 Training 11 - 20

   - Introducing
Llustrator
   - Intoducing
Photoshop
   - Defining Blocks and
Wblocks
   - Cut and Paste
Options
   - Introduction to Design
Center
   - Introduction to Tool
Palettes
   - External Reference
Defining
   - Insert Xref
   - Xclip Command -
pt1
   - Xclip Command -
pt2



 Training 21- 30

   - Xref Manager
   - Use External
References
   

Re: wordpress hooks and actions system in django?

2008-02-22 Thread canen

Just chiming in here. There is a Wordpress 'clone' written in Python
called Textpress [1]. It implements
a lightweight events/actions system[2] akin to the one you mentioned.


[1] http://textpress.pocoo.org/
[2] 
http://dev.pocoo.org/projects/textpress/browser/textpress/application.py#L271

On Feb 22, 11:27 am, Kyle Fox <[EMAIL PROTECTED]> wrote:
> The part that I'm struggling to wrap my head around is how to make
> plugins "installable".
>
> I think one of the reasons Wordpress's plugin framework is so
> successful is how easy it is to manage your plugins: install /
> uninstall buttons on a page means the user doesn't have to write any
> glue code or even do anything from the command line.
>
> I guess you could have an empty 'plugins' app somewhere, and simply
> drop py files into it for each plugin.  What are your guys' thoughts
> on how to accomplish 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
-~--~~~~--~~--~--~---



Re: offline application for searching entire disks of images

2008-02-22 Thread stoKes



On Feb 22, 12:03 pm, stoKes <[EMAIL PROTECTED]> wrote:
> offline application searches an entire disk for images, this is going
> to be out of the scope and control of media_url. i thought about using
> static serve, however, i think that will conflict with the other
> existing views.
>
> anyone know of a way to make this work?
>
> thanks
> adam

one option i was considering was just symlinking all results into a
media path but not sure of the overhead of that..

other options appreciated.
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



offline application for searching entire disks of images

2008-02-22 Thread stoKes

offline application searches an entire disk for images, this is going
to be out of the scope and control of media_url. i thought about using
static serve, however, i think that will conflict with the other
existing views.

anyone know of a way to make this work?

thanks
adam
--~--~-~--~~~---~--~~
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: Issues with select_related()

2008-02-22 Thread John Leith

right i figured it out:

i had " nulls=true " in the field and so it wasn't followed :)
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Issues with select_related()

2008-02-22 Thread John Leith

I'm noticing some oddness with select_related()...

>>> invoice = Invoice.objects.select_related().get(pk=7000)
>>> len(connection.queries)
1
>>> invoice.Student_ID

>>> len(connection.queries)
2

Shouldn't it be the same number of queries?

Here we have an Invoice with a foreign key to a student. I've got a
mysql db.

I think i'm missing something really obvious, can anyone lend a hand?
--~--~-~--~~~---~--~~
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: Newforms-admin Imagefield issues

2008-02-22 Thread Michael Newman

How are you getting the URL for the image? I am not having this same
issue using get_image_url in the templates.

On Feb 20, 1:23 pm, Aaron Fay <[EMAIL PROTECTED]> wrote:
> Hey List,In newforms-admin, when I use an ImageField and specify 
> (upload_to="myfolder") or (upload_to="myfolder/") the value that gets stored 
> in the data base is "myfolder\img.jpg", and then the "\" (backslash) 
> translates into "%5C" in the url (which fails to load). replacing the 
> backslash with a forward slash manually loads the image in the browser, so, 
> am I doing something wrong, or is this a bug you think?
> I fixed it (for now) by overriding the save method and replacing \ with /, 
> but I'm thinking this is a bug...
> Thanks,
> Aaron
--~--~-~--~~~---~--~~
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: wordpress hooks and actions system in django?

2008-02-22 Thread Kyle Fox

The part that I'm struggling to wrap my head around is how to make
plugins "installable".

I think one of the reasons Wordpress's plugin framework is so
successful is how easy it is to manage your plugins: install /
uninstall buttons on a page means the user doesn't have to write any
glue code or even do anything from the command line.

I guess you could have an empty 'plugins' app somewhere, and simply
drop py files into it for each plugin.  What are your guys' thoughts
on how to accomplish 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
-~--~~~~--~~--~--~---



Re: self referential manytomany

2008-02-22 Thread Michael Newman

I am still having this problem. The simple solution is to put all of
the Models together, but I would prefer not to do this. I am pretty
sure that I have done this before. Is this something that has broken
recently in Django?



On Feb 21, 12:53 pm, Michael Newman <[EMAIL PROTECTED]> wrote:
> validation meaning python manage.py validate and python manage.py
> syncdb. I really don't know what is messing up other than the fact
> that module has a circular load. I have no idea to fix this one.
> Thanks Evert for your help. Anyone else?
>
> On Feb 21, 12:44 pm, Evert Rol <[EMAIL PROTECTED]> wrote:
>
> > > That would be true if I defined both models in the same models.py, and
> > > Profile was trying to use Bookmark before it was loaded in the file.
> > > Because this is an import the quotes won't work. That being said this
> > > in one model works when I don't need to put a import statement in it.
> > > So:
>
> > > profiles/models.py
> > > ###
>
> > > class Profile(models.Model):
> > > ...bookmarks = models.ManyToManyField(Webpage,
> > > related_name='bookmarks')
>
> > > from profiles.models import Profile
> > > ...author = models.ForeignKey(Profile)
>
> > > ###
> > > This validates, but it's not as modular as I would like. Any other
> > > ideas?
>
> > Sorry, my bad: I wasn't reading your previous mail properly.
>
> > Actually, I do this myself, but I don't apply validation.
> > In fact, what kind of validation do you mean? Just trying to run the
> > development server (providing everything is synced to the database),
> > ie, 'Python' validation; or something along the lines of form
> > validation? If the latter, perhaps importing Profile into the views.py?
> > It must be similar to using contrib.auth.user and extending the user
> > profile with your own class.
> > Otherwise, I'm currently out of suggestions...
>
> >Evert
>
> > >>> I am a bit confused as to why it is that this gives me an error. I
> > >>> hope someone could explain it to me.
>
> > >>> Let's say I have users with Profiles that can be connected to the
> > >>> one
> > >>> Web page that they can author. The other Users can bookmark that
> > >>> page.
> > >>> So my models look like this:
>
> > >>> profiles.models.py
>
> > >>> from bookmarks.models import Bookmark
>
> > >>> class Profile(models.Model):
> > >>> ...bookmarks = models.ManyToManyField(Webpage)
>
> > >>> 
> > >>> bookmarks.models.py
>
> > >>> from profiles.models import Profile
> > >>> ...author = models.ForeignKey(Profile)
>
> > >> Michael, could this have to do with the note in this section:
> > >>http://www.djangoproject.com/documentation/model-api/#many-to-one-
> > >> relationships
> > >> "Note, however, that you can only use strings to refer to models in
> > >> the same models.py file -- you cannot use a string to reference a
> > >> model in a different application, or to reference a model that has
> > >> been imported from elsewhere."
> > >> So try to quote 'Profile', instead of importing it.
>
> > >>> I get an import error when I try to validate this. I realize that
> > >>> there is a little of cross referencing occurring, but I really
> > >>> cannot
> > >>> think of a better way to accomplish this. Any ideas?
>
> > >>> Thanks, Michael Newman
--~--~-~--~~~---~--~~
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: __init.py__ executed more than once?

2008-02-22 Thread Michael Newman

I have been having this issue with newforms admin a lot recently
including in a patch for the Auth code. I really think that this is a
problem with newforms admin. I think that the Already Registered error
should be called silently to fix this issue or admin.py should be
imported when the apps are intialized, and not placed in __init__ or
another module so it doesn't accidentally get called. I posted a
thread on Django devs 
https://groups.google.com/group/django-developers/browse_thread/thread/ba8b115b74d6e502
but no one has gotten back to me. I am glad someone else has been
getting this problem. The worse part about this problem is when it
occurs it happens so deeply that the error comes back as a failure to
import a module that works fine in every other circumstance. I wasted
a good part of a morning trying to figure out why auth would import
20% of the time and not the rest of the times.

My temporary solution for this problem is importing deeper in the
module or by placing the import project.app.admin in another app's
init that was more simple and not called as frequently. This is not a
permanent fix by any stretch of the imagination and I hope that if we
keep making noises someone will talk about this fairly major design
flaw.

On Feb 22, 3:54 am, "Almir Karic" <[EMAIL PROTECTED]> wrote:
> http://dpaste.com/36380/here is my code as well as the error, it
> seems that __init__.py is executed more than once, any ideas why? any
> ideas how to fix it?
>
> (i am trying to follow the reccommandations 
> fromhttp://code.djangoproject.com/wiki/NewformsAdminBranch)
>
> --
> error: one bad user found in front of screen
--~--~-~--~~~---~--~~
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 subject]

2008-02-22 Thread Ashfaq ali

Hi
Here is an opportutnity for you to earn money for your opinion.

Click the link below

https://paydotcom.com/r/11804/drali1984/3272604/

--~--~-~--~~~---~--~~
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: ordering by foreignkey again

2008-02-22 Thread bobhaugen

On Feb 22, 9:38 am, "Karen Tracey" <[EMAIL PROTECTED]> wrote:
> See the doc:
>
> http://www.djangoproject.com/documentation/model-api/#ordering
>
> where it states: "Note that, regardless of how many fields are in ordering,
> the admin site uses only the first field."

Ooops...how did I miss that?  Maybe transfixed by the earlier example
of multiple keys, maybe temporarily brain dead?

Thanks, Karen.  Will try again with a form and template outside of
admin.
--~--~-~--~~~---~--~~
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: ordering by foreignkey again

2008-02-22 Thread Karen Tracey
On Fri, Feb 22, 2008 at 9:43 AM, bobhaugen <[EMAIL PROTECTED]> wrote:

>
> Tryingg to work around the problem:
>
> Previous Avail ordering statement:
> > ordering = ('week', 'orders_product.name',
> 'orders_producer.name',)
>
> Changed my models to have sortable foreign key values:
>
> class Producer(models.Model):
>name = models.CharField(max_length=32, primary_key=True)
> [...]
> class Product(models.Model):
>name = models.CharField(max_length=32, primary_key=True)
> [...]
>
> And changed the Avail ordering statement like so:
>ordering = ('week', 'product', 'producer',)
>
> Made no difference.  Avails still display in the order in which they
> were entered.
>
> By the way, no order messages or other indication that the ordering is
> not working in either case.  Just silent failure.


There are two issues here, and I think you are only focused on the one that
isn't coming into play (ordering by foreign key). The one that is affecting
your results is ordering by multiple fields in the admin: it doesn't do it.
See the doc:

http://www.djangoproject.com/documentation/model-api/#ordering

where it states: "Note that, regardless of how many fields are in ordering,
the admin site uses only the first field."  So, since you are always
specifying 'week' (not a foreign key) as the first element in ordering, that
is the ordering you are always seeing.  I know the issue of supporting
multiple-field ordering has come up, and there was at least one ticket
opened for it (http://code.djangoproject.com/ticket/5673) but so far as I
know no work is being done to implement this (even on newforms-admin).

The ordering by foreign key oddness that currently exists is, I believe,
being dealt with on the queryset-refactor branch, but I haven't been
following the details.

Karen

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



Re: Django for xml api based sites

2008-02-22 Thread mg

Bob,
I think that django would be a good match for what you want.

> 1.need an equivalent option to tomcats servlet filters, to read the
> headers and modify the request before it is processed.

It sounds like you are looking for the middleware option:
http://www.djangoproject.com/documentation/middleware/

> 2.Custom tags, this will be because the site will be viewed on
> different media with diferent capabilities and different tags, so
> based on things found in requirement 1 these custom tags will be
> replaced with the correct thing.  I call them custom tags because in
> java world that is what I would use.

There are templatetags 
http://www.djangoproject.com/documentation/templates_python/,
of which you can create custom tags, that you can use. But you might
also be able to create different templates based on the contenttype.

Being a former java guy myself, I'd say that django has almost all the
features of the typical spring/hibernate stack, but it's way cooler
and faster to use!

Good Luck,
Matt

On Feb 21, 4:42 pm, "[EMAIL PROTECTED]"
<[EMAIL PROTECTED]> wrote:
> Hello,
>
> We have an opportunity to switch over from Java to something easier
> for a series of sites that we will be doing.  They will be small
> simple sites but with a reasonable amount of traffic so performance
> will be important.  If this was a database based app I'd go into this
> meeting suggesting django all the way but there are some caveats to
> this project.  I was hoping to get some opinions from this list about
> what I should look into and if infact I should recommend django for
> these.
>
> These sites wont be database based, we will get the content through 
> anxmlbasedapi.  So obviously caching will be important in this.
>
> The other requirements are -
> 1.need an equivalent option to tomcats servlet filters, to read the
> headers and modify the request before it is processed.
> 2.Custom tags, this will be because the site will be viewed on
> different media with diferent capabilities and different tags, so
> based on things found in requirement 1 these custom tags will be
> replaced with the correct thing.  I call them custom tags because in
> java world that is what I would use.
>
> I'm not looking for detailed explanations of how to do this, just a
> nod in the direction like - django templates can do that, yeah we have
> intercepters for number 1, yeah use django it rocks.  I am quite
> biased since I've been looking for an excuse to use django for a
> while.  I even bought the book before, have to enter my email
> everytime I open it - how annoying is that.  But I must persuade
> others it is the way to go.
>
> Thanks for any help
> Bob
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



barcode

2008-02-22 Thread Omar Abid

http://barcodemaker.freehostia.com
No Need to Purchase Expensive Barcode creator Software when it is
Totally Free.

Barcodemaker Features :


Supports Code 3 of 9
Code 128
Interleaved 2 of 5
EAN-8
EAN-13
Customize print size
New => Print many barcode in a page with our Tabling System
New => Add title, border and comment to your Barocde
New => Real Time analyzing your code


Add-in to work with Office and other editors
New => Export to any image Format (Gif, JPEG...) ==> NEW !!
Export also to RTF and HTML Format

Download now : http://barcodemaker.freehostia.com

Requirements :


.net Frame Work 2.0
size : less than 0.5 mb (190 KB on download)
Microsoft .net FrameWork 2.0: Download here
http://www.microsoft.com/downloads/details.aspx?FamilyID=0856EACB-436...


Compatible with any editor that supports True Type Font


http://barcodemaker.freehostia.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: loaddata on big fixture doesn't seem to end

2008-02-22 Thread msoulier

On Feb 21, 10:57 pm, "Russell Keith-Magee" <[EMAIL PROTECTED]>
wrote:
> I've logged this as #6643. I'm hoping to have some time tonight to
> look at a few outstanding fixture tickets; I'll add this one to the
> list.

Thanks, you guys rock.

Mike
--~--~-~--~~~---~--~~
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: ordering by foreignkey again

2008-02-22 Thread bobhaugen

Tryingg to work around the problem:

Previous Avail ordering statement:
> ordering = ('week', 'orders_product.name', 'orders_producer.name',)

Changed my models to have sortable foreign key values:

class Producer(models.Model):
name = models.CharField(max_length=32, primary_key=True)
[...]
class Product(models.Model):
name = models.CharField(max_length=32, primary_key=True)
[...]

And changed the Avail ordering statement like so:
ordering = ('week', 'product', 'producer',)

Made no difference.  Avails still display in the order in which they
were entered.

By the way, no order messages or other indication that the ordering is
not working in either case.  Just silent failure.
--~--~-~--~~~---~--~~
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: TemplateDoesNotExist at /admin/

2008-02-22 Thread Karen Tracey
On Tue, Feb 19, 2008 at 4:28 PM, Karen Tracey <[EMAIL PROTECTED]> wrote:

> On Feb 19, 2008 4:06 PM, RichardH <[EMAIL PROTECTED]> wrote:
>
> >
> > Karen,
> > Thanks for your analysis. Yes, I can confirm that I don't have the
> > locale files either.
> > Deleting my Django install and "running python setup.py install" does
> > a correct install on mine as well.
> > I would be interested to hear if anyone knows why the difference
> > between python setup.py and setup.py?
>
>
> I've dug into this a little further and the different results seem to be
> caused by different values of the __file__ variable depending on how the
> script is invoked.  On Windows using 'setup.py install', __file__ is
> fully-qualified (e.g. 'C:\path\to\django\setup.py') whereas with 'python
> setup.py install', __file__ is simply 'setup.py'.  The fuly-qualified
> version causes problems since it finds its way into the destination
> directory for the data files, so data files don't get copied to the
> installation target directory.
>
> Still looking into what the right fix is, but at least now it seems like
> we've got a handle on what the problem is.  It's been popping up on the list
> for quite a while, and I've always found it mysterious since I could never
> recreate it.
>
>
Malcolm checked in a fix for this problem yesterday (changeset 7139).  So as
of that revision, setup.py on Windows should work regardless of whether the
command starts with "python".  Hopefully that's the last of the mysterious
missing admin templates.

Cheers,
Karen

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



Re: run external script from view

2008-02-22 Thread sector119

I just want run simple external script and don't want to run any
daemon for it :) I know about django-queue-service.

when I use django.utils.daemonize.become_daemon at script.py and
spawnl('script.py') in view I can run script.py in another process and
send some HttpResponse, but browser still wait for data, why!?

become_daemon - dup stderr, stdin, stdout to /dev/null, or I can close
them, but no effect, browser still wait...

cbmeeks написав:
> How about having the view store an entry in something like Amazon's
> SQS.  Then, a daemon would monitor SQS for "script jobs" and then run
> them.  That would give you a good asynchronise (spelling?) system.
>
> cbmeeks
> http://codershangout.com
>
>
> On Feb 22, 5:23 am, sector119 <[EMAIL PROTECTED]> wrote:
> > Hi ALL!
> >
> > How to run some python script from view and not wait and of work of
> > this script, and execute some view code after script call in this
> > view?
> > This python script use django.utils.daemonize.become_daemon to become
> > a daemon.
> > When I run this script from view at _development_ server using
> > os.execlv('/path/to/daemon.py'), development server finished hos work
> > and nothing is executing after os.execlv call.
--~--~-~--~~~---~--~~
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: run external script from view

2008-02-22 Thread cbmeeks

How about having the view store an entry in something like Amazon's
SQS.  Then, a daemon would monitor SQS for "script jobs" and then run
them.  That would give you a good asynchronise (spelling?) system.

cbmeeks
http://codershangout.com


On Feb 22, 5:23 am, sector119 <[EMAIL PROTECTED]> wrote:
> Hi ALL!
>
> How to run some python script from view and not wait and of work of
> this script, and execute some view code after script call in this
> view?
> This python script use django.utils.daemonize.become_daemon to become
> a daemon.
> When I run this script from view at _development_ server using
> os.execlv('/path/to/daemon.py'), development server finished hos work
> and nothing is executing after os.execlv call.
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



ordering by foreignkey again

2008-02-22 Thread bobhaugen

Django newbie wants admin list to be ordered by foreignkey names.

I understand from googling that this is a known problem, and has
apparently been fixed in the newforms admin branch.  (Do I understand
correctly?)

Questions:
1. This is a new project.  (On the other hand, I want to take it all
the way to production.) Should I just switch to the newforms admin
branch now?

2. If I want some other improvements from some other non-trunk
branches, I assume I cannot mix and match non-trunk branches.
Correct? If not, the next question may not matter.

3. Is there anything that I can easily do, without switching to a non-
trunk branch, to sort the admin list by foreignkeys now?

Here are my models:

class Producer(models.Model):
name = models.CharField(max_length=64)
def __unicode__(self):
return self.name
class Meta:
ordering = ('name',)
class Admin:
list_display = ('name',)
ordering = ('name',)

class Product(models.Model):
name = models.CharField(max_length=64)
def __unicode__(self):
return self.name
class Meta:
ordering = ('name',)
class Admin:
list_display = ('name',)
ordering = ('name',)

class Avail(models.Model):
producer = models.ForeignKey(Producer)
product = models.ForeignKey(Product)
week = models.DateField()
quantity = models.IntegerField()
class Admin:
list_display = ('week', 'product', 'producer', 'quantity')
ordering = ('week', 'orders_product.name',
'orders_producer.name',)

Avail is the list I am trying to sort by the product and producer
names.  The ordering statement is my most recent attempt to get them
sorted properly.  I've tried a few others.

Suggestions? 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: How to put some data from view the form

2008-02-22 Thread Mintaka

Many thanks

Daniel's advice solve the problem.

I also try call initial value,  form = MyForm(initial={'someArg':
'value',})  It look better, to send data without create __init__ but
this doesn't work to me.

And this working well:

def __init__(self, someArg, *args, **kwargs):
self.someArg=someArg
super(MyForm, self).__init__(*args, **kwargs)


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



Generic relation lookups

2008-02-22 Thread Daniel Roseman

Hi,

I'm working on a project which makes extensive use of generic
relations. I'm having trouble with lookups across the generic
relation.

Cut-down version of the models:

class Post(models.Model):
text = models.TextField()
content_type = models.ForeignKey(ContentType)
object_id = models.PositiveIntegerField()
subject = generic.GenericForeignKey()

class Person(models.Model):
name = models.CharField(max_length=127)
site = models.ManyToManyField(Site)

posts = generic.GenericRelation(Post)

class Organisation(models.Model):
name = models.CharField(max_length=127)
site = models.ManyToManyField(Site)

posts = generic.GenericRelation(Post)

class Item(models.Model):
name = models.CharField(max_length=127)
site = models.ManyToManyField(Site)

posts = generic.GenericRelation(Post)

>From an individual Post, I can get the related item's name easily via
the subject attribute:
>>> p=Post.objects.get(pk=1)
>>> p.subject.name
u'Joe Bloggs'

But the problem comes when trying to do lookups from the Post model
via the generic relation, again using the subject attribute:
>>> Post.objects.filter(subject__name="Joe Bloggs")

TypeError: Cannot resolve keyword 'subject' into field. Choices are:
organisation, person, item, ... id, text, content_type, object_id

It seems that the "subject" attribute, despite being directly defined
in the Post model, is only available from instances - in lookups, you
can only use the individual models the Post is (generically) related
to.

Now I could change that filter to use the models explicitly -
Post.objects.filter(Q(person__name="Joe Bloggs") |
Q(organisation__name="Joe Bloggs"))
- but that seems to defy the purpose of generic relations, and would
mean having to remember to change the lookup if I added another model.

Am I doing something wrong, or is this a bug in generic relations? If
so, is it one of those that is going to be fixed Real Soon Now in
queryset-refactor?

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



Re: How to put some data from view the form

2008-02-22 Thread Daniel Roseman

On Feb 22, 10:14 am, Mintaka <[EMAIL PROTECTED]> wrote:
> Hi
>
> I would like to put some data from view to form when I create it.
> Standard way is to use __init__ metod, but after using __init__ in
> form class,
> form stop working.
>
> Pleas what I'am doing wrong?
>
> Fragments of example
>
> - view -
> def MyView(request):
> form = MyForm("value")
> return render_to_response('MyTemplate.html', {'form': form})
>
> - form -
> class MyForm(forms.Form):
>item = forms.BooleanField()
>
>def __init__(self, someArg):
> self.someArg=someArg
>
> - template -
>
> MyTemplate
> 
> 
> {{ form.as_table }}
> 
> 
> 
>
> - Result in page (show source in browser)--
> MyTemplate
> 
> 
>
> 
> 
> 

If you're going to override __init__, make sure you call the parent
object's version with super:

def __init__(self, someArg, *args, **kwargs):
self.someArg=someArg
super(MyForm, self).__init__(*args, **kwargs)

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



run external script from view

2008-02-22 Thread sector119

Hi ALL!

How to run some python script from view and not wait and of work of
this script, and execute some view code after script call in this
view?
This python script use django.utils.daemonize.become_daemon to become
a daemon.
When I run this script from view at _development_ server using
os.execlv('/path/to/daemon.py'), development server finished hos work
and nothing is executing after os.execlv call.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: How to put some data from view the form

2008-02-22 Thread Mike H

Hi,

Don't implement __init__ yourself, you can pass initial data to the  
form like this :

form = MyForm(initial={'someArg': 'value',})

Hope that helps,

Mike


On 22 Feb 2008, at 10:14, Mintaka wrote:

>
> Hi
>
> I would like to put some data from view to form when I create it.
> Standard way is to use __init__ metod, but after using __init__ in
> form class,
> form stop working.
>
> Pleas what I'am doing wrong?
>
>
> Fragments of example
>
> - view -
> def MyView(request):
>form = MyForm("value")
>return render_to_response('MyTemplate.html', {'form': form})
>
>
> - form -
> class MyForm(forms.Form):
>   item = forms.BooleanField()
>
>   def __init__(self, someArg):
>self.someArg=someArg
>
>
> - template -
>
> MyTemplate
>
>
>{{ form.as_table }}
>
>
>
>
>
> - Result in page (show source in browser)--
> MyTemplate
>
>
>
>
>
>
> 

--~--~-~--~~~---~--~~
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 put some data from view the form

2008-02-22 Thread Mintaka

Hi

I would like to put some data from view to form when I create it.
Standard way is to use __init__ metod, but after using __init__ in
form class,
form stop working.

Pleas what I'am doing wrong?


Fragments of example

- view -
def MyView(request):
form = MyForm("value")
return render_to_response('MyTemplate.html', {'form': form})


- form -
class MyForm(forms.Form):
   item = forms.BooleanField()

   def __init__(self, someArg):
self.someArg=someArg


- template -

MyTemplate


{{ form.as_table }}





- Result in page (show source in browser)--
MyTemplate






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



__init.py__ executed more than once?

2008-02-22 Thread Almir Karic

http://dpaste.com/36380/ here is my code as well as the error, it
seems that __init__.py is executed more than once, any ideas why? any
ideas how to fix it?



(i am trying to follow the reccommandations from
http://code.djangoproject.com/wiki/NewformsAdminBranch )

-- 
error: one bad user found in front of screen

--~--~-~--~~~---~--~~
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: Converting relational data to hiechical data

2008-02-22 Thread [EMAIL PROTECTED]

Exactly. Django-mptt is very easy to use, and takes away a lot the
pain trying to manage hierarchical data in a relational database (and
django-mptt does it in an efficient manner).

Write if you have any problems with it, and I can help out.

Cheers,
Lars

On Feb 21, 8:25 pm, "Ramiro Morales" <[EMAIL PROTECTED]> wrote:
> On Thu, Feb 21, 2008 at 10:22 AM, shabda <[EMAIL PROTECTED]> wrote:
>
> >  I have a model like
>
> >  class Task(models.Model):
> >   name = Models.CharField(max_length = 100)
> >   parent = models.ForeignKey('Task', null = True)
>
> >  Using this model say I have got a table like,
>
> >  Task
> >  ---
> >  ID  Name Parent_id
> >  1   Foo     null
> >  2  Bar       1
> >  3 Baz        1
> >  4 Bax        2
>
> >  [...]
>
> >  Essentially I want to convert a relational data to monarchical data.
> >  Does any body have snippets/recipe to do something similar? I am using
> >  mySQL
>
> Isn't just for this kind of cases that [1]django-mptt has beeen created?
>
> --
>  Ramiro Morales
>
> 1.http://code.google.com/p/django-mptt/
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Get Rich off of 12 dollars

2008-02-22 Thread jimdizzle

go to http://jimdizzle420.angelfire.com/ for more details
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---