Would object creation involving FK still work when the 2 tables involved are in different databases?

2011-03-29 Thread Andy
Hi,

Say I have a model:

class Note(models.Model) :
text = models.TextField()
owner = models.ForeignKey(User)

If Note and User are located on different databases, would the
following still work?

note = Note(text='hello world', owner=request.user)

I understand that join will not work across databases, but will
creating object instance like above still work?

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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Complex query

2011-03-29 Thread gontran
Hi everybody,

considering the folowing models:

UserProfile(models.Model):
user = models.OneToOneField(User)
company = models.ForeignKey(Company)

Company(models.Model):
product_licences = models.manyToManyField(ProductLicence)

Product(models.Model):
...some fields...

ProductLicence(models.Model):
product = models.ForeignKey(Product)

News(models.Model):
   related_products = models.ManyToManyField(Product)

I already know how to retrieve all distinct products for which the
company of the user owns licences, but now, what I want to do is to
retrieve all news, for a given user, that are related to products, for
which the company of the user owns licences.

Is it possible to do it with a single query?


Thank you for your time,

regards,

Gontran

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Complex query

2011-03-29 Thread Kenneth Gonsalves
On Tue, 2011-03-29 at 00:11 -0700, gontran wrote:
> UserProfile(models.Model):
> user = models.OneToOneField(User)
> company = models.ForeignKey(Company)
> 
> Company(models.Model):
> product_licences = models.manyToManyField(ProductLicence)
> 
> Product(models.Model):
> ...some fields...
> 
> ProductLicence(models.Model):
> product = models.ForeignKey(Product)
> 
> News(models.Model):
>related_products = models.ManyToManyField(Product)
> 
> I already know how to retrieve all distinct products for which the
> company of the user owns licences, but now, what I want to do is to
> retrieve all news, for a given user, that are related to products, for
> which the company of the user owns licences.
> 
> 

Product is not linked to any model?
-- 
regards
KG
http://lawgon.livejournal.com
Coimbatore LUG rox
http://ilugcbe.techstud.org/

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



Re: Complex query

2011-03-29 Thread gontran
Yes: ProductLicence and News

On 29 mar, 09:19, Kenneth Gonsalves  wrote:
> On Tue, 2011-03-29 at 00:11 -0700, gontran wrote:
> > UserProfile(models.Model):
> >     user = models.OneToOneField(User)
> >     company = models.ForeignKey(Company)
>
> > Company(models.Model):
> >     product_licences = models.manyToManyField(ProductLicence)
>
> > Product(models.Model):
> >     ...some fields...
>
> > ProductLicence(models.Model):
> >     product = models.ForeignKey(Product)
>
> > News(models.Model):
> >    related_products = models.ManyToManyField(Product)
>
> > I already know how to retrieve all distinct products for which the
> > company of the user owns licences, but now, what I want to do is to
> > retrieve all news, for a given user, that are related to products, for
> > which the company of the user owns licences.
>
> Product is not linked to any model?
> --
> regards
> KGhttp://lawgon.livejournal.com
> Coimbatore LUG roxhttp://ilugcbe.techstud.org/

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



Re: Complex query

2011-03-29 Thread Kenneth Gonsalves
Product is not linked to them - they are linked to Product. I do not
think you can do it in one query because there are ManyToMany fields
which have to be retrieved and then you have to iterate over them.
Certainly more than one query.

On Tue, 2011-03-29 at 00:24 -0700, gontran wrote:
> Yes: ProductLicence and News
> 
> On 29 mar, 09:19, Kenneth Gonsalves  wrote:
> > On Tue, 2011-03-29 at 00:11 -0700, gontran wrote:
> > > UserProfile(models.Model):
> > > user = models.OneToOneField(User)
> > > company = models.ForeignKey(Company)
> >
> > > Company(models.Model):
> > > product_licences = models.manyToManyField(ProductLicence)
> >
> > > Product(models.Model):
> > > ...some fields...
> >
> > > ProductLicence(models.Model):
> > > product = models.ForeignKey(Product)
> >
> > > News(models.Model):
> > >related_products = models.ManyToManyField(Product)
> >
> > > I already know how to retrieve all distinct products for which the
> > > company of the user owns licences, but now, what I want to do is to
> > > retrieve all news, for a given user, that are related to products, for
> > > which the company of the user owns licences.
> >
> > Product is not linked to any model?
> > --
> > regards
> > KGhttp://lawgon.livejournal.com
> > Coimbatore LUG roxhttp://ilugcbe.techstud.org/
> 


-- 
regards
KG
http://lawgon.livejournal.com
Coimbatore LUG rox
http://ilugcbe.techstud.org/

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



Re: Complex query

2011-03-29 Thread gontran
Ok. I 'll try again
Thank you very much for your consideration.

Regards,

Gontran

On 29 mar, 09:33, Kenneth Gonsalves  wrote:
> Product is not linked to them - they are linked to Product. I do not
> think you can do it in one query because there are ManyToMany fields
> which have to be retrieved and then you have to iterate over them.
> Certainly more than one query.
>
>
>
>
>
>
>
>
>
> On Tue, 2011-03-29 at 00:24 -0700, gontran wrote:
> > Yes: ProductLicence and News
>
> > On 29 mar, 09:19, Kenneth Gonsalves  wrote:
> > > On Tue, 2011-03-29 at 00:11 -0700, gontran wrote:
> > > > UserProfile(models.Model):
> > > >     user = models.OneToOneField(User)
> > > >     company = models.ForeignKey(Company)
>
> > > > Company(models.Model):
> > > >     product_licences = models.manyToManyField(ProductLicence)
>
> > > > Product(models.Model):
> > > >     ...some fields...
>
> > > > ProductLicence(models.Model):
> > > >     product = models.ForeignKey(Product)
>
> > > > News(models.Model):
> > > >    related_products = models.ManyToManyField(Product)
>
> > > > I already know how to retrieve all distinct products for which the
> > > > company of the user owns licences, but now, what I want to do is to
> > > > retrieve all news, for a given user, that are related to products, for
> > > > which the company of the user owns licences.
>
> > > Product is not linked to any model?
> > > --
> > > regards
> > > KGhttp://lawgon.livejournal.com
> > > Coimbatore LUG roxhttp://ilugcbe.techstud.org/
>
> --
> regards
> KGhttp://lawgon.livejournal.com
> Coimbatore LUG roxhttp://ilugcbe.techstud.org/

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



Re: Complex query

2011-03-29 Thread bruno desthuilliers
On 29 mar, 09:33, Kenneth Gonsalves  wrote:
> Product is not linked to them - they are linked to Product.

Sorry but I dont see the point here - you can follow a relationship
both way.

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Complex query

2011-03-29 Thread bruno desthuilliers


On 29 mar, 09:11, gontran  wrote:
> Hi everybody,
>
> considering the folowing models:
>
> UserProfile(models.Model):
>     user = models.OneToOneField(User)
>     company = models.ForeignKey(Company)
>
> Company(models.Model):
>     product_licences = models.manyToManyField(ProductLicence)


Sorry if I missed something, but are you sure you want a m2m
relationship here ??? This means that a same licence can "belong" to
many companies, which seems rather weird to me. As far as I'm
concerned I'd make "company" a foreign key in ProductLicence - or I
just don't understand your definition of what "licence" is ???


> Product(models.Model):
>     ...some fields...
>
> ProductLicence(models.Model):
>     product = models.ForeignKey(Product)
>


(snip)

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



Re: Complex query

2011-03-29 Thread gontran
Hi Bruno,

yes you're right. I should change my model in the way you mentioned
it. I saw that a couple of minutes ago.

And to answer to my initial question, I might have found the answer.
The query would be:

news = News.objects.filter(related_products__productlicence__in =
user.get_profile().company.product_licences.all()).distinct()

On 29 mar, 10:24, bruno desthuilliers 
wrote:
> On 29 mar, 09:11, gontran  wrote:
>
> > Hi everybody,
>
> > considering the folowing models:
>
> > UserProfile(models.Model):
> >     user = models.OneToOneField(User)
> >     company = models.ForeignKey(Company)
>
> > Company(models.Model):
> >     product_licences = models.manyToManyField(ProductLicence)
>
> Sorry if I missed something, but are you sure you want a m2m
> relationship here ??? This means that a same licence can "belong" to
> many companies, which seems rather weird to me. As far as I'm
> concerned I'd make "company" a foreign key in ProductLicence - or I
> just don't understand your definition of what "licence" is ???
>
> > Product(models.Model):
> >     ...some fields...
>
> > ProductLicence(models.Model):
> >     product = models.ForeignKey(Product)
>
> (snip)

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



Re: Complex query

2011-03-29 Thread Kenneth Gonsalves
On Tue, 2011-03-29 at 01:17 -0700, bruno desthuilliers wrote:
> On 29 mar, 09:33, Kenneth Gonsalves  wrote:
> > Product is not linked to them - they are linked to Product.
> 
> Sorry but I dont see the point here - you can follow a relationship
> both way. 

pointless nitpick - apologies
-- 
regards
KG
http://lawgon.livejournal.com
Coimbatore LUG rox
http://ilugcbe.techstud.org/

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



Help on setting TIME_ZONE to 'UTC'

2011-03-29 Thread aa bb
Hi all! I'm a Django newbie. I set TIME_ZONE to 'UTC' in my project
settings.py. Then I have defined a data model like:

class D(models.Model):
  #some fields
  joined_at = models.DateTimeField(null = True, auto_now_add = True)
  #some other fields

I expect when a new D instance is created, its joined_at field will be
a value equivalent to datetime.utcnow(), becuase I set TIME_ZONE to
'UTC'. But, when I tested it on Windows, I found that it's in fact
datetime.now()! I looked for a while for the reason but nothing
valueble. So please give me a hand if you can. Doesn't UTC time zone
work in Django? Thanks in advance!

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Fwd: Help with creating a list in the template

2011-03-29 Thread satvik chauhan
-- Forwarded message --
From: satvik chauhan 
Date: Tue, Mar 29, 2011 at 2:01 PM
Subject: Help with creating a list in the template
To: django-develop...@googlegroups.com



Hey ,
 I am using the contrib.comments app and have created a custom
my_comment_app with one additional field 'xuser' which is a foreignkeyfield
of 'User' model. I am successfully able to post comments.I am  using this
code to display my comments :
{% for comments in comment_list %}

do something

{% endfor %}

but what I want is to display comments on the basis of  the user in the
'xuser' field.
example suppose for all comments 'xuser' field have two users as 'foo' and
'bar'. then It should first display all the comments of foo then the 'post
comment form' , then all the comments  of bar then post comment form and so
on.
What I thought a solution of it as to create a list of users in the 'xuser'
field with no user repeated, and then iterate over it and display comments.
but what I am stuck at is how to create the list in the template.


-Satvik



-- 
--
Satvik Chauhan
Sophomore Under Graduate Student
Deptt. of Computer Science and Engineering
Indian Institute of Technology Kanpur
Kanpur-208016, INDIA
Email: mystic.sat...@gmail.com , satv...@iitk.ac.in

--

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



Re: Just started Django - please help clarify web site configuration strategy

2011-03-29 Thread bruno desthuilliers

On 29 mar, 00:37, Jumpfroggy  wrote:
(snip)

> There is no callback mechanism.  You can add code to any file
> (models.py is a good place), and you can do some tricky python-fu to
> make sure it only runs once per process, but that's a bit of a hack.

Indeed - and more often than not a good way to get you into more
trouble than you'd want.

> Also, you might be over-optimizing.  

The OP was specifically talking about menus built from the db. It just
happens that I had the very same problem in my last project - menus
built from the db, really complex queries involved, and not much I
could optimize here. Rebuilding these (rarely changing) menus on each
request would of course be stupid, and the obvious solution here was
to cache them...

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Complex query

2011-03-29 Thread gontran
Now that I changed my model, the query is a little bit different.
So, my models:

UserProfile(models.Model):
user = models.OneToOneField(User)
company = models.ForeignKey(Company)

Company(models.Model):
...some fields...

Product(models.Model):
...some fields...

ProductLicence(models.Model):
product = models.ForeignKey(Product)
company = models.ForeignKey(Company)

News(models.Model):
   related_products = models.ManyToManyField(Product)


And my query:
news =
News.objects.filter(related_products__productlicence__in=user.get_profile().company.productlicence_set.all()).distinct()


I hope that it will be useful to somebody.

Regards,

Gontran

On 29 mar, 10:34, Kenneth Gonsalves  wrote:
> On Tue, 2011-03-29 at 01:17 -0700, bruno desthuilliers wrote:
> > On 29 mar, 09:33, Kenneth Gonsalves  wrote:
> > > Product is not linked to them - they are linked to Product.
>
> > Sorry but I dont see the point here - you can follow a relationship
> > both way.
>
> pointless nitpick - apologies
> --
> regards
> KGhttp://lawgon.livejournal.com
> Coimbatore LUG roxhttp://ilugcbe.techstud.org/

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



how to create message box in Django?

2011-03-29 Thread djangodjango django
Hi all,

Could someone please tell me how to create a Message Box using Django?

Thanks in advance.

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



How to create message box window using Django

2011-03-29 Thread django beginner
Hi all,

Could someone please tell me how to create a Message Box using Django?

Thanks in advance.

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Just started Django - please help clarify web site configuration strategy

2011-03-29 Thread bruno desthuilliers
On 28 mar, 20:58, javatina  wrote:
> Thanks for responding. It's been very important - helps "gauge"
> thinking, how far I am off :)
>
> 1. I haven't yet looked at middlewares - will do.
>
> 2. custom template tags - I do not see how they can help here

You were talking about menus built from the db. Using a custom tag to
build these menus gives you the flexibility to only call on the
relevant code when needed - instead of calling it on each and every
use of a RequestContext (remember that RequestContexts can be used by
any template rendering code - that is mails, templatetags etc).

Once you've written your custom Menu templatetag, caching the result
is a piece of cake.


> 5. Can you please clarify what you mean by "memorization"

s/memorization/memoization.

http://www.google.fr/search?q=memoization

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: How to create message box window using Django

2011-03-29 Thread Mike Ramirez
On Tuesday, March 29, 2011 02:13:40 am django beginner wrote:
> Hi all,
> 
> Could someone please tell me how to create a Message Box using Django?
> 
> Thanks in advance.

This falls under the domain of javascript/css/html,  django itself has no 
dialog boxes of any kind, it only has simple form widgets. Just so you know, 
all this cool stuff in the admin is done via css/javascript/html. With django 
just providing the data and form widgets that fill out the page.

Mike


* TribFurry only gets spam mail from ucsd... I used to get email from
myself but I decided I didn't like myself and stopped talking
to me

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Two way many-to-many relationships

2011-03-29 Thread Mike Ramirez
On Monday, March 28, 2011 02:32:52 pm Dilan wrote:
> Thanks Mike !

you're welcome
> That was a really helpful page that I missed in Doc.  In this
> particular case 1 solves 2.
> 
Nice

> > In python you can't forward declare outside of the module the object is
> > in.

I also want to clarify that python can't forward declare outside of the object 
that is in scope. It can't forward declare in a module... sorry, my bad.

example:

class MyStuff:
 def __init__(self):
self. doStartup()

 def doStartup(self):
pass



That's completely legal and python will see doStartup just fine, but this 
isn't:

doStartup()

def doStartup():
  pass

test output:
[deployuser@priss ~]$ cat test.py 
doStartUp()

def doStartUp(): pass
[deployuser@priss ~]$ python test.py
Traceback (most recent call last):
  File "test.py", line 1, in 
doStartUp()
NameError: name 'doStartUp' is not defined
[deployuser@priss ~]$ vi test.py 
[deployuser@priss ~]$ cat test.py 

def doStartUp(): pass

doStartUp()

[deployuser@priss ~]$ python test.py
[deployuser@priss ~]$ 


Mike

-- 
"Neighbors!!  We got neighbors!  We ain't supposed to have any neighbors, and
I just had to shoot one."
-- Post Bros. Comics

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



django and sphinx - lib needed

2011-03-29 Thread galgal
What library can I use with Django to use Sphinx?
I found https://github.com/dcramer/django-sphinx but it's not supported 
yet:/

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Slow query. Any way to speed things up?

2011-03-29 Thread Fabian Büchler
Hello Javier,

thanks for your answer!
The reason for one Event having multiple EventDates is simple: an event like
a theatre can have multiple shows/screenings.

Is there a way to add an index on event+date other than unique-together? (
http://docs.djangoproject.com/en/dev/ref/models/options/#unique-together)
I cannot use unique-together because that is not the case. EventDates have
more than just those two fields (see the full model below) and one event can
possibly have multiple shows each day.

class EventDate(models.Model):
> event = models.ForeignKey(Event)
>
> date = models.DateField(verbose_name=_(u"start date"), db_index=True)
> enddate = models.DateField(verbose_name=_(u"end date"),
>blank=True, null=True)
> start = models.TimeField(verbose_name=_(u"start time"),
> blank=True, null=True)
> end = models.TimeField(verbose_name=_(u"end time"),
>blank=True, null=True)
>
> class Meta:
> verbose_name = _(u"event date")
> verbose_name_plural = _(u"event dates")
> ordering = ('event', 'date')
>

Regards, Fabian



2011/3/28 Javier Guerra Giraldez 

> On Mon, Mar 28, 2011 at 7:52 AM, Fabian Büchler
>  wrote:
> >
> > Events have an EventOnlineManager with a "to_expire" method which should
> select all Events with status=online and EventDates associated which date <
> today.
> >
> >> class EventOnlineManager(models.Manager):
> >>
> >> def get_query_set(self):
> >> return (super(EventOnlineManager, self).get_query_set()
> >> .filter(status=Event.STATUS_ONLINE))
> >>
> >> @property
> >> def to_expire(self):
> >> today = datetime.date.today()
> >> return
> (self.annotate(eventdate_max=models.Max('eventdate__date'))
> >> .filter(eventdate_max__lt=today))
>
>
>
> I guess you have reasons to allow several EventDates per Event (if
> not, they should be a single table).   my first attempt would be to
> add an (event, date) index to EventDate.  can you add an
> ordering=('event','date') ?
>
> --
> Javier
>

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Slow query. Any way to speed things up?

2011-03-29 Thread Fabian Büchler
Hello Anssi,

also thanks for your answer!

I also believe that the generated query is more than suboptimal. Here it is.
I've not deleted any columns, since there is something strange about the
GROUP BY clause: all columns are listed there twice:

SELECT "events_event"."id",
>"events_event"."uid",
>"events_event"."slug_de",
>"events_event"."slug_en",
>"events_event"."created_by_id",
>"events_event"."created_on",
>"events_event"."modified_by_id",
>"events_event"."modified_on",
>"events_event"."status",
>"events_event"."online_from",
>"events_event"."title_de",
>"events_event"."subtitle_de",
>"events_event"."description_de",
>"events_event"."title_en",
>"events_event"."subtitle_en",
>"events_event"."description_en",
>"events_event"."image_id",
>"events_event"."location_id",
>"events_event"."room_id",
>"events_event"."contact_display",
>"events_event"."price_from",
>"events_event"."price_to",
>"events_event"."vienna_card",
>"events_event"."use_address",
>"events_event"."use_tel_1",
>"events_event"."use_tel_2",
>"events_event"."use_tel_3",
>"events_event"."use_email",
>"events_event"."use_web",
>"events_event"."alt_contact",
>"events_event"."alt_contact_use",
>"events_event"."alt_tel_1",
>"events_event"."alt_tel_1_comment_de",
>"events_event"."alt_tel_1_comment_en",
>"events_event"."alt_tel_1_use",
>"events_event"."alt_tel_2",
>"events_event"."alt_tel_2_comment_de",
>"events_event"."alt_tel_2_comment_en",
>"events_event"."alt_tel_2_use",
>"events_event"."alt_tel_3",
>"events_event"."alt_tel_3_comment_de",
>"events_event"."alt_tel_3_comment_en",
>"events_event"."alt_tel_3_use",
>"events_event"."alt_email_1",
>"events_event"."alt_email_1_use",
>"events_event"."alt_email_2",
>"events_event"."alt_email_2_use",
>"events_event"."alt_email_3",
>"events_event"."alt_email_3_use",
>"events_event"."alt_url_1",
>"events_event"."alt_url_1_use",
>"events_event"."alt_url_2",
>"events_event"."alt_url_2_use",
>"events_event"."alt_url_3",
>"events_event"."alt_url_3_use",
>"events_event"."ranking",
>"events_event"."toptip",
>"events_event"."daily_top",
>"events_event"."term",
>"events_event"."legacy_id", MAX("events_eventdate"."date") AS
> "eventdate_max"
> FROM "events_event"
> LEFT OUTER JOIN "events_eventdate" ON ("events_event"."id" =
> "events_eventdate"."event_id")
> WHERE ("events_event"."status" = 2)
> GROUP BY "events_event"."id",
>  "events_event"."uid",
>  "events_event"."slug_de",
>  "events_event"."slug_en",
>  "events_event"."created_by_id",
>  "events_event"."created_on",
>  "events_event"."modified_by_id",
>  "events_event"."modified_on",
>  "events_event"."status",
>  "events_event"."online_from",
>  "events_event"."title_de",
>  "events_event"."subtitle_de",
>  "events_event"."description_de",
>  "events_event"."title_en",
>  "events_event"."subtitle_en",
>  "events_event"."description_en",
>  "events_event"."image_id",
>  "events_event"."location_id",
>  "events_event"."room_id",
>  "events_event"."contact_display",
>  "events_event"."price_from",
>  "events_event"."price_to",
>  "events_event"."vienna_card",
>  "events_event"."use_address",
>  "events_event"."use_tel_1",
>  "events_event"."use_tel_2",
>  "events_event"."use_tel_3",
>  "events_event"."use_email",
>  "events_event"."use_web",
>  "events_event"."alt_contact",
>  "events_event"."alt_contact_use",
>  "events_event"."alt_tel_1",
>  "events_event"."alt_tel_1_comment_de",
>  "events_event"."alt_tel_1_comment_en",
>  "events_event"."alt_tel_1_use",
>  "events_event"."alt_tel_2",
>  "events_event"."alt_tel_2_comment_de",
>  "events_event"."alt_tel_2_comment_en",
>  "events_event"."alt_tel_2_use",
>  "events_event"."alt_tel_3",
>  "events_event"."alt_tel_3_comment_de",
>  "events_event"."alt_tel_3_comment_en",
>  "events_event"."alt_tel_3_use",
>  "events_event"."alt_email_1",
>  "events_event"."alt_email_1_use",
>  "events_event"."alt_email_2",
>  "events_event"."alt_email_2_use",
>  "events_event"."alt_email_3",
>  "events_event"."alt_email_3_use",
>  "events_event"."alt_url_1",
>  "events_event"."alt_url_1_use",
>  "events_event"."alt_url_2",
>  "events_event"."alt_url_2_use",
> 

Re: Slow query. Any way to speed things up?

2011-03-29 Thread bruno desthuilliers
On 29 mar, 12:26, Fabian Büchler  wrote:

(snip part about the generated query)

> As Javier suggested, an index on the "events_eventdate" over table over
> "event_id" and "date" could help, but I don't know how to create one using
> Django's model techniques

This is something you can do directly at the database level - and you
can add custom SQL statements to be run at syncdb time if necessary:

http://docs.djangoproject.com/en/dev/howto/initial-data/#providing-initial-sql-data

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Admin broken with large data table

2011-03-29 Thread Malcolm Box
Hi,

On one of my models, the admin choice_list page is taking minutes to
load, which makes it somewhat broken.

The table has about 2M rows and about 2.6GB in size, on InnoDB/MySQL.
As far as I can tell, what's breaking things is the paginator code
that is doing a SELECT COUNT(*) which is known to be glacially slow on
InnoDB with certain types of table.

Is there any way to suppress the pagination and/or change it so that
it doesn't do the queryset.count()?

I've tried adding a separate index on the primary key as suggested
here: http://forums.mysql.com/read.php?22,90945,91110#msg-91110 which
improves things - from > 10 minutes to 134s - but not enough.

It seems this should bite anyone using admin with large tables on
InnoDB or Postgres, so perhaps this is a bug?

Cheers,

Malcolm

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



Re: Help on setting TIME_ZONE to 'UTC'

2011-03-29 Thread Malcolm Box
Look in the docs here: 
http://docs.djangoproject.com/en/1.3/ref/settings/#time-zone

As it says, this doesn't work on Window and will result in the system
timezone being used.

On Mar 29, 8:58 am, aa bb  wrote:
> Hi all! I'm a Django newbie. I set TIME_ZONE to 'UTC' in my project
> settings.py. Then I have defined a data model like:
>
> class D(models.Model):
>   #some fields
>   joined_at = models.DateTimeField(null = True, auto_now_add = True)
>   #some other fields
>
> I expect when a new D instance is created, its joined_at field will be
> a value equivalent to datetime.utcnow(), becuase I set TIME_ZONE to
> 'UTC'. But, when I tested it on Windows, I found that it's in fact
> datetime.now()! I looked for a while for the reason but nothing
> valueble. So please give me a hand if you can. Doesn't UTC time zone
> work in Django? Thanks in advance!

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Slow query. Any way to speed things up?

2011-03-29 Thread Fabian Büchler
I've analyzed the query using pgAdmin and it seems the most time is being
spent with a the GroupAggregate.
This is because of so many columns being listed in the GROUP BY clause.
Creating two-column indexes over event_id and date or some other
combinations I've tried did not gain any perforamance.

Thus I've tried to get rid of some by just selecting some columns via
"only(...)". Strangely this does not have any effect on the GROUP BY clause.

On the other hand, if I use "values(...)" the GROUP BY clause shrinks to
only the named columns (but still being listed twice each).

>>> str(Event.objects.values('id','title_de','status')

...   .filter(status=Event.STATUS_ONLINE)
>
...   .annotate(eventdate_max=models.Max('eventdate__date'))
>
...   .filter(eventdate_max__lt=today).query)
>

>
'SELECT "events_event"."id", "events_event"."title_de",
> "events_event"."status", MAX("events_eventdate"."date") AS "eventdate_max"
> FROM "events_event" LEFT OUTER JOIN "events_eventdate" ON
> ("events_event"."id" = "events_eventdate"."event_id") WHERE
> ("events_event"."status" = 2 ) GROUP BY "events_event"."id",
> "events_event"."title_de", "events_event"."status", "events_event"."id",
> "events_event"."title_de", "events_event"."status" HAVING
> MAX("events_eventdate"."date") < 2011-03-29  ORDER BY
> "events_event"."title_de" ASC, "events_event"."status" ASC'
>

This query runs in a few milliseconds. I guess I'll just go with this for
now since I don't know any other method...

The QuerySet.only() method not limiting the GROUP BY clause to the named
columns seems like a "bug" (or inefficiency) in the ORM to me. Is that valid
at any rate?


Regards,
Fabian


2011/3/29 bruno desthuilliers 

> On 29 mar, 12:26, Fabian Büchler  wrote:
>
> (snip part about the generated query)
>
> > As Javier suggested, an index on the "events_eventdate" over table over
> > "event_id" and "date" could help, but I don't know how to create one
> using
> > Django's model techniques
>
> This is something you can do directly at the database level - and you
> can add custom SQL statements to be run at syncdb time if necessary:
>
>
> http://docs.djangoproject.com/en/dev/howto/initial-data/#providing-initial-sql-data
>
> --
> 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
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Slow query. Any way to speed things up?

2011-03-29 Thread Matthias Kestenholz
On Tue, Mar 29, 2011 at 2:27 PM, Fabian Büchler
 wrote:
> I've analyzed the query using pgAdmin and it seems the most time is being
> spent with a the GroupAggregate.
> This is because of so many columns being listed in the GROUP BY clause.
> Creating two-column indexes over event_id and date or some other
> combinations I've tried did not gain any perforamance.
>
> Thus I've tried to get rid of some by just selecting some columns via
> "only(...)". Strangely this does not have any effect on the GROUP BY clause.
>

only() does not affect the generated query in any way -- it would be a
bug if it did.


> On the other hand, if I use "values(...)" the GROUP BY clause shrinks to
> only the named columns (but still being listed twice each).
>

There's already a ticket for the duplicated GROUP BY columns in the
Django ticket tracker:

http://code.djangoproject.com/ticket/15709


> The QuerySet.only() method not limiting the GROUP BY clause to the named
> columns seems like a "bug" (or inefficiency) in the ORM to me. Is that valid
> at any rate?
>

Not sure about that. I'd say it isn't a bug because this could
potentially cause different results depending on the table and table
content.


Matthias



-- 
Django CMS building toolkit: http://www.feinheit.ch/labs/feincms-django-cms/

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



develop to product

2011-03-29 Thread yongzhen zhang
HI,
I want to move development version to product version and i use Apache
with wsgi.
In apache2/sites-available folder, i made one istore instead the
default one. The content is:
NameVirtualHost *:80


ServerAdmin webmaster@localhost

ServerName www.imaboy.cn
ServerAlias shop.imaboy.cn
Alias /static /home/yongzhen/workspace/www/iStore/static

DocumentRoot /home/yongzhen/workspace/www/iStore
WSGIScriptAlias / /home/yongzhen/workspace/www/iStore/apache/
django.wsgi

ErrorLog /var/log/apache2/error.log
LogLevel warn

  CustomLog /var/log/apache2/access.log combined
  
and in the  sites-enabled folder i made the link to istore.
But the problem is when i restart apache2, there is some warning:

 * Restarting web server pache2
[Tue Mar 29 15:38:21 2011] [warn] NameVirtualHost *:80 has no
VirtualHosts
 ... waiting [Tue Mar 29 15:38:22 2011] [warn] NameVirtualHost *:80
has no VirtualHosts

After that the server for PHP does not work: http://www.imaboy.cn/
Does anyone know how to fix it?

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: develop to product

2011-03-29 Thread nadaeivar
Which error you have?
Envoyé par mon BlackBerry® smartphone de Tigo

-Original Message-
From: yongzhen zhang <4...@live.cn>
Sender: django-users@googlegroups.com
Date: Tue, 29 Mar 2011 05:41:40 
To: Django users
Reply-To: django-users@googlegroups.com
Subject: develop to product

HI,
I want to move development version to product version and i use Apache
with wsgi.
In apache2/sites-available folder, i made one istore instead the
default one. The content is:
NameVirtualHost *:80


ServerAdmin webmaster@localhost

ServerName www.imaboy.cn
ServerAlias shop.imaboy.cn
Alias /static /home/yongzhen/workspace/www/iStore/static

DocumentRoot /home/yongzhen/workspace/www/iStore
WSGIScriptAlias / /home/yongzhen/workspace/www/iStore/apache/
django.wsgi

ErrorLog /var/log/apache2/error.log
LogLevel warn

  CustomLog /var/log/apache2/access.log combined
  
and in the  sites-enabled folder i made the link to istore.
But the problem is when i restart apache2, there is some warning:

 * Restarting web server pache2
[Tue Mar 29 15:38:21 2011] [warn] NameVirtualHost *:80 has no
VirtualHosts
 ... waiting [Tue Mar 29 15:38:22 2011] [warn] NameVirtualHost *:80
has no VirtualHosts

After that the server for PHP does not work: http://www.imaboy.cn/
Does anyone know how to fix it?

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: django and sphinx - lib needed

2011-03-29 Thread Cal Leeming [Simplicity Media Ltd]
Hey,

I actually ended up writing my own wrapper for Django and Sphinx, because
the one written by dcramer was retarded.

I haven't yet done a public release for this, nor any documentation.

However, I'll post you the library, and some example usage, but don't expect
this to be an "easy" one-click install lol.

Give me 5 mins.

Cal

On Tue, Mar 29, 2011 at 11:11 AM, galgal  wrote:

> What library can I use with Django to use Sphinx?
> I found https://github.com/dcramer/django-sphinx but it's not supported
> yet:/
>
> --
> 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
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: django and sphinx - lib needed

2011-03-29 Thread Cal Leeming [Simplicity Media Ltd]
Okay, here you go. Remember, these are literally just cut and pasted out of
one of our webapps, so you'll need to most likely read the source code of
each file, to truly understand what is going on. But, one thing I can
guarantee, is that this code works, lol. Eventually, we'll be releasing a
proper sphinx patch for Django, and aiming to have it introduced into the
core. I just haven't got time atm though.

django_sphinx_proper.py
http://pastebin.com/RJN25Z2z

settings.py
http://pastebin.com/jfn83hXP

models.py
http://pastebin.com/T6qBFhG3

example.py
http://pastebin.com/Bvaw7ER5


On Tue, Mar 29, 2011 at 1:48 PM, Cal Leeming [Simplicity Media Ltd] <
cal.leem...@simplicitymedialtd.co.uk> wrote:

> Hey,
>
> I actually ended up writing my own wrapper for Django and Sphinx, because
> the one written by dcramer was retarded.
>
> I haven't yet done a public release for this, nor any documentation.
>
> However, I'll post you the library, and some example usage, but don't
> expect this to be an "easy" one-click install lol.
>
> Give me 5 mins.
>
> Cal
>
> On Tue, Mar 29, 2011 at 11:11 AM, galgal wrote:
>
>> What library can I use with Django to use Sphinx?
>> I found https://github.com/dcramer/django-sphinx but it's not supported
>> yet:/
>>
>> --
>> 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
>> django-users+unsubscr...@googlegroups.com.
>> For more options, visit this group at
>> http://groups.google.com/group/django-users?hl=en.
>>
>
>

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: django and sphinx - lib needed

2011-03-29 Thread Cal Leeming [Simplicity Media Ltd]
Oh, you also need this:

sphinxapi.py
http://pastebin.com/FrjBDiME

On Tue, Mar 29, 2011 at 1:57 PM, Cal Leeming [Simplicity Media Ltd] <
cal.leem...@simplicitymedialtd.co.uk> wrote:

> Okay, here you go. Remember, these are literally just cut and pasted out of
> one of our webapps, so you'll need to most likely read the source code of
> each file, to truly understand what is going on. But, one thing I can
> guarantee, is that this code works, lol. Eventually, we'll be releasing a
> proper sphinx patch for Django, and aiming to have it introduced into the
> core. I just haven't got time atm though.
>
> django_sphinx_proper.py
> http://pastebin.com/RJN25Z2z
>
> settings.py
> http://pastebin.com/jfn83hXP
>
> models.py
> http://pastebin.com/T6qBFhG3
>
> example.py
> http://pastebin.com/Bvaw7ER5
>
>
> On Tue, Mar 29, 2011 at 1:48 PM, Cal Leeming [Simplicity Media Ltd] <
> cal.leem...@simplicitymedialtd.co.uk> wrote:
>
>> Hey,
>>
>> I actually ended up writing my own wrapper for Django and Sphinx, because
>> the one written by dcramer was retarded.
>>
>> I haven't yet done a public release for this, nor any documentation.
>>
>> However, I'll post you the library, and some example usage, but don't
>> expect this to be an "easy" one-click install lol.
>>
>> Give me 5 mins.
>>
>>  Cal
>>
>> On Tue, Mar 29, 2011 at 11:11 AM, galgal wrote:
>>
>>> What library can I use with Django to use Sphinx?
>>> I found https://github.com/dcramer/django-sphinx but it's not supported
>>> yet:/
>>>
>>> --
>>> 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
>>> django-users+unsubscr...@googlegroups.com.
>>> For more options, visit this group at
>>> http://groups.google.com/group/django-users?hl=en.
>>>
>>
>>
>

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: django and sphinx - lib needed

2011-03-29 Thread Cal Leeming [Simplicity Media Ltd]
One thing I should point out, this lib is focused on performance, rather
than code tidyness. As it is a prototype, the code structure and layout is
*extremely* messy. But, I'm able to pull back 50 thousand results, convert
the results to Django models, and have the result cached, in under 0.2
seconds, and this also includes the django framework loading time itself :P

It will be made faster once we release a proper patch :)

Cal

On Tue, Mar 29, 2011 at 1:58 PM, Cal Leeming [Simplicity Media Ltd] <
cal.leem...@simplicitymedialtd.co.uk> wrote:

> Oh, you also need this:
>
> sphinxapi.py
> http://pastebin.com/FrjBDiME
>
>
> On Tue, Mar 29, 2011 at 1:57 PM, Cal Leeming [Simplicity Media Ltd] <
> cal.leem...@simplicitymedialtd.co.uk> wrote:
>
>> Okay, here you go. Remember, these are literally just cut and pasted out
>> of one of our webapps, so you'll need to most likely read the source code of
>> each file, to truly understand what is going on. But, one thing I can
>> guarantee, is that this code works, lol. Eventually, we'll be releasing a
>> proper sphinx patch for Django, and aiming to have it introduced into the
>> core. I just haven't got time atm though.
>>
>> django_sphinx_proper.py
>> http://pastebin.com/RJN25Z2z
>>
>> settings.py
>> http://pastebin.com/jfn83hXP
>>
>> models.py
>> http://pastebin.com/T6qBFhG3
>>
>> example.py
>> http://pastebin.com/Bvaw7ER5
>>
>>
>> On Tue, Mar 29, 2011 at 1:48 PM, Cal Leeming [Simplicity Media Ltd] <
>> cal.leem...@simplicitymedialtd.co.uk> wrote:
>>
>>> Hey,
>>>
>>> I actually ended up writing my own wrapper for Django and Sphinx, because
>>> the one written by dcramer was retarded.
>>>
>>> I haven't yet done a public release for this, nor any documentation.
>>>
>>> However, I'll post you the library, and some example usage, but don't
>>> expect this to be an "easy" one-click install lol.
>>>
>>> Give me 5 mins.
>>>
>>>  Cal
>>>
>>> On Tue, Mar 29, 2011 at 11:11 AM, galgal wrote:
>>>
 What library can I use with Django to use Sphinx?
 I found https://github.com/dcramer/django-sphinx but it's not supported
 yet:/

 --
 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
 django-users+unsubscr...@googlegroups.com.
 For more options, visit this group at
 http://groups.google.com/group/django-users?hl=en.

>>>
>>>
>>
>

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: OT: Django broke my Dropbox

2011-03-29 Thread Andre Terra
"Whoa, this is *so* much better than grep it's not even funny." -- Jacob
Kaplan-Moss , creator of
Django.


+5!!

Thanks for the link


Cheers,
André Terra (airstrike)

On Mon, Mar 28, 2011 at 6:42 PM, Shawn Milochik  wrote:

> On Mon, Mar 28, 2011 at 5:35 PM, Petite Abeille
>  wrote:
> >
> > On Mar 28, 2011, at 11:33 PM, Xavier Ordoquy wrote:
> >
> >> I'm just tired of grepping code when subversion is the VC used ;)
> >
> > ack!
> >
> > http://betterthangrep.com/
>
>
> Awesome! I'd never seen that before, and it looks great. It makes me
> glad my Dropbox broke.
>
> Also, when I first read your post I thought "ack!" mean
> "acknowledged," with a big exclamation point because you've suffered
> the same way. Ha!
>
> Thanks,
> Shawn
>
> --
> 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
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: develop to product

2011-03-29 Thread yongzhen zhang
[Tue Mar 29 16:40:59 2011] [warn] NameVirtualHost *:80 has no
VirtualHosts
[Tue Mar 29 16:40:59 2011] [warn] NameVirtualHost *:80 has no
VirtualHosts
(13)Permission denied: make_sock: could not bind to address 0.0.0.0:80
no listening sockets available, shutting down
Unable to open logs


On 3月29日, 下午8时43分, nadaei...@gmail.com wrote:
> Which error you have?
> Envoyé par mon BlackBerry(R) smartphone de Tigo
>
>

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Admin broken with large data table

2011-03-29 Thread Jacob Kaplan-Moss
On Tue, Mar 29, 2011 at 5:56 AM, Malcolm Box  wrote:
> On one of my models, the admin choice_list page is taking minutes to
> load, which makes it somewhat broken.
>
> The table has about 2M rows and about 2.6GB in size, on InnoDB/MySQL.
> As far as I can tell, what's breaking things is the paginator code
> that is doing a SELECT COUNT(*) which is known to be glacially slow on
> InnoDB with certain types of table.

Yup, this is a known problem: pagination in the admin isn't efficient
and breaks down past a certain point.

> Is there any way to suppress the pagination and/or change it so that
> it doesn't do the queryset.count()?

In 1.3 you should be able to override ModelAdmin.get_paginator
(http://docs.djangoproject.com/en/1.3/ref/contrib/admin/#django.contrib.admin.ModelAdmin.get_paginator).
You'll have to subclass django.core.paginator.Paginator and provide an
interface that doesn't perform COUNTs.

[Yes, this is sorta tricky, and ideally it'd be something Django does
for you so if you'll share your code when you figure it out I'll try
to work it into the next release.]

Jacob

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



Re: how to create message box in Django?

2011-03-29 Thread CrabbyPete
A message box is not a django thing. Its html. Look into creating a
modal window in html. I do it a lot using javascript and ajax, but
there are a lot simpler ways.


On Mar 29, 5:10 am, djangodjango django  wrote:
> Hi all,
>
> Could someone please tell me how to create a Message Box using Django?
>
> Thanks in advance.

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: develop to product

2011-03-29 Thread yongzhen zhang
[Tue Mar 29 17:06:07 2011] [error] [client 62.237.153.123] mod_wsgi
(pid=795): Target WSGI script '/home/yongzhen/workspace/www/iStore/
apache/django.wsgi' cannot be loaded as Python module.
[Tue Mar 29 17:06:07 2011] [error] [client 62.237.153.123] mod_wsgi
(pid=795): Exception occurred processing WSGI script '/home/yongzhen/
workspace/www/iStore/apache/django.wsgi'.
[Tue Mar 29 17:06:07 2011] [error] [client 62.237.153.123] Traceback
(most recent call last):
[Tue Mar 29 17:06:07 2011] [error] [client 62.237.153.123] File "/home/
yongzhen/workspace/www/iStore/apache/django.wsgi", line 5, in 
[Tue Mar 29 17:06:07 2011] [error] [client 62.237.153.123]
wsgi_dir=os.path.abspath(os.path.dirname(_file_))
[Tue Mar 29 17:06:07 2011] [error] [client 62.237.153.123] NameError:
name '_file_' is not defined

On 3月29日, 下午8时43分, nadaei...@gmail.com wrote:
> Which error you have?
> Envoyé par mon BlackBerry® smartphone de Tigo
>
>
>
> -Original Message-
> From: yongzhen zhang <4...@live.cn>
>
> Sender: django-users@googlegroups.com
> Date: Tue, 29 Mar 2011 05:41:40
> To: Django users
> Reply-To: django-users@googlegroups.com
> Subject: develop to product
>
> HI,
> I want to move development version to product version and i use Apache
> with wsgi.
> In apache2/sites-available folder, i made one istore instead the
> default one. The content is:
> NameVirtualHost *:80
>
> 
>         ServerAdmin webmaster@localhost
>
>         ServerNamewww.imaboy.cn
>         ServerAlias shop.imaboy.cn
>         Alias /static /home/yongzhen/workspace/www/iStore/static
>
>         DocumentRoot /home/yongzhen/workspace/www/iStore
>         WSGIScriptAlias / /home/yongzhen/workspace/www/iStore/apache/
> django.wsgi
>
>         ErrorLog /var/log/apache2/error.log
>         LogLevel warn
>
>   CustomLog /var/log/apache2/access.log combined
>   
> and in the  sites-enabled folder i made the link to istore.
> But the problem is when i restart apache2, there is some warning:
>
>  * Restarting web server pache2
> [Tue Mar 29 15:38:21 2011] [warn] NameVirtualHost *:80 has no
> VirtualHosts
>  ... waiting [Tue Mar 29 15:38:22 2011] [warn] NameVirtualHost *:80
> has no VirtualHosts
>
> After that the server for PHP does not work:http://www.imaboy.cn/
> Does anyone know how to fix it?
>
> --
> 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 
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group 
> athttp://groups.google.com/group/django-users?hl=en.

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: develop to product

2011-03-29 Thread Mike Ramirez
On Tuesday, March 29, 2011 07:48:16 am yongzhen zhang wrote:

> [Tue Mar 29 17:06:07 2011] [error] [client 62.237.153.123] File "/home/
> yongzhen/workspace/www/iStore/apache/django.wsgi", line 5, in 
> [Tue Mar 29 17:06:07 2011] [error] [client 62.237.153.123]
> wsgi_dir=os.path.abspath(os.path.dirname(_file_))
> [Tue Mar 29 17:06:07 2011] [error] [client 62.237.153.123] NameError:
> name '_file_' is not defined
> 


should be __file__ (two underscores on both sides)

Mike
-- 
Help stamp out and abolish redundancy and repetition.

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: ManyToMany Intermediate Table on a Separate Database?

2011-03-29 Thread Tomasz Zieliński
(Sorry Daniel, I replied to your private email by accident - the new Google 
Groups UI misled me.)

Actually in MySQL you can easily work around that limitation 
- you can use database VIEWs as mirrors of tables placed in other databases.

-- 
Tomasz Zielinski
pyconsultant.eu

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: how to create message box in Django?

2011-03-29 Thread Shawn Milochik
Yeah, this isn't a Django question. But this is what we use:

http://jqueryui.com/demos/dialog/

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



list in template

2011-03-29 Thread satvik chauhan
I am using contrib.comments app and have a custom field xuser in the comment
model.
I want to create a list  of xusers(with no duplicates )

{% for comment in comment_list %}


[Some tag to add comment.xuser in the list if not already in it ]

{% endfor %}

Then I want to iterate over that list as :

{% for user in list %}

[do something]

{% endfor %}

 Any help , how to create that list ?

-satvik

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: list in template

2011-03-29 Thread bruno desthuilliers
On 29 mar, 17:17, satvik chauhan  wrote:
> I am using contrib.comments app and have a custom field xuser in the comment
> model.
> I want to create a list  of xusers(with no duplicates )
>
> {% for comment in comment_list %}
>
> [Some tag to add comment.xuser in the list if not already in it ]
>
> {% endfor %}

Is this something you want for a given view only, or is this repeated
in most of your templates (like, some portlet in a sidebar or
something...) ?

In the first case, this belongs to the view's code. In the second one,
the obvious solution is to write a custom template tag.


HTH

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Admin broken with large data table

2011-03-29 Thread Malcolm Box
On Mar 29, 2:48 pm, Jacob Kaplan-Moss  wrote:
> On Tue, Mar 29, 2011 at 5:56 AM, Malcolm Box  wrote:
> > On one of my models, the admin choice_list page is taking minutes to
> > load, which makes it somewhat broken.
>
> > The table has about 2M rows and about 2.6GB in size, on InnoDB/MySQL.
> > As far as I can tell, what's breaking things is the paginator code
> > that is doing a SELECT COUNT(*) which is known to be glacially slow on
> > InnoDB with certain types of table.
>
> Yup, this is a known problem: pagination in the admin isn't efficient
> and breaks down past a certain point.
>

OK, thanks. Is there a ticket tracking the problem, I couldn't spot
one?

> > Is there any way to suppress the pagination and/or change it so that
> > it doesn't do the queryset.count()?
>
> In 1.3 you should be able to override ModelAdmin.get_paginator
> (http://docs.djangoproject.com/en/1.3/ref/contrib/admin/#django.contri...).
> You'll have to subclass django.core.paginator.Paginator and provide an
> interface that doesn't perform COUNTs.
>
> [Yes, this is sorta tricky, and ideally it'd be something Django does
> for you so if you'll share your code when you figure it out I'll try
> to work it into the next release.]

I'll have a look and see what I can come up with. I'll be happy to
share once it's done.

Malcolm

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



Re: Looking for IDE + FTP

2011-03-29 Thread emonk
http://wiki.python.org/moin/IntegratedDevelopmentEnvironments

2011/3/28 Karen McNeil 

> Just wanted to give you all an update:  I started using Aptana Studio
> with the PyDev plug-in and I'm really liking it; I think it was just
> what I needed.
>
> Thanks for all the suggestions!
>
> ~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
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Looking for IDE + FTP

2011-03-29 Thread Cal Leeming [Simplicity Media Ltd]
Hmm, Aptana Studio looks pretty hot.. Might try it out! ty!

On Tue, Mar 29, 2011 at 4:32 PM, emonk  wrote:

> http://wiki.python.org/moin/IntegratedDevelopmentEnvironments
>
>
> 2011/3/28 Karen McNeil 
>
>> Just wanted to give you all an update:  I started using Aptana Studio
>> with the PyDev plug-in and I'm really liking it; I think it was just
>> what I needed.
>>
>> Thanks for all the suggestions!
>>
>> ~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
>> django-users+unsubscr...@googlegroups.com.
>> For more options, visit this group at
>> http://groups.google.com/group/django-users?hl=en.
>>
>>
>  --
> 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
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Looking for IDE + FTP

2011-03-29 Thread Mike Ramirez
On Tuesday, March 29, 2011 08:34:51 am Cal Leeming [Simplicity Media Ltd] 
wrote:
> Hmm, Aptana Studio looks pretty hot.. Might try it out! ty!
> 

Beware of titanium, it requires a net connection and you to be connected to 
their systems to use it's functionality.  Had to logon to the local app to use 
it and logoff would shutdown the app. This turned me off of it. But I have 
been using aptana for a while now to get me started with new templates. It's 
great for that and yeah, it's sweet.

I bring this up because appcelerator develops titanium and recently (as in a 
couple months ago) purchased aptana to be it's IDE. 


Mike
-- 
All the simple programs have been written.

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Just started Django - please help clarify web site configuration strategy

2011-03-29 Thread javatina
On Mar 29, 5:06 am, bruno desthuilliers
 wrote:

> > 2. custom template tags - I do not see how they can help here
>
> You were talking about menus built from the db. Using a custom tag to
> build these menus gives you the flexibility to only call on the
> relevant code when needed - instead of calling it on each and every
> use of a RequestContext (remember that RequestContexts can be used by
> any template rendering code - that is mails, templatetags etc).
>
> Once you've written your custom Menu templatetag, caching the result
> is a piece of cake.

But that's conceptually the same - caching. But if you remember I was
looking for alternative approaches.



-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Just started Django - please help clarify web site configuration strategy

2011-03-29 Thread javatina
That's the discussion I was looking for. Many thanks to you and Bruno
Desthuilliers - helps get bigger picture.

On Mar 28, 6:37 pm, Jumpfroggy  wrote:
> > Basically, the question is - when a web
> > application starts there is a number of things that needs to be
> > available any time any request. Some of them are really static in
> > nature - for example, pagination parameters;
>
> If these are static values, a good place to put them is in the
> settings.py file.  I put things like APP_NUMBER_POSTS_PER_PAGE = 10 in
> settings.py.  As a bonus, they can be overridden with your
> local_settings.py file (if you use one).  Alternately, you could have
> an "app_settings.py" file where you store a bunch of static values,
> and just import that file into anywhere it's needed (like your
> views.py).
>
> > some of them are more
> > dynamic - for example, menu options.
>
> If these menu options are application wide, but change often, then I'd
> create models to represent them, and store them in the database.  If
> these are server wide config settings that only change once in a
> while, then I'd add them to settings.py (since you probably want those
> hardcoded and recorded in your source-control system.  If those
> settings are per-user, then they'd either be cookies (browser-based),
> session vars (session-based), or a settings stored in the user's
> profile (ie. stored in DB as a model, the most permanent of the 3).
>
> > Things get more interesting when such data are read from the database.
> > So far what I see is that all that stuff should be places in the
> > request context (hopefully cached). It can be done more elegantly if
> > custom context processor(s) are created. But we are still rely on
> > request contexts. Unless I am missing something?
>
> In django, contexts are tied to requests.  There really isn't an
> "application context".  If you have a scenario that doesn't fit into
> a) settings.py vars, or b) database-backed settings, give us more
> details and we can figure out how best to store them.  Context
> processors are convenient ways to automatically run code for each
> request, but I normally just use those to automatically add certain
> settings.py vars to each context (like MEDIA_URL, current user, etc).
>
> > It seems that although request contexts combined with caching can
> > help, it is way too complex for the purposes of initializing the
> > application.
>
> What's the caching for?
>
> > Which leads me to another question - is there any callback mechanism
> > when Django application starts? I guess what I am looking is a place
> > to make one-time queries, store data in a static member - and viola, I
> > have my application context.
>
> There is no callback mechanism.  You can add code to any file
> (models.py is a good place), and you can do some tricky python-fu to
> make sure it only runs once per process, but that's a bit of a hack.
> The real question is - do you really need this?  Is there a better
> way?
>
> The most helpful thing would be an example - what is a real-world
> value you'd like to store in an "application context", and how would
> you use it?  Then we can give you some pointers on how to do things
> the django way.
>
> As an aside, I know asp (and other web servers) run as if you have a
> single process, with a single set of static vars, and you can pretend
> that everything is running as a single application.  In django, it's
> often better to think about things as "stateless"... ie. there's no
> guarantee that there is a single, persistent app running.  There's
> just your code that runs when needed.  For example, if you run apache
> + django with multiple processes, then they are separate.  Changes to
> static vars in one process will not affect the same var in other
> processes.  So forget all about static classes/objects/variables, as
> they're probably inappropriate for most use cases.
>
> Also, you might be over-optimizing.  If you're worried about the
> performance hit of loading a set of values for each request (such as
> the settings.py values above), you should profile / measure it.  The
> performance hit of loading such vars would be almost completely
> unmeasurable in most cases.  So you could just load up such settings
> for each request instead of keeping them in static memory, which
> really is an optimization (ie. trading memory space vs. CPU & disk
> access).

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Message framework problem

2011-03-29 Thread wluka
I add this to my view.

 if form.is_valid():
new_user =
form.save(profile_callback=profile_callback)
messages.add_message(request, messages.SUCCESS,
'Complete bla bla')
return HttpResponseRedirect(reverse('main'))

And

{% if messages %}

{{message}}

{% endif %}

How make to this message appear after clickinh the button "register"
and then EXPIRE with reload. In my case it is still on my main page
and after deleting cookies dissappear. Any1 know how to do that?

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



problem with creating foreign keys

2011-03-29 Thread rohan
Hello,

I am new to Django and am trying to design a chemistry database in
Django and am stuck with creating the relations between the tables.

Below are my models. When I try to validate I get an error stating
that the reverse query name for field 'species2ID' clashes with m2m
fileID 'Compunds.reactions'. Add a related_name argument to the
definition for 'species2ID'. The same is repeated for species1ID.

I basically want to create two foreign keys in the reactions table
which correspond to my compounds table have a manytomany relationship
between compounds and reactions table at the same time. Can anyone
please guide me with respect to this. I can provide the schema if
needed.

Thank you.


from django.db import models

class Elements(models.Model):
name = models.CharField(max_length = 20)
atomicNumber = models.IntegerField(blank=True,null=True)
atomicSymbol = models.CharField(max_length =5)
freezingPointKelvin = models.FloatField(blank=True,null=True)
boilingPointKelvin = models.FloatField(blank=True,null=True)
mass = models.FloatField(blank=True,null=True)
density = models.FloatField(blank=True,null=True)
radiusAtomic = models.FloatField(blank=True,null=True)
radiusIonic = models.FloatField(blank=True,null=True)
compounds = models.ManyToManyField('Compounds')

class Compounds(models.Model):
name= models.CharField(max_length = 30)
mass = models.FloatField(blank=True,null=True)
radius = models.FloatField(blank=True,null=True)
reactions = models.ManyToManyField('Reactions')
simulations = models.ManyToManyField('Simulations')


class Reactions(models.Model):
species1ID = models.ForeignKey(Compounds)
species2ID = models.ForeignKey(Compounds)
reactionid= models.CharField(max_length = 20)

class Productsets(models.Model):
energyReleased = models.FloatField(blank=True,null=True)
reactions = models.ManyToManyField('Reactions')
compounds= models.ForeignKey(Compounds)

class Simulations(models.Model):
number = models.IntegerField(blank=True,null=True)
name = models.TextField()
species = models.ManyToManyField('Compounds')

class Lessons(models.Model):
number = models.IntegerField(blank=True,null=True)
name = models.TextField()
simulations = models.ForeignKey(Simulations)

class Units(models.Model):
number = models.IntegerField(blank=True,null=True)
name = models.CharField(max_length = 40)
lessons=models.ForeignKey(Lessons)

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



unicode question

2011-03-29 Thread Mike Thon
Hi - I'm not sure if this is a Django problem, but I'm working on a Django 
project so I thought I'd start here.

In my project users will submit text by way of a text field which will 
eventually be encoded with urllib.quote() and used in a url.  When I submit 
text, certain characters appear on my console in the debugger as \u encoded 
symbols (they are unicode strings).  In the admin interface, strings 
containing an apostrophe have a space inserted before the apostrophe, for 
example: "Europe ’s sovereign-debt crisis" 

In the console, that string appears as "Europe \u2019s sovereign-debt 
crisis". When I try to pass this string through urllib.quote() I get a 
KeyError:

qk = quote(query_text)
  File 
"/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/urllib.py",
 
line 1216, in quote
res = map(safe_map.__getitem__, s)
KeyError: u'\u2019'

Is seems like the text, which originates from the users' web browser is 
being corrupted when it is encoded as unicode.  Any ideas on how to proceed 
would be greatly appreciated.
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: unicode question

2011-03-29 Thread George Lund
I can't explain the additional space, but URL-encoding a Unicode string 
isn't generally possible, it needs to be encoded first.  UTF-8 is almost 
always the correct encoding to use, so in your case:
 qk = quote(query_text.encode('utf8'))

Anything you can do to avoid having to include text like that in a URL (e.g. 
maybe it could be saved to a model instance, and recovered via an id or a 
slug?) would often be a better option.

Hope that helps
George

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: embedding tag in another tag

2011-03-29 Thread mike171562
Perhaps you should try like this:

url_1 = '{%page_url%}{% page_attribute "slug"%}/{{id}}/vote/'



On Mar 23, 8:41 pm, Tony  wrote:
> there is a form called F, and I am trying to set its "action"
> attribute dynamically with javascript.  I can do this successfully.
> However, when I try to use one tag in another like this: url_1 = {%
> page_url '{% page_attribute "slug"%}/{{id}}/vote/' %} (these are
> django-cms tags), I get a parsing error.  Ive also tried to put '{%
> page_attribute "slug"%}/{{id}}/vote/' into a variable (url_2) and do
> {% page_url url_2 %}, but the tag didn't recognize the variable as a
> variable but took url_2 as a null.  Is there anything I can do to get
> this to parse correctly?  Do I have to go into the django-cms template
> tags folder and change the code?  That seems like it could get messy.
>
> On Mar 23, 1:18 pm, delegb...@dudupay.com wrote:
>
> > What exactly are you trying to get done or achieve?
>
> > If that is known, we could be able to help.
> > Sent from my BlackBerry wireless device from MTN
>
> > -Original Message-
> > From: Tony 
>
> > Sender: django-users@googlegroups.com
> > Date: Wed, 23 Mar 2011 13:06:13
> > To: Django users
> > Reply-To: django-users@googlegroups.com
> > Subject: embedding tag in another tag
>
> > I have two tags, and I am trying to put together a dynamic form action
> > url.  For the url to come together lke I want, one would be embedded
> > in the other, but when i try to do it this way, I get a parsing
> > error.  I've also tried using javascript and variables but the tags
> > dont read the variable like it should, it just reads the actual
> > variable name.  Are there any possible work arounds?
>
> > --
> > 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 
> > django-users+unsubscr...@googlegroups.com.
> > For more options, visit this group 
> > athttp://groups.google.com/group/django-users?hl=en.
>
>

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Social Auth

2011-03-29 Thread bish029
how to get id or key required for social oath from facebook and use it
to test my development while i am still developing the site but not
yet launched it

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: creating text area for subpage inside models.py

2011-03-29 Thread Cal Leeming [Simplicity Media Ltd]
Hi Jake,

Please ensure you always paste example source code, where possible and
within reason.

It is extremely difficult for people to help if they don't have this.

If you respond back with this, I'm sure one of us will be able to give you a
hand.

Cheers

Cal

On Tue, Mar 29, 2011 at 5:49 PM, jake k.  wrote:

> Hi, All
>
> I was wondering if you can help me with this one.
>
> I've modified part of my models.py file so I can have a new text area
> inside
> my django admin page. I need to add this text area so I can add
> content to a new subpage
>
> I have added the new text area, but after saving and refreshing the
> page, the admin site
> would look unchanged, without the new text area I added inside
> models.py file
>
> What's wrong?
>
> How can I update my models.py file?
>
> Thanks for your time and assistance, your reply would be greatly
> appreciated
>
> Regards,
>
> --
> 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
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



creating text area for subpage inside models.py

2011-03-29 Thread jake k.
Hi, All

I was wondering if you can help me with this one.

I've modified part of my models.py file so I can have a new text area
inside
my django admin page. I need to add this text area so I can add
content to a new subpage

I have added the new text area, but after saving and refreshing the
page, the admin site
would look unchanged, without the new text area I added inside
models.py file

What's wrong?

How can I update my models.py file?

Thanks for your time and assistance, your reply would be greatly
appreciated

Regards,

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Slow query. Any way to speed things up?

2011-03-29 Thread Fabian Büchler
Hello Matthias,

2011/3/29 Matthias Kestenholz 

> On Tue, Mar 29, 2011 at 2:27 PM, Fabian Büchler
>  wrote:
> > I've analyzed the query using pgAdmin and it seems the most time is being
> > spent with a the GroupAggregate.
> > This is because of so many columns being listed in the GROUP BY clause.
> > Creating two-column indexes over event_id and date or some other
> > combinations I've tried did not gain any perforamance.
> >
> > Thus I've tried to get rid of some by just selecting some columns via
> > "only(...)". Strangely this does not have any effect on the GROUP BY
> clause.
> >
>
> only() does not affect the generated query in any way -- it would be a
> bug if it did.
>

only() does affect the selected columns, but of course that can never affect
the rows that will be selected.


> > On the other hand, if I use "values(...)" the GROUP BY clause shrinks to
> > only the named columns (but still being listed twice each).
> >
>
> There's already a ticket for the duplicated GROUP BY columns in the
> Django ticket tracker:
>
> http://code.djangoproject.com/ticket/15709
>

Thanks for this insight. The bug is already fixed but not yet checked in.
Good to know.


> > The QuerySet.only() method not limiting the GROUP BY clause to the named
> > columns seems like a "bug" (or inefficiency) in the ORM to me. Is that
> valid
> > at any rate?
> >
>
> Not sure about that. I'd say it isn't a bug because this could
> potentially cause different results depending on the table and table
> content.
>

Interesting thought. I guess that might be true, although I'm not quite
enough SQL-sawy to be able to evaluate if that is correct.

In my case the massive GROUP BY clause caused a pretty severe impact on
query speed.
But by now I've fixed the problem by just using the QuerySet.values() method
instead of .only(). That works just fine and fast.


> Matthias
>

Regards,
Fabian


> --
> Django CMS building toolkit:
> http://www.feinheit.ch/labs/feincms-django-cms/
>

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



How to store the database in the project root

2011-03-29 Thread rohan
Hi,

I am creating an app and want to store the database and the images
within the project. The main motive behind this is I want to create a
database with django's admin interface and want to use it on other
computers later. In order to do this I will need to use relative
paths. I tried using os.path.dirname but doesnt seem to work for me.
below is the initial part of my settings file. I am using sqlite3. Can
someone please guide me in the right path.

Thank you



import os.path
import sys
import re

PROJECT_ROOT = os.path.dirname(os.path.realpath(__file__))

DEBUG = True
TEMPLATE_DEBUG = DEBUG

ADMINS = (
# ('Your Name', 'your_em...@domain.com'),
)

MANAGERS = ADMINS

DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3', # Add
'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'.
'NAME':
os.path.dirname(os.path.realpath(__file__)),  # Or
path to database file if using sqlite3.
'USER': '',  # Not used with sqlite3.
'PASSWORD': '',  # Not used with sqlite3.
'HOST': '',  # Set to empty string for
localhost. Not used with sqlite3.
'PORT': '',  # Set to empty string for
default. Not used with sqlite3.
}
}


TIME_ZONE = 'America/Chicago'

LANGUAGE_CODE = 'en-us'

SITE_ID = 1

USE_I18N = True

USE_L10N = True

MEDIA_ROOT = os.path.join(PROJECT_ROOT, 'static')

MEDIA_URL = '/static/'

ADMIN_MEDIA_PREFIX = '/media/'

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Payment Gateways

2011-03-29 Thread Micah Carrick
I have used Authorize.Net for years and don't have a single complaint.
For Python/Django interfacing to Authorize.Net, Quantam, or PsiGate I
use quix.pay, which I also wrote: http://pypi.python.org/pypi/quix.pay/

In testing quix.pay, I found that the Quantam gateway in authorize.net
emulation mode isn't bad. You can choose Quantam as the "free" gateway
with CDGCommerce if you have a lower sales and want to save on the
monthly gateway fee that Authroize.Net charges. Quantam was just a
little slower to respond than Authorize.Net but still quite
reasonable. I've been working on adding Paypal Web Payments Pro and
PayFlow into quix.pay and they certainly do the trick but I still
prefer Authorize.Net.

On Mar 12, 10:32 am, Malcolm  wrote:
> I recently used FeeFighters and they have a really awesome setup to
> help you compare and find merchant processors and gateways.  It's
> pretty neat because the merchant processors "bid" based on your
> preferences and all of their pricing is transparent and easy to
> understand.
>
> As for gateway, I am going with Authorize.net for my project.  PyPI
> has an authorize package for API integration and my developer found a
> django app at:https://github.com/zen4ever/django-authorizenet
>
> If interested in FeeFighters, please consider using my referral 
> link.https://feefighters.com/referral/d61fce3c6c274b38    :-)
>
> Malcolm
>
> On Mar 8, 6:43 pm, David Zhou  wrote:
>
>
>
>
>
>
>
> > I use Braintree, and it's been great.
>
> > -- dz
>
> > On Tue, Mar 8, 2011 at 4:40 PM, CLIFFORD ILKAY
>
> >  wrote:
> > > On 03/08/2011 09:59 AM, Bill Freeman wrote:
>
> > >> And I can't resist recommending solutions that don't require your to 
> > >> touch
> > >> the credit card number.  If you never had it, you can't be responsible 
> > >> for
> > >> compromising it.
>
> > > That is true. Most of thepaymentprocessors have some sort of hosted form
> > > solution for that. However, there are significant limitations in those
> > > hosted form solutions that may make them unsuitable in some situations. 
> > > For
> > > instance, we ran into one such limitation recently on a project where the
> > > processor apparently doesn't provide any sort of "success" or "failure"
> > > notification for zero dollar transactions. Why would you want a zero 
> > > dollar
> > > transaction you might be wondering? Our client was running a promotion 
> > > where
> > > some initial period was free after which the normal recurring fees would
> > > kick in. Normally, there is an initial fee and recurring fees. Upon 
> > > success
> > > or failure on the normal initial fee, we'd get a callback to a view 
> > > function
> > > from thepaymentgateway which we'd need to complete the transaction.
> > > Completion of the transaction consists of listing the product and updating
> > > the user's dashboard with the transaction date and the expiry date for the
> > > listing. With the zero dollar transaction, we never got a callback due so 
> > > we
> > > could do none of those things. We had to manually list the products and
> > > update the user's dashboard for the successful transactions in that
> > > scenario.
>
> > > To avoid creating a situation in the future where there would have to be
> > > tedious and error-prone manual processing, we recommended to the client 
> > > that
> > > they don't offer "free initial period" promotions but instead charge some
> > > nominal amount, even if it's one cent. "All listings one cent" doesn't 
> > > have
> > > quite the same impact as "Free listings" even though for all intents and
> > > purposes, it's the same thing. We've discovered many other limitations 
> > > like
> > > that, small and large, that really makes the case for API-level 
> > > integration,
> > > in which case you'd have to go through a PCI compliance audit. By the way,
> > > we've been through it multiple times. For the most part, it's perfunctory.
> > > --
> > > Regards,
>
> > > Clifford Ilkay
> > > Dinamis
> > > 1419-3266 Yonge St.
> > > Toronto, ON
> > > Canada  M4N 3P6
>
> > > 
> > > +1 416-410-3326
>
> > > --
> > > 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
> > > django-users+unsubscr...@googlegroups.com.
> > > For more options, visit this group at
> > >http://groups.google.com/group/django-users?hl=en.

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: How to store the database in the project root

2011-03-29 Thread Shawn Milochik
This works for me:

DIRNAME = os.path.dirname(__file__)

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



A very simple dajax code to show alert window not working

2011-03-29 Thread Abhijeet Rastogi
Hi,

I am beginner in django and dajax. In the process of learning to use dajax I
am trying to simply display an alert saying "Foo".

My code: https://bitbucket.org/shadyabhi/learnajax/src

The above code contains 2 input boxes. The first one works but second one
says "Dajax is not defined".
I am not able to figure out what is the issue.
I tried making the above code using
http://www.dajaxproject.com/multiply/.In that, Dajax.process is send
as parameter to function. Where is the
documentation for that particular thing?

It would be great if I could get a prompt reply as my project is on hold due
to this AJAX stuff. Thanks.

My ajax.py looks like:
def showalert(request):
dajax = Dajax()
dajax.alert("foo")
return dajax.json()

And relevant template code is
function alertshow(){
   Dajaxice.example.showalert(Dajax.process)
   }


-- 
Regards,
Abhijeet Rastogi (shadyabhi)
http://www.google.com/profiles/abhijeet.1989

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



wsgi config question

2011-03-29 Thread Sells, Fred
I'm just converting from mod_python to mod_wsgi and making progress.  I
would like to be able to deploy multiple independent webapps without
having to edit the apache configs each time.  I'm thinking of something
like

 

/var/www/wsgi-scripts

App1.wsgi

App2.wsgi

...

 

Where I could deploy a new app by just dropping the .wsgi file into my
"wsgi deploy directory"

 

But it looks like the WSGIScriptAlias would point to a specific file and
I would need to add a new directive each time I added a new app.  Not
exactly the worst thing in the world, but it would be nice to not have
to touch the apache .conf files once I get it working.  Any ideas?

 

Here's my wsgi.conf file

LoadModule wsgi_module modules/mod_wsgi.so

WSGIScriptAlias /myapp /var/www/wsgi-scripts/myapp.wsgi

WSGIDaemonProcess sunbelt.org processes=2 threads=15

WSGIProcessGroup sunbelt.org

LogLevel info

WSGISocketPrefix /var/run/wsgi



Order allow,deny

Allow from 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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Fwd: creating text area for subpage inside models.py

2011-03-29 Thread Cal Leeming [Simplicity Media Ltd]
Hi, Cal Leeming,

Thanks for the tips

Ok, here is what I did step by step,

First I've modified the models.py file adding this like:

// code starts

*class City ( models.Model ):

...

   class Translation ( multilingual.Translation ):

...
tourism_text = models.TextField ( 'Tourism text', blank = True, null
= False )

   ** climate_text = models.TextField ( 'Climate text', blank = True,
null = False )*

// code ends

The code in bold and italics is the code I've added inside models.py.

Inside the admin page of my website, there is a text area called 'Tourism
text', where the HTML code for the Tourism section of my webpage is added.
What I want to do is to add a 'Climate text' text area so I can write
additional HTML content for a new Climate subpage.

Then, in order to update my database, I go to
/var/www/django-install/myproject and type:

*python manage.py syncdb*

But I get the following error message: *Error: No module named multilingual*

By the way, after modifying the models.py and saving it, I got a 'Internal
Server Error 500' on my website. So I had to delete all additions I had made
to models.py.

Now the website is running, but I am unable to make my desired
modifications.

Again, thanks for your time and assistance,

Jake K.

PS: let me know if you need more details




On Tue, Mar 29, 2011 at 2:46 PM, Cal Leeming [Simplicity Media Ltd] <
cal.leem...@simplicitymedialtd.co.uk> wrote:

> Hi Jake,
>
> Please ensure you always paste example source code, where possible and
> within reason.
>
> It is extremely difficult for people to help if they don't have this.
>
> If you respond back with this, I'm sure one of us will be able to give you
> a hand.
>
> Cheers
>
> Cal
>
> On Tue, Mar 29, 2011 at 5:49 PM, jake k.  wrote:
>
>> Hi, All
>>
>> I was wondering if you can help me with this one.
>>
>> I've modified part of my models.py file so I can have a new text area
>> inside
>> my django admin page. I need to add this text area so I can add
>> content to a new subpage
>>
>> I have added the new text area, but after saving and refreshing the
>> page, the admin site
>> would look unchanged, without the new text area I added inside
>> models.py file
>>
>> What's wrong?
>>
>> How can I update my models.py file?
>>
>> Thanks for your time and assistance, your reply would be greatly
>> appreciated
>>
>> Regards,
>>
>> --
>> 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
>> django-users+unsubscr...@googlegroups.com.
>> For more options, visit this group at
>> http://groups.google.com/group/django-users?hl=en.
>>
>>
>

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: A very simple dajax code to show alert window not working

2011-03-29 Thread Jorge Bastida
Hi,

You should include your desired Dajax implementation. You can choose between
Prototype, jquery, dojo etc...

The django-dajax installation steps are here [1]. As you can see in one of
the final steps "Include dajax in your ", you should add a new script
line to include that JS, also you should include that JS Framework :)



Hope this help you.

Regards.


[1] https://github.com/jorgebastida/django-dajax/wiki/Installation

2011/3/29 Abhijeet Rastogi 

> Hi,
>
> I am beginner in django and dajax. In the process of learning to use dajax
> I am trying to simply display an alert saying "Foo".
>
> My code: https://bitbucket.org/shadyabhi/learnajax/src
>
> The above code contains 2 input boxes. The first one works but second one
> says "Dajax is not defined".
> I am not able to figure out what is the issue.
> I tried making the above code using http://www.dajaxproject.com/multiply/.In 
> that, Dajax.process is send as parameter to function. Where is the
> documentation for that particular thing?
>
> It would be great if I could get a prompt reply as my project is on hold
> due to this AJAX stuff. Thanks.
>
> My ajax.py looks like:
> def showalert(request):
> dajax = Dajax()
> dajax.alert("foo")
> return dajax.json()
>
> And relevant template code is
> function alertshow(){
>Dajaxice.example.showalert(Dajax.process)
>}
>  onclick="alertshow()">
>
> --
> Regards,
> Abhijeet Rastogi (shadyabhi)
> http://www.google.com/profiles/abhijeet.1989
>
> --
> 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
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Accessing values in formset loops

2011-03-29 Thread Nick
I am looping through a formset and attempting to add an additional
field to the form that is a multi select checkbox that has a value of
the ID of the current iteration of the formset loop.

So:

model1:
   name = CharField
   ID = IntegerField
   FK = ForeignKey('model2')

model2:
   name


my formset is set up to present all objects related to model2. I would
like to add a field in the form that is a checkbox that passes the ID
of model1 on POST.

Any clue how this can be accomplished?

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Generic List View raises Attribute Error: "'function' object has no attribute '_clone'

2011-03-29 Thread dpapathanasiou
I've written a simple search function that uses a db model based on
the one described in The Django Book tutorial (http://
www.djangobook.com/en/2.0/), using a generic list, and a Paginator.

Here is my view function:

def search (request):
"""Search by title or author name"""

if 'q' in request.POST and request.POST['q']:

query_term = request.POST['q']
context = { }

book_list =
Book.objects.filter(Q(authors__name__contains=query_term) |
Q(title__contains=query_term))
if len(book_list) == 0:
context['message'] = 'No matches found'
book_list = Book.objects.all() #
Book.objects.filter(Q(available=True)) also works

paginator = Paginator(book_list, 10) # Show 10 books per page

try:
page = int(request.GET.get('page', '1'))
except ValueError:
page = 1

try:
books = paginator.page(page)
except (EmptyPage, InvalidPage):
books = paginator.page(paginator.num_pages)

shopping_cart_count = 0
if "cart" in request.session:
   shopping_cart_count = len(request.session['cart'])
context['shopping_cart'] = shopping_cart_count

return list_detail.object_list(request, queryset=books,
template_name='book_list.html', extra_context=context)

When there no matches for the query_term are found, the book_list is
simply Book.objects.all(), and the template is rendered correctly.

When, however, the query_term matches, I get this error:

Attribute Error: "'function' object has no attribute '_clone'

Supposedly, this is because the filtering does not produce a proper
QuerySet, which in turn, cannot be cloned by the generic view.

If, however, I change the no matches QuerySet from Book.objects.all()
to Book.objects.filter(Q(available=True)), the generic view works.

Both of the solutions I found suggest creating a new class which
builds a proper QuerySet from multiple filter lists (http://
djangosnippets.org/snippets/1103/ and
http://stackoverflow.com/questions/431628/how-to-combine-2-or-more-querysets-in-a-django-view/432666#432666),
but even using those gave me the same result.

I also tried removing the Q(authors__name__contains=query_term) filter
on Book, since authors is a ManyToMany relation, but that gave me the
same result as well.

Any suggestions?

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Accessing values in formset loops

2011-03-29 Thread Nick
I guess the bigger question is, can I access the values of the fields
without spitting out a form field?

On Mar 29, 2:45 pm, Nick  wrote:
> I am looping through a formset and attempting to add an additional
> field to the form that is a multi select checkbox that has a value of
> the ID of the current iteration of the formset loop.
>
> So:
>
> model1:
>    name = CharField
>    ID = IntegerField
>    FK = ForeignKey('model2')
>
> model2:
>    name
>
> my formset is set up to present all objects related to model2. I would
> like to add a field in the form that is a checkbox that passes the ID
> of model1 on POST.
>
> Any clue how this can be accomplished?

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: How to store the database in the project root

2011-03-29 Thread rohan
I got it working.


I just used os.path.join(PROJECT_ROOT,'db/chemdb') in place of
database name. It created the database within a folder called db
inside the project.

On Mar 29, 1:50 pm, Shawn Milochik  wrote:
> This works for me:
>
> DIRNAME = os.path.dirname(__file__)

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: A very simple dajax code to show alert window not working

2011-03-29 Thread Abhijeet Rastogi
Thanks Jorge. Worked perfectly.
I included jquery.dajax.core.js and jquery.js in the document and now
everything works perfectly.

btw, I couldnt find documentation for Dajax.process method. Like there there
might me other methods too. Where can I find the documentation for them.

On Wed, Mar 30, 2011 at 1:01 AM, Jorge Bastida  wrote:

> Hi,
>
> You should include your desired Dajax implementation. You can choose
> between Prototype, jquery, dojo etc...
>
> The django-dajax installation steps are here [1]. As you can see in one of
> the final steps "Include dajax in your ", you should add a new script
> line to include that JS, also you should include that JS Framework :)
>
>  type="text/javascript" charset="utf-8">
>
> Hope this help you.
>
> Regards.
>
>
> [1] https://github.com/jorgebastida/django-dajax/wiki/Installation
>
> 2011/3/29 Abhijeet Rastogi 
>
>>  Hi,
>>
>> I am beginner in django and dajax. In the process of learning to use dajax
>> I am trying to simply display an alert saying "Foo".
>>
>> My code: https://bitbucket.org/shadyabhi/learnajax/src
>>
>> The above code contains 2 input boxes. The first one works but second one
>> says "Dajax is not defined".
>> I am not able to figure out what is the issue.
>> I tried making the above code using http://www.dajaxproject.com/multiply/.In 
>> that, Dajax.process is send as parameter to function. Where is the
>> documentation for that particular thing?
>>
>> It would be great if I could get a prompt reply as my project is on hold
>> due to this AJAX stuff. Thanks.
>>
>> My ajax.py looks like:
>> def showalert(request):
>> dajax = Dajax()
>> dajax.alert("foo")
>> return dajax.json()
>>
>> And relevant template code is
>> function alertshow(){
>>Dajaxice.example.showalert(Dajax.process)
>>}
>> > onclick="alertshow()">
>>
>> --
>> Regards,
>> Abhijeet Rastogi (shadyabhi)
>> http://www.google.com/profiles/abhijeet.1989
>>
>> --
>> 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
>> django-users+unsubscr...@googlegroups.com.
>> For more options, visit this group at
>> http://groups.google.com/group/django-users?hl=en.
>>
>
>


-- 
Regards,
Abhijeet Rastogi (shadyabhi)
http://www.google.com/profiles/abhijeet.1989

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: develop to product

2011-03-29 Thread yongzhen zhang

NameVirtualHost *:80

in /etc/apache2/sites-available i made one file istore:

ServerAdmin webmaster@localhost
ServerName www.imaboy.cn
ServerAlias shop.imaboy.cn
Alias /static /home/yongzhen/workspace/www/iStore/static

DocumentRoot /home/yongzhen/workspace/www/iStore
WSGIScriptAlias / /home/yongzhen/workspace/www/apache/
django.wsgi

ErrorLog /var/log/apache2/error.log
LogLevel warn

CustomLog /var/log/apache2/access.log combined

 and i $ sudo a2ensite istore and $ sudo a2dissite default
Now the prolem is that when i open www.imaboy.cn, it said:"The page
can not been found" (404), there is no error in error.log, Everything
seems works fine, but without good result.

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: A very simple dajax code to show alert window not working

2011-03-29 Thread Jorge Bastida
Hi,

There isn't any other methods, Dajax.process is only a callback that
"understand" what Dajax return as response.
You can check the code here [1].

Regards.

[1]
https://github.com/jorgebastida/django-dajax/blob/master/src/jquery.dajax.core.js

2011/3/29 Abhijeet Rastogi 

> Thanks Jorge. Worked perfectly.
> I included jquery.dajax.core.js and jquery.js in the document and now
> everything works perfectly.
>
> btw, I couldnt find documentation for Dajax.process method. Like there
> there might me other methods too. Where can I find the documentation for
> them.
>
>
> On Wed, Mar 30, 2011 at 1:01 AM, Jorge Bastida  wrote:
>
>> Hi,
>>
>> You should include your desired Dajax implementation. You can choose
>> between Prototype, jquery, dojo etc...
>>
>> The django-dajax installation steps are here [1]. As you can see in one of
>> the final steps "Include dajax in your ", you should add a new script
>> line to include that JS, also you should include that JS Framework :)
>>
>> > type="text/javascript" charset="utf-8">
>>
>> Hope this help you.
>>
>> Regards.
>>
>>
>> [1] https://github.com/jorgebastida/django-dajax/wiki/Installation
>>
>> 2011/3/29 Abhijeet Rastogi 
>>
>>>  Hi,
>>>
>>> I am beginner in django and dajax. In the process of learning to use
>>> dajax I am trying to simply display an alert saying "Foo".
>>>
>>> My code: https://bitbucket.org/shadyabhi/learnajax/src
>>>
>>> The above code contains 2 input boxes. The first one works but second one
>>> says "Dajax is not defined".
>>> I am not able to figure out what is the issue.
>>> I tried making the above code using
>>> http://www.dajaxproject.com/multiply/ .In that, Dajax.process is send as
>>> parameter to function. Where is the documentation for that particular thing?
>>>
>>> It would be great if I could get a prompt reply as my project is on hold
>>> due to this AJAX stuff. Thanks.
>>>
>>> My ajax.py looks like:
>>> def showalert(request):
>>> dajax = Dajax()
>>> dajax.alert("foo")
>>> return dajax.json()
>>>
>>> And relevant template code is
>>> function alertshow(){
>>>Dajaxice.example.showalert(Dajax.process)
>>>}
>>> >> onclick="alertshow()">
>>>
>>> --
>>> Regards,
>>> Abhijeet Rastogi (shadyabhi)
>>> http://www.google.com/profiles/abhijeet.1989
>>>
>>> --
>>> 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
>>> django-users+unsubscr...@googlegroups.com.
>>> For more options, visit this group at
>>> http://groups.google.com/group/django-users?hl=en.
>>>
>>
>>
>
>
> --
> Regards,
> Abhijeet Rastogi (shadyabhi)
> http://www.google.com/profiles/abhijeet.1989
>

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Git repository with all tutorial code.

2011-03-29 Thread Andreas Neustifter
Hi all!

I have just worked the tutorial from
http://docs.djangoproject.com/en/1.3/intro/tutorial01/ and recorded
all the steps in an Git repository and made this available for
everyone to reproduce at https://github.com/astifter/django-Tutorial.

Using this as starting point for new users of the tutorial? Is there
any downside to having this in a repository?

Cheers, Andi

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Best way to implement a settings.py ROBOT_NO_FOLLOW

2011-03-29 Thread palhmbs
Hi,

I have placed ROBOTS_NO_FOLLOW = True  in
mysite/settings.py

I have added data['robots_no_follow'] =
msyite.settings.ROBOTS_NO_FOLLOW
into decorators.py under...
def as_view(request, template, data, slug):
which passes this successfully onto base.html so I can check it with

{% if robots_no_follow %}

{% endif %}

I can succesfully turn it on / off with settings.py but I want to turn
this off when deployment_settings.py overrides it, ie:
ROBOTS_NO_FOLLOW = False.

The reason we are trying to change this is because others are putting
openhatch.org development sites
online and they are showing up in the google search results.

I hope you can help, as I'm a bit stuck.

Paul

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Accessing values in formset loops

2011-03-29 Thread Mike Ramirez
On Tuesday, March 29, 2011 12:50:09 pm Nick wrote:
> I guess the bigger question is, can I access the values of the fields
> without spitting out a form field?
> 

form.field.value?

After the form is bound, when you access the field, it's turned into a bound 
field[1] . This wrapper adds a few extra attributes for rendering the field as 
html

[1] http://docs.djangoproject.com/en/1.3/ref/forms/api/#more-granular-output

Mike
-- 
Q:  What's the difference between USL and the Titanic?
A:  The Titanic had a band.

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Invalid values in a form cause validation to fail

2011-03-29 Thread ALJ
I have a form within a view which allows users to filter results
within a database. The request is a GET because I want the users to be
able to bookmark the results.

My querystring looks something like:

http://127.0.0.1:8001/myapp/?organisation_name=&corporation=4&authorisation_status=

My view checks the form as it comes in (form.is_valid()) and bounces
them back if they have been messing about with the querystring. The
validation picks up errors if I do something like
"..&corporation=99&...", but if I do something like
"...&corporation=&" it brings up a traceback

Exception Value:
invalid literal for int() with base 10: ''

I would have expected that the validation process would have picked up
that it isn't valid and just returned field error.

Or am I doing something wrong.

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: creating text area for subpage inside models.py

2011-03-29 Thread j
Hey, Cal

I just wanna let you know that I got an empty reply from you

Thanks


On Tue, Mar 29, 2011 at 4:07 PM, Cal Leeming [Simplicity Media Ltd] <
cal.leem...@simplicitymedialtd.co.uk> wrote:

> Hi, Cal Leeming,
>
> Thanks for the tips
>
> Ok, here is what I did step by step,
>
> First I've modified the models.py file adding this like:
>
> // code starts
>
> *class City ( models.Model ):
>
> ...
>
>class Translation ( multilingual.Translation ):
>
> ...
> tourism_text = models.TextField ( 'Tourism text', blank = True,
> null = False )
>
>** climate_text = models.TextField ( 'Climate text', blank = True,
> null = False )*
>
> // code ends
>
> The code in bold and italics is the code I've added inside models.py.
>
> Inside the admin page of my website, there is a text area called 'Tourism
> text', where the HTML code for the Tourism section of my webpage is added.
> What I want to do is to add a 'Climate text' text area so I can write
> additional HTML content for a new Climate subpage.
>
> Then, in order to update my database, I go to
> /var/www/django-install/myproject and type:
>
> *python manage.py syncdb*
>
> But I get the following error message: *Error: No module named
> multilingual*
>
> By the way, after modifying the models.py and saving it, I got a 'Internal
> Server Error 500' on my website. So I had to delete all additions I had made
> to models.py.
>
> Now the website is running, but I am unable to make my desired
> modifications.
>
> Again, thanks for your time and assistance,
>
> Jake K.
>
> PS: let me know if you need more details
>
>
>
>
> On Tue, Mar 29, 2011 at 2:46 PM, Cal Leeming [Simplicity Media Ltd] <
> cal.leem...@simplicitymedialtd.co.uk> wrote:
>
>> Hi Jake,
>>
>> Please ensure you always paste example source code, where possible and
>> within reason.
>>
>> It is extremely difficult for people to help if they don't have this.
>>
>> If you respond back with this, I'm sure one of us will be able to give you
>> a hand.
>>
>> Cheers
>>
>> Cal
>>
>> On Tue, Mar 29, 2011 at 5:49 PM, jake k.  wrote:
>>
>>> Hi, All
>>>
>>> I was wondering if you can help me with this one.
>>>
>>> I've modified part of my models.py file so I can have a new text area
>>> inside
>>> my django admin page. I need to add this text area so I can add
>>> content to a new subpage
>>>
>>> I have added the new text area, but after saving and refreshing the
>>> page, the admin site
>>> would look unchanged, without the new text area I added inside
>>> models.py file
>>>
>>> What's wrong?
>>>
>>> How can I update my models.py file?
>>>
>>> Thanks for your time and assistance, your reply would be greatly
>>> appreciated
>>>
>>> Regards,
>>>
>>> --
>>> 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
>>> django-users+unsubscr...@googlegroups.com.
>>> For more options, visit this group at
>>> http://groups.google.com/group/django-users?hl=en.
>>>
>>>
>>
>
>  --
> 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
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: develop to product

2011-03-29 Thread yongzhen zhang
It shows:

404 Not Found



nginx/0.7.65

On 3月30日, 上午4时19分, yongzhen zhang <4...@live.cn> wrote:
> NameVirtualHost *:80
>
> in /etc/apache2/sites-available i made one file istore:
> 
> ServerAdmin webmaster@localhost
> ServerNamewww.imaboy.cn
> ServerAlias shop.imaboy.cn
> Alias /static /home/yongzhen/workspace/www/iStore/static
>
> DocumentRoot /home/yongzhen/workspace/www/iStore
> WSGIScriptAlias / /home/yongzhen/workspace/www/apache/
> django.wsgi
>
> ErrorLog /var/log/apache2/error.log
> LogLevel warn
>
> CustomLog /var/log/apache2/access.log combined
> 
>  and i $ sudo a2ensite istore and $ sudo a2dissite default
> Now the prolem is that when i openwww.imaboy.cn, it said:"The page
> can not been found" (404), there is no error in error.log, Everything
> seems works fine, but without good result.

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: develop to product

2011-03-29 Thread creecode
Hello Yongzhen,

The first thing you might want to find out is why, apparently, nginx
is giving you an error when you say that you are using apache/wsgi.

If I had to guess I'd say you might have an nginx server acting as a
proxy in your stack somewhere.  I'm not an expert though as I've just
been getting to grips with basic proxying myself.

Check for an nginx error log somewhere... see what that says, if
there...

On Mar 29, 2:07 pm, yongzhen zhang <4...@live.cn> wrote:

> nginx/0.7.65

Toodle-l..
creecode

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Git repository with all tutorial code.

2011-03-29 Thread Lachlan Musicman
On Wed, Mar 30, 2011 at 07:05, Andreas Neustifter
 wrote:
>
> Using this as starting point for new users of the tutorial? Is there
> any downside to having this in a repository?

Well, it's not *evil* if that's what you are asking. Personally, I
found hand typing all the code from the tutorial to be a large part of
the learning process. Removing it, or making it too easy for people,
could potentially reduce their learning experience. Obviously that
would only affect ppl that learn like I do - others will find it
useful I'm sure.

cheers
L.

-- 
Crunchiness is the gustatory sensation of muffled grinding of a
foodstuff. Crunchiness differs from crispiness in that a crispy item
is quickly atomized, while a crunchy one offers sustained, granular
resistance to jaw action. While crispiness is difficult to maintain,
crunchiness is difficult to overcome.
from The Best of Wikipedia http://bestofwikipedia.tumblr.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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Session "rollback" after transaction rollback

2011-03-29 Thread Tomasz Zieliński
How do you handle situation in which exception is raised from view,
TransactionMiddleware rolls back the open transaction, but subsequently 
SessionMiddleware updates session in database with broken data
(i.e. something that points to what was rolled back 
by TransactionMiddleware) ?

This is an edge case but quite interesting one, at least for me.

-- 
Tomasz Zielinski
pyconsultant.eu

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



How to hire a freelance Django developer

2011-03-29 Thread Micah Carrick
Hey folks,

Let me start by saying: Please don't email me your resume--this is not a job
listing.

That being said, I do need to hire python/django developers and system
admins from time to time to help me out with projects or take something off
my plate. Is there a good *free* resource to browse freelance Django
developers and/or post freelance gigs? I'm typically hiring somebody to help
with very small, open-source projects for which I am not trying to make
money off of. So paying $300 at github, stackoverflow, or any other paid job
posting site is not an option.

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Invalid values in a form cause validation to fail

2011-03-29 Thread Karen Tracey
On Tue, Mar 29, 2011 at 4:40 PM, ALJ  wrote:

> I have a form within a view which allows users to filter results
> within a database. The request is a GET because I want the users to be
> able to bookmark the results.
>
> My querystring looks something like:
>
>
> http://127.0.0.1:8001/myapp/?organisation_name=&corporation=4&authorisation_status=
>
> My view checks the form as it comes in (form.is_valid()) and bounces
> them back if they have been messing about with the querystring. The
> validation picks up errors if I do something like
> "..&corporation=99&...", but if I do something like
> "...&corporation=&" it brings up a traceback
>
> Exception Value:
> invalid literal for int() with base 10: ''
>
> I would have expected that the validation process would have picked up
> that it isn't valid and just returned field error.
>
>
It does, in general. This form/view:

class TestForm(forms.Form):
num = forms.IntegerField()

def testme(request):
if request.GET:
tf = TestForm(request.GET)
if tf.is_valid():
return http.HttpResponse("Worked!")
else:
tf = TestForm()
return render_to_response('form.html', {'form': tf})

rendered with a method="get" form, causes re-display of the form with an
error message "Enter a whole number." associated with the num field if the
value www is entered in the num field (or simply retrieved by a ?num=www
querystring).

How is what you are doing different from what is shown above? You have not
shown any of your code nor the full traceback, so it is hard to guess what
may be the cause of the behavior you are seeing.

Karen
-- 
http://tracey.org/kmt/

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: How to run a file.py in the django environement

2011-03-29 Thread Russell Keith-Magee
On Tue, Mar 29, 2011 at 3:18 AM, Sells, Fred
 wrote:
> It was explained very clearly to me, I believe by shawn, but I've lost the 
> original reference.  If the file you want to run is in your django app 
> directory you just need

... or, you can follow the example in the docs:

http://docs.djangoproject.com/en/1.3/topics/settings/#using-settings-without-setting-django-settings-module

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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: how to create message box in Django?

2011-03-29 Thread Sam Walters
Yes, this is really a client-side related issue.

To try and answer your question what would be involved on the django
side of things:

Basically you want django to deal with any submission from one of
these fields as either a from or modelform so you can run clean() and
validate the input.

Beyond that the 'Message Box' html / scripts can be served dynamically
if need be in the django template system.

If you wanted to be really fancy in how you serve up the html+js form
code you could write/extend forms in some way. In which case looking
at the widgets source at:
http://code.djangoproject.com/browser/django/trunk/django/forms

Is your best bet.

cheers

sam_w

On Wed, Mar 30, 2011 at 2:20 AM, Shawn Milochik  wrote:
> Yeah, this isn't a Django question. But this is what we use:
>
> http://jqueryui.com/demos/dialog/
>
> --
> 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 
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/django-users?hl=en.
>
>

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: develop to product

2011-03-29 Thread Sam Walters
Hi Yongzhen,

Looks like you're trying to run two mis-configured web servers.

if you're on linux stop the nginx process eg: /etc/init.d/nginx stop
The stuff you've submitted is for apache: Send us the contents of the
apache log file showing the error.

Perhaps *if the error is long* use http://pastebin.com/ instead of
putting the error code into the email.

cheers

sam_w

On Wed, Mar 30, 2011 at 8:40 AM, creecode  wrote:
> Hello Yongzhen,
>
> The first thing you might want to find out is why, apparently, nginx
> is giving you an error when you say that you are using apache/wsgi.
>
> If I had to guess I'd say you might have an nginx server acting as a
> proxy in your stack somewhere.  I'm not an expert though as I've just
> been getting to grips with basic proxying myself.
>
> Check for an nginx error log somewhere... see what that says, if
> there...
>
> On Mar 29, 2:07 pm, yongzhen zhang <4...@live.cn> wrote:
>
>> nginx/0.7.65
>
> Toodle-l..
> creecode
>
> --
> 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 
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/django-users?hl=en.
>
>

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: How to hire a freelance Django developer

2011-03-29 Thread Mike Ramirez
On Tuesday, March 29, 2011 05:04:49 pm Micah Carrick wrote:
> Hey folks,
> 
> Let me start by saying: Please don't email me your resume--this is not a
> job listing.
> 
> That being said, I do need to hire python/django developers and system
> admins from time to time to help me out with projects or take something off
> my plate. Is there a good *free* resource to browse freelance Django
> developers and/or post freelance gigs? I'm typically hiring somebody to
> help with very small, open-source projects for which I am not trying to
> make money off of. So paying $300 at github, stackoverflow, or any other
> paid job posting site is not an option.

http://djangogigs.com/

Mike
-- 
  It isn't an optical illusion. It just looks like one.

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Git repository with all tutorial code.

2011-03-29 Thread Mike Ramirez
On Tuesday, March 29, 2011 03:08:32 pm Lachlan Musicman wrote:
> On Wed, Mar 30, 2011 at 07:05, Andreas Neustifter
> 
>  wrote:
> > Using this as starting point for new users of the tutorial? Is there
> > any downside to having this in a repository?
> 
> Well, it's not *evil* if that's what you are asking. Personally, I
> found hand typing all the code from the tutorial to be a large part of
> the learning process. Removing it, or making it too easy for people,
> could potentially reduce their learning experience. Obviously that
> would only affect ppl that learn like I do - others will find it
> useful I'm sure.
> 
> cheers
> L.
 +1

Learning comes from experience and repitition.

Though having the code in a public repo might encourage some to copy and 
pasta, or not right code at all and just look at how it all goes together it's 
their loss.  But it would be good to have a working master copy others can use 
to verify thier own work in the tutorial.

Mike
-- 
To get back on your feet, miss two car payments.

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: How to hire a freelance Django developer

2011-03-29 Thread Venkatraman S
On Wed, Mar 30, 2011 at 5:34 AM, Micah Carrick wrote:

> That being said, I do need to hire python/django developers and system
> admins from time to time to help me out with projects or take something off
> my plate. Is there a good *free* resource to browse freelance Django
> developers and/or post freelance gigs? I'm typically hiring somebody to help
> with very small, open-source projects for which I am not trying to make
> money off of. So paying $300 at github, stackoverflow, or any other paid job
> posting site is not an option.
>

For jobs of this nature, you can probably build relationships with
developers over a period of time and then get things done from one of them
based on their schedules.  Can start with a posting in this group, and based
on who replies, start a conversation and build rapport.  I am pretty sure
that there are many moonlighters who can help, but its just that you need to
have a couple of them, so that your schedules are not impacted.

http://djangopeople.net/ can also be a place where you can search for people
across nations.

I recently posted an ad for a paid gig in an open source project in this
group; you would be suprirised, but i got just ONE response and even that
person wanted a longer engagement period.

-V

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Git repository with all tutorial code.

2011-03-29 Thread Mike Ramirez
On Tuesday, March 29, 2011 10:34:28 pm you wrote:

> Though having the code in a public repo might encourage some to copy and
> pasta, or not right code at all and just look at how it all goes together
>

s/right/write/

Mike

-- 
Don't read everything you believe.

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: develop to product

2011-03-29 Thread yongzhen zhang
Hi Sam,
Yes, you are right, i want to run Django project on my LAMP server,
before i did the Django project, i also made some PHP work under /var/
www. But now the PHP work doesnt work any more. Here is the apache
error:
[Tue Mar 29 23:56:53 2011] [error] Exception KeyError:
KeyError(-1218464000,) in  ignored
[Tue Mar 29 23:56:53 2011] [error] Exception KeyError:
KeyError(-1218464000,) in  ignored
[Tue Mar 29 23:56:53 2011] [error] Exception KeyError:
KeyError(-1218464000,) in  ignored
[Tue Mar 29 23:56:53 2011] [error] Exception KeyError:
KeyError(-1218464000,) in  ignored
[Tue Mar 29 23:56:53 2011] [error] Exception KeyError:
KeyError(-1218464000,) in  ignored
[Tue Mar 29 23:56:53 2011] [error] Exception KeyError:
KeyError(-1218464000,) in  ignored
[Tue Mar 29 23:56:53 2011] [error] Exception KeyError:
KeyError(-1218464000,) in  ignored
[Tue Mar 29 23:56:53 2011] [error] Exception KeyError:
KeyError(-1218464000,) in  ignored
[Tue Mar 29 23:56:53 2011] [error] Exception KeyError:
KeyError(-1218464000,) in  ignored
[Tue Mar 29 23:56:54 2011] [notice] caught SIGTERM, shutting down


On 3月30日, 下午1时09分, Sam Walters  wrote:
> Hi Yongzhen,
>
> Looks like you're trying to run two mis-configured web servers.
>
> if you're on linux stop the nginx process eg: /etc/init.d/nginx stop
> The stuff you've submitted is for apache: Send us the contents of the
> apache log file showing the error.
>
> Perhaps *if the error is long* usehttp://pastebin.com/instead of
> putting the error code into the email.
>
> cheers
>
> sam_w
>
>
>
> On Wed, Mar 30, 2011 at 8:40 AM, creecode  wrote:
> > Hello Yongzhen,
>
> > The first thing you might want to find out is why, apparently, nginx
> > is giving you an error when you say that you are using apache/wsgi.
>
> > If I had to guess I'd say you might have an nginx server acting as a
> > proxy in your stack somewhere.  I'm not an expert though as I've just
> > been getting to grips with basic proxying myself.
>
> > Check for an nginx error log somewhere... see what that says, if
> > there...
>
> > On Mar 29, 2:07 pm, yongzhen zhang <4...@live.cn> wrote:
>
> >> nginx/0.7.65
>
> > Toodle-l..
> > creecode
>
> > --
> > 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 
> > django-users+unsubscr...@googlegroups.com.
> > For more options, visit this group 
> > athttp://groups.google.com/group/django-users?hl=en.

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: How to hire a freelance Django developer

2011-03-29 Thread Lakshman Prasad
> Is there a good *free* resource to browse freelance Django developers

github.com is out there: https://github.com/search?q=django

On Wed, Mar 30, 2011 at 5:34 AM, Micah Carrick wrote:

> Hey folks,
>
> Let me start by saying: Please don't email me your resume--this is not a
> job listing.
>
> That being said, I do need to hire python/django developers and system
> admins from time to time to help me out with projects or take something off
> my plate. Is there a good *free* resource to browse freelance Django
> developers and/or post freelance gigs? I'm typically hiring somebody to help
> with very small, open-source projects for which I am not trying to make
> money off of. So paying $300 at github, stackoverflow, or any other paid job
> posting site is not an option.
>
>
>
>
>  --
> 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
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: How to hire a freelance Django developer

2011-03-29 Thread Kenneth Gonsalves
On Wed, 2011-03-30 at 12:06 +0530, Lakshman Prasad wrote:
> > Is there a good *free* resource to browse freelance Django
> developers
> 
> github.com is out there: https://github.com/search?q=django
> 
> 

and more on bitbucket
-- 
regards
KG
http://lawgon.livejournal.com
Coimbatore LUG rox
http://ilugcbe.techstud.org/

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