Re: Getting Duplicate records with Q query

2010-06-03 Thread Thomas Guettler
Hi Lee,

search for "distinct", to filter duplicates.
But I don't know why one returns no duplicates.

HTH

Lee Hinde wrote:
> Hi;
> 
> Goal is to get a list of notes that include all those created or
> addressed to the current user, within the last few days.
> 
> Model is a Note, with a created_by field and a many-to-many to a
> recipients table which is itself linked to a User Profile table which
> is linked to Users.
> 
> Note <--Recipients-->UserProfile-->User
> 
> This is the query:
> 
>  mynotes = Note.objects.filter((Q(recipient__user=id) | Q(created_by =
> id)) & Q(target_date__gte=sqlyr))
> #.select_related().order_by('-id').distinct()
> 
> In the resulting selection, I am getting duplicate records.
> 
> If I grab the generated sql, (and with some clean up) I also get duplicates:
> 
> SELECT * FROM `intranet_note`
> LEFT OUTER JOIN `intranet_noterecipient`
> ON (`intranet_note`.`id` = `intranet_noterecipient`.`note_id`)
> LEFT OUTER JOIN `intranet_userprofile`
>  ON (`intranet_noterecipient`.`userprofile_id` =
> `intranet_userprofile`.`id`)
>   WHERE ((`intranet_userprofile`.`user_id` = 6) OR
> (`intranet_note`.`created_by_id` = 6 )
>AND `intranet_note`.`target_date` >= 2010-05-30 )
> 
>  Now, the duplicates are in fact records that are both created by and
> are addressed to the current user.
> 
> But later, I have a simple search criteria that looks in both the
> subject and body of the note for the same value. That query doesn't
> return duplicates even if a note has the same value in both fields.
> 
> notes = Note.objects.filter( Q(subject__icontains=q) | Q(body__icontains=q))
> 
> So, obviously, my sql is failing me. Would anyone care to take a
> minute and explain why this is an expected result?
> 
> Thanks.
> 

-- 
Thomas Guettler, http://www.thomas-guettler.de/
E-Mail: guettli (*) thomas-guettler + de

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: utf8-problems

2010-06-03 Thread Fabian Rothfuchs
can you post your MySQL encoding / charset ?
what kind of exceptions do you experience ?

Cheers
 Fabian


On Jun 3, 2010, at 11:18 AM, Henrik Genssen wrote:

> Hi,
> 
> I do have utf-8 problems again.
> My dev-system works, my stage system works, too - but production does not. 
> And I do not see the error :-(
> As I think, it is a misconfiguration problem, do we have a checklist, what 
> and where to search for or test?
> I have seen utf problems several times on the list - maybe such a checklist 
> could help others, too?
> 
> My problem is searching data with german umlaute using mysql backend - 
> something like 'für' ('for' in english)
> 
> regards
> 
> Henrik
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To post to this group, send email to django-us...@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-us...@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.



utf8-problems

2010-06-03 Thread Henrik Genssen
Hi,

I do have utf-8 problems again.
My dev-system works, my stage system works, too - but production does not. And 
I do not see the error :-(
As I think, it is a misconfiguration problem, do we have a checklist, what and 
where to search for or test?
I have seen utf problems several times on the list - maybe such a checklist 
could help others, too?

My problem is searching data with german umlaute using mysql backend - 
something like 'für' ('for' in english)

regards

Henrik

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: utf8-problems

2010-06-03 Thread kanniga sivasubramanian
Yes, you are right. The mysql was not installed correctly. I uninstall 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-us...@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.



Integrating Django with a legacy but active database

2010-06-03 Thread kakarukeys
I am developing a django web app which does some web publishing
(pushing some data to website). My customer is already using
ExpressionEngine 2.0 for publishing, hopes that I can reuse the CMS
for any publishing purpose. They does not wish to redevelop the web
publishing platform in Django.

I'm asking if it is safe to...

use the technique documented in
http://docs.djangoproject.com/en/dev/howto/legacy-databases/

to create models and do publishing using the models. So we will have
two web apps being able to access / query the database at the same
time. Will it cause issues like data corruption, etc?

What are the alternative methods, if this is unsafe?

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-us...@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.



Establish "reverse relationships" between models?

2010-06-03 Thread derek
I have a situation which is parallel to the following:

class Building(models.Model):
id = models.AutoField(primary_key=True)
name = models.CharField(max_length=100)
def __unicode__(self):
return self.name

class Manufacturer(models.Model):
name = models.CharField(max_length=100)
def __unicode__(self):
return self.name

class Alarm(models.Model):
id = models.AutoField(primary_key=True)
name = models.CharField(max_length=100)
building =  models.ForeignKey(Building)
master = models.BooleanField(default=0)
manufacturer = models.ForeignKey(Manufacturer)
def __unicode__(self):
return self.name

Now I need to display a list of all buildings, along with any alarm
details, bearing in mind that not all buildings have alarms, while
some have more than one (but only one master).  However, when
iterating through Buiding objects, a call to display
"alarm.manufacturer__name" gives me an "AttributeError: 'Building'
object has no attribute 'alarm'".  Clearly, this is because, from the
building point of view, there is no known relationship to Alarm.

How do I create such a relationship in Django, without changing the
database structure (e.g. creating an alarm field on Building, with a
one-to-many relationship to Alarm)?  (and, ideally, also being able to
filter the result so only "master" alarms show up?)

Thanks
Derek

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: Establish "reverse relationships" between models?

2010-06-03 Thread Daniel Roseman
On Jun 3, 11:40 am, derek  wrote:
> I have a situation which is parallel to the following:
>
> class Building(models.Model):
>     id = models.AutoField(primary_key=True)
>     name = models.CharField(max_length=100)
>     def __unicode__(self):
>         return self.name
>
> class Manufacturer(models.Model):
>     name = models.CharField(max_length=100)
>     def __unicode__(self):
>         return self.name
>
> class Alarm(models.Model):
>     id = models.AutoField(primary_key=True)
>     name = models.CharField(max_length=100)
>     building =  models.ForeignKey(Building)
>     master = models.BooleanField(default=0)
>     manufacturer = models.ForeignKey(Manufacturer)
>     def __unicode__(self):
>         return self.name
>
> Now I need to display a list of all buildings, along with any alarm
> details, bearing in mind that not all buildings have alarms, while
> some have more than one (but only one master).  However, when
> iterating through Buiding objects, a call to display
> "alarm.manufacturer__name" gives me an "AttributeError: 'Building'
> object has no attribute 'alarm'".  Clearly, this is because, from the
> building point of view, there is no known relationship to Alarm.
>
> How do I create such a relationship in Django, without changing the
> database structure (e.g. creating an alarm field on Building, with a
> one-to-many relationship to Alarm)?  (and, ideally, also being able to
> filter the result so only "master" alarms show up?)
>
> Thanks
> Derek

You don't need to establish anything at all - you've already done all
that is required. However, you've become a bit confused about how to
do lookups. The 'double-underscore' syntax is *only* used within ORM
method calls - eg .filter() and .get(). (It's actually a bit of a hack
to allow dynamic parameters). Otherwise, you use the standard Python
"." lookup.

You should read this bit of the documentation on following
relationships backwards:
http://docs.djangoproject.com/en/dev/topics/db/queries/#following-relationships-backward

So in your case, given a building, you can do this to get all its
alarms:
mybuilding.alarm_set.all()
and this to get only its master ones:
mybuilding.alarm_set.filter(master=True)

Don't forget that in each case, the result is a queryset, not a single
instance, even if only one result is returned.
--
DR.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: Integrating Django with a legacy but active database

2010-06-03 Thread Russell Keith-Magee
On Thu, Jun 3, 2010 at 6:31 PM, kakarukeys  wrote:
> I am developing a django web app which does some web publishing
> (pushing some data to website). My customer is already using
> ExpressionEngine 2.0 for publishing, hopes that I can reuse the CMS
> for any publishing purpose. They does not wish to redevelop the web
> publishing platform in Django.
>
> I'm asking if it is safe to...
>
> use the technique documented in
> http://docs.djangoproject.com/en/dev/howto/legacy-databases/
>
> to create models and do publishing using the models. So we will have
> two web apps being able to access / query the database at the same
> time. Will it cause issues like data corruption, etc?

It should be entirely safe. You'll have the same transaction and
consistency issues that exist whenever you have two clients attached
to the same database, but that's just due to have two clients talking
to the same database -- you would get the same problems if you had two
EE users attached simultaneously.

The only other potential risk is if you have large amounts of data
consistency logic implemented in user code under Expression Engine. In
this case, you will need to duplicate this logic on the Django side,
and there's the risk that you might introduce errors as a result of
inconsistencies between the two implementations.

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-us...@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: Integrating Django with a legacy but active database

2010-06-03 Thread kakarukeys
On Jun 3, 7:23 pm, Russell Keith-Magee 
wrote:
> On Thu, Jun 3, 2010 at 6:31 PM, kakarukeys  wrote:
> > I am developing a django web app which does some web publishing
> > (pushing some data to website). My customer is already using
> > ExpressionEngine 2.0 for publishing, hopes that I can reuse the CMS
> > for any publishing purpose. They does not wish to redevelop the web
> > publishing platform in Django.
>
> > I'm asking if it is safe to...
>
> > use the technique documented in
> >http://docs.djangoproject.com/en/dev/howto/legacy-databases/
>
> > to create models and do publishing using the models. So we will have
> > two web apps being able to access / query the database at the same
> > time. Will it cause issues like data corruption, etc?
>
> It should be entirely safe. You'll have the same transaction and
> consistency issues that exist whenever you have two clients attached
> to the same database, but that's just due to have two clients talking
> to the same database -- you would get the same problems if you had two
> EE users attached simultaneously.
>
> The only other potential risk is if you have large amounts of data
> consistency logic implemented in user code under Expression Engine. In
> this case, you will need to duplicate this logic on the Django side,
> and there's the risk that you might introduce errors as a result of
> inconsistencies between the two implementations.
>
> Yours,
> Russ Magee %-)

Hi,

Thanks. I find what you said rather abstract for me to understand.
Could you give a simple example scenario where that might happen
(referring to the "potential risk")?

J.F.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: Integrating Django with a legacy but active database

2010-06-03 Thread Russell Keith-Magee
On Thu, Jun 3, 2010 at 7:48 PM, kakarukeys  wrote:
> On Jun 3, 7:23 pm, Russell Keith-Magee 
> wrote:
>> On Thu, Jun 3, 2010 at 6:31 PM, kakarukeys  wrote:
>> > I am developing a django web app which does some web publishing
>> > (pushing some data to website). My customer is already using
>> > ExpressionEngine 2.0 for publishing, hopes that I can reuse the CMS
>> > for any publishing purpose. They does not wish to redevelop the web
>> > publishing platform in Django.
>>
>> > I'm asking if it is safe to...
>>
>> > use the technique documented in
>> >http://docs.djangoproject.com/en/dev/howto/legacy-databases/
>>
>> > to create models and do publishing using the models. So we will have
>> > two web apps being able to access / query the database at the same
>> > time. Will it cause issues like data corruption, etc?
>>
>> It should be entirely safe. You'll have the same transaction and
>> consistency issues that exist whenever you have two clients attached
>> to the same database, but that's just due to have two clients talking
>> to the same database -- you would get the same problems if you had two
>> EE users attached simultaneously.
>>
>> The only other potential risk is if you have large amounts of data
>> consistency logic implemented in user code under Expression Engine. In
>> this case, you will need to duplicate this logic on the Django side,
>> and there's the risk that you might introduce errors as a result of
>> inconsistencies between the two implementations.
>>
>> Yours,
>> Russ Magee %-)
>
> Hi,
>
> Thanks. I find what you said rather abstract for me to understand.
> Could you give a simple example scenario where that might happen
> (referring to the "potential risk")?

Let's say you have a model with an integer field, but for some
business-logic reason, the integer must be greater than 10. If this
constraint is imposed at the database level, then you will never be
able to save a model with a value of 5 for that field. However, if the
constraint is imposed at the code level, you need to implement the
validation logic twice -- once under EE, and once under Django.

This means it's easy to inadvertently introduce errors; for example,
you could implement x > 10 on EE, but x>= 10 under Django. This means
that your Django client will be able to save a value of 10, but the
same value will raise a validation error under EE. Identifying and
testing for this sort of consistency is hard to do; so if you have a
lot of data validation constraints like this, it's worth considering
as a potential risk.

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-us...@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: Establish "reverse relationships" between models?

2010-06-03 Thread Dmitry Dulepov
Hi!

derek wrote:
> when
> iterating through Buiding objects, a call to display
> "alarm.manufacturer__name" gives me an "AttributeError: 'Building'
> object has no attribute 'alarm'".  Clearly, this is because, from the
> building point of view, there is no known relationship to Alarm.

class Alarm(models.Model):
...
building = models.ForeignKey(Building, related_name = 'alarm')
...

You need to name it properly, that's all.

-- 
Dmitry Dulepov
Twitter: http://twitter.com/dmitryd/
Web: http://dmitry-dulepov.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-us...@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: utf8-problems

2010-06-03 Thread Dmitry Dulepov
Hi!

Henrik Genssen wrote:
> I do have utf-8 problems again.
> My dev-system works, my stage system works, too - but production does not. 
> And I do not see the error :-(
> As I think, it is a misconfiguration problem, do we have a checklist, what 
> and where to search for or test?
> I have seen utf problems several times on the list - maybe such a checklist 
> could help others, too?
> 
> My problem is searching data with german umlaute using mysql backend - 
> something like 'für' ('for' in english)

Compare the output of this SQL on dev and production systems:

show variables like 'character_set_%'

I would also check character sets in "show create table" in both environments.

-- 
Dmitry Dulepov
Twitter: http://twitter.com/dmitryd/
Web: http://dmitry-dulepov.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-us...@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: Unable to import libxml2mod from the python script

2010-06-03 Thread Darren
Go to  /usr/local/bin and do ls -l and see if python is a sym link. If  
so, see where it points and verify it points to python25. Your modules  
are here:

/usr/local/lib/python2.5/site-packages


Verify that the python executable matches.

Darren

On Jun 2, 2010, at 9:38 PM, Superman  wrote:


Thanks for your reply. How do you check env path variables diff
between shell and code
execution?

To my wsgi file, I have this line "#!/usr/local/bin/python" which
tells which interpreter to use. And yes, libxml2.py and libxml2mod.so
files are there in "/usr/local/lib/python2.5/site-packages/" folder.
Also running ldd on libxml2mod.so outputs:

libxml2.so.2 => /usr/local/lib/libxml2.so.2 (0x2b5368ebe000)

Also my python path looks correct. The django shell manages to find
and import the respective modules.

I have a feeling that the solution is quite easy after which I will
hit myself in the head hard! I have been pulling hair over this
problem since days now. Anyone, with any suggestions/info on how they
got their libxml2 module to work, please don't hesitate to reply.

Thanks


On Jun 2, 2:14 pm, Jeliuc Alexandr  wrote:

You should check env path variables diff  between shell and code
execution. Another way check this error path is there libxml2 or not.
it may be in usr/lib/python2.5. or something like that.

On Jun 2, 4:57 pm, Superman  wrote:


I have a django site that is integrated with scrapy, but when the
scrapy code is called from the view, I get this error:



File "/usr/local/lib/python2.5/site-packages/libxml2.py", line 1, in

  import libxml2mod



ImportError: /usr/local/lib/python2.5/site-packages/
libxml2mod.so:
undefined symbol:xmlTextReaderSetup



But using the same python executable file on shell, I can import
libxml2 and libxml2mod fine!



import libxml2mod
import libxml2



Does anyone have an idea why my program is not working from .py file
as import is working perfect from python prompt.


--
You received this message because you are subscribed to the Google  
Groups "Django users" group.

To post to this group, send email to django-us...@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-us...@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: File Upload with Progress Bar

2010-06-03 Thread patrickk
you could use uploadify, see http://www.uploadify.com/.

of course, it´s not an ideal solution since its flash-based.
we´ve been using uploadify with django and the filebrowser for about a
year now and it works quite well.

regards,
patrick


On 3 Jun., 06:32, Venkatraman S  wrote:
> Tell me about it! Its quite insane that there is no single-standard solution
> for this.
> I have been hanging around in #django for sometime and there is still
> opposition to flash based solution. Also, i have not been to get it working
> inspite of it being not an ideal solution.
> I hear that there are some issues with filebrowser since it uses Uploadify.
> Also, i dont see any solution which works in both dev server and also in the
> production using httpd/apache.
>
> Going insane! Let me know if you get anything working.
>
> PS: As i said, html5 is cool and works, but the client does not want to use
> it!
>
> -V-http://twitter.com/venkasub
>
> On Thu, Jun 3, 2010 at 9:54 AM, Brad Pitcher  wrote:
> > Sort of, that's what the default is in the demo, but now I've noticed I
> > have the same problem with apache progress reporting as I did using django
> > progress reporting.  It's behaving like it's not multi-threaded or
> > something.  It seems like I don't get any progress reports until the file
> > has finished uploading.  It's actually driving me a bit crazy so I'm going
> > to have to move on to something else for a while.
>
> > On Wed, Jun 2, 2010 at 9:16 PM, Venkatraman S  wrote:
>
> >> Does this work with the Django development server?
>
> >> On Thu, Jun 3, 2010 at 8:13 AM, Brad Pitcher wrote:
>
> >>> Since I just spent much longer than it should have taken figuring this
> >>> out, I will try and help you out.  I followed the instructions at the
> >>> provided link and it sort of worked.  Not quite as well as I liked.  I
> >>> used Apache for the progress reporting, which the author doesn't
> >>> mention in the article but it is discussed here:
>
> >>>http://piotrsarnacki.com/2008/06/18/upload-progress-bar-with-mod_pass...
> >>> (it involves compiling and installing an apache module).
> >>> The author also doesn't mention changes needed in settings.py:
> >>> from django.conf import global_settings
>
> >>> FILE_UPLOAD_HANDLERS = ('path.to.UploadProgressCachedHandler', ) +
> >>> \    <-- change path here
> >>>    global_settings.FILE_UPLOAD_HANDLERS
>
> >>> If you are using nginx or apache for the server side instead of
> >>> django, you will need to modify progressUrl to point to whatever url
> >>> you set up for accessing progress reports.
>
> >>> If you are looking for a demo, there is one linked in the article
> >>> creecode posted.
> >>> -Brad
>
> >>> On May 30, 12:23 pm, Venkatraman S  wrote:
> >>> > HI creecode,
>
> >>> > Can you share the project please? I can probably work on it and see
> >>> what is
> >>> > happening.
> >>> > Till now, i havent even been able to get this working.
>
> >>> > -V
>
> >>> > On Sun, May 30, 2010 at 10:45 PM, creecode  wrote:
> >>> > > Hello V,
>
> >>> > > On May 29, 11:00 pm, Venkatraman S  wrote:
>
> >>> > > > I have been trying to build a simple file upload with progress bar.
>
> >>> > > AFAIK there isn't a simple solution.  Perhaps this info <
>
> >>>http://www.fairviewcomputing.com/blog/2008/10/21/ajax-upload-progress...
> >>> > > > will point you in the right direction.
>
> >>> > > I've experimented with a solution based tthe above but I wasn't
> >>> > > entirely satisfied with my implementation.  I'm having a problem with
> >>> > > the progress bar not reaching 100% many times and some problems with
> >>> > > the percentage complete number.
>
> >>> > > I've put my project on the back burner for now but if anyone has any
> >>> > > examples they'd like to share I'd be interested in seeing them.
>
> >>> > > Toodle-looo...
> >>> > > 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-us...@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-us...@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-us...@googlegroups.com.
> >> To unsubscribe from this group, send email to
> >> django-users+unsubscr...@googlegroups.com
> >

Re: Unable to import libxml2mod from the python script

2010-06-03 Thread Jeliuc Alexandr
You can use ipython or simple idle to see it
/usr/local/lib/python2.5.
but
/bin/python

are you sure about default version?

On Jun 3, 3:06 pm, Darren  wrote:
> Go to  /usr/local/bin and do ls -l and see if python is a sym link. If  
> so, see where it points and verify it points to python25. Your modules  
> are here:
>
> > /usr/local/lib/python2.5/site-packages
>
> Verify that the python executable matches.
>
> Darren
>
> On Jun 2, 2010, at 9:38 PM, Superman  wrote:
>
>
>
> > Thanks for your reply. How do you check env path variables diff
> > between shell and code
> > execution?
>
> > To my wsgi file, I have this line "#!/usr/local/bin/python" which
> > tells which interpreter to use. And yes, libxml2.py and libxml2mod.so
> > files are there in "/usr/local/lib/python2.5/site-packages/" folder.
> > Also running ldd on libxml2mod.so outputs:
>
> > libxml2.so.2 => /usr/local/lib/libxml2.so.2 (0x2b5368ebe000)
>
> > Also my python path looks correct. The django shell manages to find
> > and import the respective modules.
>
> > I have a feeling that the solution is quite easy after which I will
> > hit myself in the head hard! I have been pulling hair over this
> > problem since days now. Anyone, with any suggestions/info on how they
> > got their libxml2 module to work, please don't hesitate to reply.
>
> > Thanks
>
> > On Jun 2, 2:14 pm, Jeliuc Alexandr  wrote:
> >> You should check env path variables diff  between shell and code
> >> execution. Another way check this error path is there libxml2 or not.
> >> it may be in usr/lib/python2.5. or something like that.
>
> >> On Jun 2, 4:57 pm, Superman  wrote:
>
> >>> I have a django site that is integrated with scrapy, but when the
> >>> scrapy code is called from the view, I get this error:
>
> >>> File "/usr/local/lib/python2.5/site-packages/libxml2.py", line 1, in
> >>> 
> >>>   import libxml2mod
>
> >>>     ImportError: /usr/local/lib/python2.5/site-packages/
> >>> libxml2mod.so:
> >>>     undefined symbol:xmlTextReaderSetup
>
> >>> But using the same python executable file on shell, I can import
> >>> libxml2 and libxml2mod fine!
>
> >> import libxml2mod
> >> import libxml2
>
> >>> Does anyone have an idea why my program is not working from .py file
> >>> as import is working perfect from python prompt.
>
> > --
> > You received this message because you are subscribed to the Google  
> > Groups "Django users" group.
> > To post to this group, send email to django-us...@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-us...@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: Re: utf8-problems

2010-06-03 Thread Henrik Genssen
>I would also check character sets in "show create table" in both environments.
output of both create table statements are equal
both are tables are utf-8, collatetion utf8_general_ci

>show variables like 'character_set_%'
on my dev-system:
character_set_database => latin1

on production:
character_set_database => utf-8


my testsystem is the one that works. 
Does the above have any influence on my requests, as both tables are utf-8? 
Can I fix it using a config entry in django?


regards

Henrik

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: ImportError: No module named django.core

2010-06-03 Thread illuminated
Hi Nuno,

Thanks for helping, but it turned out it has nothing to do with the
PYTHONPATH but with access rights of the /usr/local and /usr/local/lib
(http://blog.petrovic.gr/lang/en-us/2010/05/importerror-no-module-
named-django-core/)


Thanks,

On May 31, 11:55 am, Nuno Maltez  wrote:
> Well, it seems that your python lib is at /usr/lib/python2.6/dist-packages:
>
> > mx:~/webapps$ python -c "from distutils.sysconfig import
> > get_python_lib; print get_python_lib()"
>
> > /usr/lib/python2.6/dist-packages
>
> but django is in "local" - /usr/local/lib/python2.6/dist-packages
>
> > /usr/local/lib/python2.6/dist-packages/django/bin/django-admin.py
>
> So have you tried adding /usr/local/lib/python2.6/dist-packages/
> (directory that holds the django module) to your pythonpath?
>
> Nuno

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: Google maps like app for Django for small area?

2010-06-03 Thread Stodge
Thanks. I already know about geodjango but that's not the whole
solution from my understanding. Though searching again for geodjango I
eventually found MapServer, TileCache and OpenLayers. I *think* this
might be what I'm looking for.

On Jun 2, 9:54 pm, Sam Walters  wrote:
> http://geodjango.org/
>
>
>
> On Thu, Jun 3, 2010 at 11:35 AM, Stodge  wrote:
> > Is there a Django app (or SDK/API/technology/etc) that can recreate
> > Google maps for a small area (say 60 square miles) with all maps
> > stored locally on the server? 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-us...@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-us...@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.



Changing AdminSite object

2010-06-03 Thread Mohammad Tayseer
Hello Djangonauts,

I want to change the app index page so I add help text to the models 
themselves, e.g. under each model I want to add help text. I know that I should 
override AdminSite.app_index. What is the best way to do this?
 Mohammad Tayseer
http://mtayseer.net



  

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: File Upload with Progress Bar

2010-06-03 Thread Venkatraman S
Hi Patrick,

Can you share a simple django app which uses Uploadify?  Did you use vanilla
Uploadify or django-uploadify(github.com/tstone/django-uploadify*)*?
I have been simply unable to make it run.  I also tried a django-uploadify,
but no results! Frustrating it is.

If you can share the code, i would rather use it along with some other
experiments that I have been doing and publish it in the public domain.

Regards.

On Thu, Jun 3, 2010 at 5:39 PM, patrickk  wrote:

> you could use uploadify, see http://www.uploadify.com/.
>
> of course, it´s not an ideal solution since its flash-based.
> we´ve been using uploadify with django and the filebrowser for about a
> year now and it works quite well.
>
> regards,
> patrick
>
>
> On 3 Jun., 06:32, Venkatraman S  wrote:
> > Tell me about it! Its quite insane that there is no single-standard
> solution
> > for this.
> > I have been hanging around in #django for sometime and there is still
> > opposition to flash based solution. Also, i have not been to get it
> working
> > inspite of it being not an ideal solution.
> > I hear that there are some issues with filebrowser since it uses
> Uploadify.
> > Also, i dont see any solution which works in both dev server and also in
> the
> > production using httpd/apache.
> >
> > Going insane! Let me know if you get anything working.
> >
> > PS: As i said, html5 is cool and works, but the client does not want to
> use
> > it!
> >
> > -V-http://twitter.com/venkasub
> >
> > On Thu, Jun 3, 2010 at 9:54 AM, Brad Pitcher 
> wrote:
> > > Sort of, that's what the default is in the demo, but now I've noticed I
> > > have the same problem with apache progress reporting as I did using
> django
> > > progress reporting.  It's behaving like it's not multi-threaded or
> > > something.  It seems like I don't get any progress reports until the
> file
> > > has finished uploading.  It's actually driving me a bit crazy so I'm
> going
> > > to have to move on to something else for a while.
> >
> > > On Wed, Jun 2, 2010 at 9:16 PM, Venkatraman S 
> wrote:
> >
> > >> Does this work with the Django development server?
> >
> > >> On Thu, Jun 3, 2010 at 8:13 AM, Brad Pitcher  >wrote:
> >
> > >>> Since I just spent much longer than it should have taken figuring
> this
> > >>> out, I will try and help you out.  I followed the instructions at the
> > >>> provided link and it sort of worked.  Not quite as well as I liked.
>  I
> > >>> used Apache for the progress reporting, which the author doesn't
> > >>> mention in the article but it is discussed here:
> >
> > >>>
> http://piotrsarnacki.com/2008/06/18/upload-progress-bar-with-mod_pass...
> > >>> (it involves compiling and installing an apache module).
> > >>> The author also doesn't mention changes needed in settings.py:
> > >>> from django.conf import global_settings
> >
> > >>> FILE_UPLOAD_HANDLERS = ('path.to.UploadProgressCachedHandler', ) +
> > >>> \<-- change path here
> > >>>global_settings.FILE_UPLOAD_HANDLERS
> >
> > >>> If you are using nginx or apache for the server side instead of
> > >>> django, you will need to modify progressUrl to point to whatever url
> > >>> you set up for accessing progress reports.
> >
> > >>> If you are looking for a demo, there is one linked in the article
> > >>> creecode posted.
> > >>> -Brad
> >
> > >>> On May 30, 12:23 pm, Venkatraman S  wrote:
> > >>> > HI creecode,
> >
> > >>> > Can you share the project please? I can probably work on it and see
> > >>> what is
> > >>> > happening.
> > >>> > Till now, i havent even been able to get this working.
> >
> > >>> > -V
> >
> > >>> > On Sun, May 30, 2010 at 10:45 PM, creecode 
> wrote:
> > >>> > > Hello V,
> >
> > >>> > > On May 29, 11:00 pm, Venkatraman S  wrote:
> >
> > >>> > > > I have been trying to build a simple file upload with progress
> bar.
> >
> > >>> > > AFAIK there isn't a simple solution.  Perhaps this info <
> >
> > >>>
> http://www.fairviewcomputing.com/blog/2008/10/21/ajax-upload-progress...
> > >>> > > > will point you in the right direction.
> >
> > >>> > > I've experimented with a solution based tthe above but I wasn't
> > >>> > > entirely satisfied with my implementation.  I'm having a problem
> with
> > >>> > > the progress bar not reaching 100% many times and some problems
> with
> > >>> > > the percentage complete number.
> >
> > >>> > > I've put my project on the back burner for now but if anyone has
> any
> > >>> > > examples they'd like to share I'd be interested in seeing them.
> >
> > >>> > > Toodle-looo...
> > >>> > > 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-us...@googlegroups.com.
> > >>> > > To unsubscribe from this group, send email to
> > >>> > > django-users+unsubscr...@googlegroups.com
> 
> >
> > >>> 
> 
> >
> >
> > >>> > > .
> > >>> > > For more options, visit this group at
> > >

Filtering

2010-06-03 Thread Mat
Okay so I am trying to figure out how to do the following. I have some
data in a table that users don't need to see but they need to see
other data in the same table. So I am trying to figure out if there is
any way to do a "global" filter so i don't have to do an exclude on
every query of that table. Is there a way to do this?

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: Filtering

2010-06-03 Thread Daniel Roseman
On Jun 3, 3:17 pm, Mat  wrote:
> Okay so I am trying to figure out how to do the following. I have some
> data in a table that users don't need to see but they need to see
> other data in the same table. So I am trying to figure out if there is
> any way to do a "global" filter so i don't have to do an exclude on
> every query of that table. Is there a way to do this?

Define a custom manager.
http://docs.djangoproject.com/en/1.2/topics/db/managers/
--
DR.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: File Upload with Progress Bar

2010-06-03 Thread patrickk
http://code.google.com/p/django-filebrowser/

cheers,
patrick

On 3 Jun., 16:10, Venkatraman S  wrote:
> Hi Patrick,
>
> Can you share a simple django app which uses Uploadify?  Did you use vanilla
> Uploadify or django-uploadify(github.com/tstone/django-uploadify*)*?
> I have been simply unable to make it run.  I also tried a django-uploadify,
> but no results! Frustrating it is.
>
> If you can share the code, i would rather use it along with some other
> experiments that I have been doing and publish it in the public domain.
>
> Regards.
>
> On Thu, Jun 3, 2010 at 5:39 PM, patrickk  wrote:
> > you could use uploadify, seehttp://www.uploadify.com/.
>
> > of course, it´s not an ideal solution since its flash-based.
> > we´ve been using uploadify with django and the filebrowser for about a
> > year now and it works quite well.
>
> > regards,
> > patrick
>
> > On 3 Jun., 06:32, Venkatraman S  wrote:
> > > Tell me about it! Its quite insane that there is no single-standard
> > solution
> > > for this.
> > > I have been hanging around in #django for sometime and there is still
> > > opposition to flash based solution. Also, i have not been to get it
> > working
> > > inspite of it being not an ideal solution.
> > > I hear that there are some issues with filebrowser since it uses
> > Uploadify.
> > > Also, i dont see any solution which works in both dev server and also in
> > the
> > > production using httpd/apache.
>
> > > Going insane! Let me know if you get anything working.
>
> > > PS: As i said, html5 is cool and works, but the client does not want to
> > use
> > > it!
>
> > > -V-http://twitter.com/venkasub
>
> > > On Thu, Jun 3, 2010 at 9:54 AM, Brad Pitcher 
> > wrote:
> > > > Sort of, that's what the default is in the demo, but now I've noticed I
> > > > have the same problem with apache progress reporting as I did using
> > django
> > > > progress reporting.  It's behaving like it's not multi-threaded or
> > > > something.  It seems like I don't get any progress reports until the
> > file
> > > > has finished uploading.  It's actually driving me a bit crazy so I'm
> > going
> > > > to have to move on to something else for a while.
>
> > > > On Wed, Jun 2, 2010 at 9:16 PM, Venkatraman S 
> > wrote:
>
> > > >> Does this work with the Django development server?
>
> > > >> On Thu, Jun 3, 2010 at 8:13 AM, Brad Pitcher  > >wrote:
>
> > > >>> Since I just spent much longer than it should have taken figuring
> > this
> > > >>> out, I will try and help you out.  I followed the instructions at the
> > > >>> provided link and it sort of worked.  Not quite as well as I liked.
> >  I
> > > >>> used Apache for the progress reporting, which the author doesn't
> > > >>> mention in the article but it is discussed here:
>
> >http://piotrsarnacki.com/2008/06/18/upload-progress-bar-with-mod_pass...
> > > >>> (it involves compiling and installing an apache module).
> > > >>> The author also doesn't mention changes needed in settings.py:
> > > >>> from django.conf import global_settings
>
> > > >>> FILE_UPLOAD_HANDLERS = ('path.to.UploadProgressCachedHandler', ) +
> > > >>> \    <-- change path here
> > > >>>    global_settings.FILE_UPLOAD_HANDLERS
>
> > > >>> If you are using nginx or apache for the server side instead of
> > > >>> django, you will need to modify progressUrl to point to whatever url
> > > >>> you set up for accessing progress reports.
>
> > > >>> If you are looking for a demo, there is one linked in the article
> > > >>> creecode posted.
> > > >>> -Brad
>
> > > >>> On May 30, 12:23 pm, Venkatraman S  wrote:
> > > >>> > HI creecode,
>
> > > >>> > Can you share the project please? I can probably work on it and see
> > > >>> what is
> > > >>> > happening.
> > > >>> > Till now, i havent even been able to get this working.
>
> > > >>> > -V
>
> > > >>> > On Sun, May 30, 2010 at 10:45 PM, creecode 
> > wrote:
> > > >>> > > Hello V,
>
> > > >>> > > On May 29, 11:00 pm, Venkatraman S  wrote:
>
> > > >>> > > > I have been trying to build a simple file upload with progress
> > bar.
>
> > > >>> > > AFAIK there isn't a simple solution.  Perhaps this info <
>
> >http://www.fairviewcomputing.com/blog/2008/10/21/ajax-upload-progress...
> > > >>> > > > will point you in the right direction.
>
> > > >>> > > I've experimented with a solution based tthe above but I wasn't
> > > >>> > > entirely satisfied with my implementation.  I'm having a problem
> > with
> > > >>> > > the progress bar not reaching 100% many times and some problems
> > with
> > > >>> > > the percentage complete number.
>
> > > >>> > > I've put my project on the back burner for now but if anyone has
> > any
> > > >>> > > examples they'd like to share I'd be interested in seeing them.
>
> > > >>> > > Toodle-looo...
> > > >>> > > creecode
>
> > > >>> > > --
> > > >>> > > You received this message because you are subscribed to the
> > Google
> > > >>> Groups
> > > >>> > > "Django users" group.
> > > >>> > > To post to this group, send email to

Something like admin.StackedInline where 'extra'

2010-06-03 Thread jeremy07
Hi, I have a simple booking app where first form gets number of
travelers. Based on that number I need to generate another form with
number of rows equal to entered number of travelers to get their
names.  Something like admin.StackedInline where 'extra' would be a
number of travelers. Any idea?

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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.



form.as_p, as_table variation

2010-06-03 Thread Thomas Allen
How can I create my own form renderer, like as_p, as_table, etc? I see
that the form class provides _html_output to assist in formatting
markup like this, but that substitution technique does not provide
enough control for what I am doing, where certain properties of the
field in question affect the ordering of elements and not just the
value of element attributes or content.

I am tempted to write a template tag that renders a form to my
standards, but unfortunately _html_output handles a lot more than just
formatting a template string, so I think that I would have to maintain
a copy of a good bit of _html_output's logic in such a template tag.

Thomas

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: File Upload with Progress Bar

2010-06-03 Thread Venkatraman S
Oh yes! I was referring to a stand alone app. I heard someone complain
#django that filebrowser aint working right after uploadify was introduced.
Is that True?

On Thu, Jun 3, 2010 at 8:11 PM, patrickk  wrote:

> http://code.google.com/p/django-filebrowser/
>
> cheers,
> patrick
>
> On 3 Jun., 16:10, Venkatraman S  wrote:
> > Hi Patrick,
> >
> > Can you share a simple django app which uses Uploadify?  Did you use
> vanilla
> > Uploadify or 
> > django-uploadify(github.com/tstone/django-uploadify*)*
> ?
> > I have been simply unable to make it run.  I also tried a
> django-uploadify,
> > but no results! Frustrating it is.
> >
> > If you can share the code, i would rather use it along with some other
> > experiments that I have been doing and publish it in the public domain.
> >
> > Regards.
> >
> > On Thu, Jun 3, 2010 at 5:39 PM, patrickk  wrote:
> > > you could use uploadify, seehttp://www.uploadify.com/.
> >
> > > of course, it´s not an ideal solution since its flash-based.
> > > we´ve been using uploadify with django and the filebrowser for about a
> > > year now and it works quite well.
> >
> > > regards,
> > > patrick
> >
> > > On 3 Jun., 06:32, Venkatraman S  wrote:
> > > > Tell me about it! Its quite insane that there is no single-standard
> > > solution
> > > > for this.
> > > > I have been hanging around in #django for sometime and there is still
> > > > opposition to flash based solution. Also, i have not been to get it
> > > working
> > > > inspite of it being not an ideal solution.
> > > > I hear that there are some issues with filebrowser since it uses
> > > Uploadify.
> > > > Also, i dont see any solution which works in both dev server and also
> in
> > > the
> > > > production using httpd/apache.
> >
> > > > Going insane! Let me know if you get anything working.
> >
> > > > PS: As i said, html5 is cool and works, but the client does not want
> to
> > > use
> > > > it!
> >
> > > > -V-http://twitter.com/venkasub
> >
> > > > On Thu, Jun 3, 2010 at 9:54 AM, Brad Pitcher 
> > > wrote:
> > > > > Sort of, that's what the default is in the demo, but now I've
> noticed I
> > > > > have the same problem with apache progress reporting as I did using
> > > django
> > > > > progress reporting.  It's behaving like it's not multi-threaded or
> > > > > something.  It seems like I don't get any progress reports until
> the
> > > file
> > > > > has finished uploading.  It's actually driving me a bit crazy so
> I'm
> > > going
> > > > > to have to move on to something else for a while.
> >
> > > > > On Wed, Jun 2, 2010 at 9:16 PM, Venkatraman S 
> > > wrote:
> >
> > > > >> Does this work with the Django development server?
> >
> > > > >> On Thu, Jun 3, 2010 at 8:13 AM, Brad Pitcher <
> bradpitc...@gmail.com
> > > >wrote:
> >
> > > > >>> Since I just spent much longer than it should have taken figuring
> > > this
> > > > >>> out, I will try and help you out.  I followed the instructions at
> the
> > > > >>> provided link and it sort of worked.  Not quite as well as I
> liked.
> > >  I
> > > > >>> used Apache for the progress reporting, which the author doesn't
> > > > >>> mention in the article but it is discussed here:
> >
> > >http://piotrsarnacki.com/2008/06/18/upload-progress-bar-with-mod_pass.
> ..
> > > > >>> (it involves compiling and installing an apache module).
> > > > >>> The author also doesn't mention changes needed in settings.py:
> > > > >>> from django.conf import global_settings
> >
> > > > >>> FILE_UPLOAD_HANDLERS = ('path.to.UploadProgressCachedHandler', )
> +
> > > > >>> \<-- change path here
> > > > >>>global_settings.FILE_UPLOAD_HANDLERS
> >
> > > > >>> If you are using nginx or apache for the server side instead of
> > > > >>> django, you will need to modify progressUrl to point to whatever
> url
> > > > >>> you set up for accessing progress reports.
> >
> > > > >>> If you are looking for a demo, there is one linked in the article
> > > > >>> creecode posted.
> > > > >>> -Brad
> >
> > > > >>> On May 30, 12:23 pm, Venkatraman S  wrote:
> > > > >>> > HI creecode,
> >
> > > > >>> > Can you share the project please? I can probably work on it and
> see
> > > > >>> what is
> > > > >>> > happening.
> > > > >>> > Till now, i havent even been able to get this working.
> >
> > > > >>> > -V
> >
> > > > >>> > On Sun, May 30, 2010 at 10:45 PM, creecode  >
> > > wrote:
> > > > >>> > > Hello V,
> >
> > > > >>> > > On May 29, 11:00 pm, Venkatraman S 
> wrote:
> >
> > > > >>> > > > I have been trying to build a simple file upload with
> progress
> > > bar.
> >
> > > > >>> > > AFAIK there isn't a simple solution.  Perhaps this info <
> >
> > >http://www.fairviewcomputing.com/blog/2008/10/21/ajax-upload-progress.
> ..
> > > > >>> > > > will point you in the right direction.
> >
> > > > >>> > > I've experimented with a solution based tthe above but I
> wasn't
> > > > >>> > > entirely satisfied with my implementation.  I'm having a
> problem
> > > with
>

Re: form.as_p, as_table variation

2010-06-03 Thread Bill Freeman
If you can't use _html_output, then you have to duplicate a lot of
it's functionality.

That's a lot internals, and you would have to track any changes with
revisions.  Of
course, _html_output is, itself, an internal, according to the naming
conventions.

If what you're wanting to do is change the rendering order, not that your form's
self.fields (for model forms, anyway) is a deep copy of the form field set, plus
any explicit form fields that you added, in an ordered dict.  Since
you're not sharing
that dict, you can change the keyOrder list.  (You can probably even elide fieds
this way.)  The superclass __init__() has to have run, since it's what does the
deepcopy, but you can monkey in your __init__() after calling the
superclass method.
Strictly speaking, that's monkeying with internals too, but I know of
no other way to
have different render orders for different model forms on the same
model (I make it
match the fields set from the Meta class in my application).

Bill

On Thu, Jun 3, 2010 at 11:05 AM, Thomas Allen  wrote:
> How can I create my own form renderer, like as_p, as_table, etc? I see
> that the form class provides _html_output to assist in formatting
> markup like this, but that substitution technique does not provide
> enough control for what I am doing, where certain properties of the
> field in question affect the ordering of elements and not just the
> value of element attributes or content.
>
> I am tempted to write a template tag that renders a form to my
> standards, but unfortunately _html_output handles a lot more than just
> formatting a template string, so I think that I would have to maintain
> a copy of a good bit of _html_output's logic in such a template tag.
>
> Thomas
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To post to this group, send email to django-us...@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-us...@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: form.as_p, as_table variation

2010-06-03 Thread Thomas Allen
On Jun 3, 12:00 pm, Bill Freeman  wrote:
> If you can't use _html_output, then you have to duplicate a lot of
> it's functionality.

I'm able to get pretty far with the template tag approach. The trouble
is that BoundForms offer no way to directly add attributes, which I
think can only be included when defining the form field in question.

# from ... import format as form_format

@register.simple_tag
def format_form(form):
  html = ''

  field_maps = {
forms.CharField: form_format.text,
forms.ChoiceField: form_format.select
  }

  for name, field in form.fields.items():
for cls, handler in field_maps.items():
  if isinstance(field, cls):
html += handler(name, forms.forms.BoundField(form, field,
name))
  return html

# in format.py
def flatten(items):
  return ''.join(items)

def wrapper(name, field, type, wrapped):
  return '%s' % (type, flatten(wrapped))

def label(name, field):
  # First bit of duplication
  if not field.label.endswith(':'):
field.label += ':'
  return field.label_tag()

def text(name, field):
  return wrapper(name, field, 'text', (
label(name, field),
unicode(field)
  ))

def select(name, field):
  return wrapper(name, field, 'select', (
label(name, field),
unicode(field)
  ))

Thomas

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: form.as_p, as_table variation

2010-06-03 Thread Thomas Allen
On Jun 3, 12:05 pm, Thomas Allen  wrote:
> I'm able to get pretty far with the template tag approach. The trouble
> is that BoundForms offer no way to directly add attributes, which I
> think can only be included when defining the form field in question.

Actually if I bypass unicode() and use as_widget directly, I can
provide attrs.

Thomas

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: utf8-problems

2010-06-03 Thread Dmitry Dulepov
Hi!

Henrik Genssen wrote:
> on my dev-system:
> character_set_database => latin1
> 
> on production:
> character_set_database => utf-8
> 
> my testsystem is the one that works. 
> Does the above have any influence on my requests, as both tables are utf-8?

It shouldn't if your database has a proper character set. What does "show
database DBNAME" gives you in both cases? Possibly database on the
production server was created with a different character set. Table
character set and database character set are different things. There are
many of these character sets in MySQL and conversion to each of them
happens at certain points at a time during processing.

> Can I fix it using a config entry in django?

I don't think you can fix it with a setting but I can be mistaken here. The
best is to use the same settings for all hosts. I keep everything in utf8.

-- 
Dmitry Dulepov
Twitter: http://twitter.com/dmitryd/
Web: http://dmitry-dulepov.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-us...@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: Filtering

2010-06-03 Thread Dmitry Dulepov
Hi!

Mat wrote:
> Okay so I am trying to figure out how to do the following. I have some
> data in a table that users don't need to see but they need to see
> other data in the same table. So I am trying to figure out if there is
> any way to do a "global" filter so i don't have to do an exclude on
> every query of that table. Is there a way to do this?

Make your own manager and assign it to "objects". In that manager apply all
necessary filters. Here is an example from my models:

class TYPO3UserManager(models.Manager):
'''A special model manager that returns only available users'''
def get_query_set(self):
query_set = super(TYPO3UserManager, self).get_query_set()
return query_set.exclude(models.Q(disabled = 1) | models.Q(deleted
= 1))

class TYPO3User
...
objects = TYPO3UserManager()


-- 
Dmitry Dulepov
Twitter: http://twitter.com/dmitryd/
Web: http://dmitry-dulepov.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-us...@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.



this field is required

2010-06-03 Thread luca72
hello at all.
during the renderig of a form in any required field is write "this
field is required", how i can overwrite this or delete it.

Thanks
Luca

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: form.as_p, as_table variation

2010-06-03 Thread Bill Freeman
Actually, you might try adding them in your form's __init__ method,
again, after calling
the superclass method.   I've done this with choices on a field.
Since self.fields is a
deep copy, you might be safe setting an attrs attribute on the field's widget:
   self.fields['fieldname'].widget.attrs.update(extra_attrs)
or some such.

On Thu, Jun 3, 2010 at 12:08 PM, Thomas Allen  wrote:
> On Jun 3, 12:05 pm, Thomas Allen  wrote:
>> I'm able to get pretty far with the template tag approach. The trouble
>> is that BoundForms offer no way to directly add attributes, which I
>> think can only be included when defining the form field in question.
>
> Actually if I bypass unicode() and use as_widget directly, I can
> provide attrs.
>
> Thomas
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To post to this group, send email to django-us...@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-us...@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: utf8-problems

2010-06-03 Thread kirian
just guessing.. are you developing on a windows machine and your
encoding problems occure on a linux machine?
did you tried the smart_str and smart_unicode functions!? these solved
all my encoding problems..

from django.utils.encoding import smart_str, smart_unicode

On 3 Jun., 11:18, "Henrik Genssen"  wrote:
> Hi,
>
> I do have utf-8 problems again.
> My dev-system works, my stage system works, too - but production does not. 
> And I do not see the error :-(
> As I think, it is a misconfiguration problem, do we have a checklist, what 
> and where to search for or test?
> I have seen utf problems several times on the list - maybe such a checklist 
> could help others, too?
>
> My problem is searching data with german umlaute using mysql backend - 
> something like 'f r' ('for' in english)
>
> regards
>
> Henrik

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: File Upload with Progress Bar

2010-06-03 Thread Brad Pitcher
Whoops!  Just read that the django dev server is not multithreaded so
it will not work.  But you should be able to use any web server along
with an upload_progress view as long as your web server streams the
upload in progress to django.  I think my troubles may be because the
web server isn't streaming the file upload to django, I'm currently
investigating that.

On Jun 2, 9:24 pm, Brad Pitcher  wrote:
> Sort of, that's what the default is in the demo, but now I've noticed I have
> the same problem with apache progress reporting as I did using django
> progress reporting.  It's behaving like it's not multi-threaded or
> something.  It seems like I don't get any progress reports until the file
> has finished uploading.  It's actually driving me a bit crazy so I'm going
> to have to move on to something else for a while.
>
> On Wed, Jun 2, 2010 at 9:16 PM, Venkatraman S  wrote:
> > Does this work with the Django development server?
>
> > On Thu, Jun 3, 2010 at 8:13 AM, Brad Pitcher wrote:
>
> >> Since I just spent much longer than it should have taken figuring this
> >> out, I will try and help you out.  I followed the instructions at the
> >> provided link and it sort of worked.  Not quite as well as I liked.  I
> >> used Apache for the progress reporting, which the author doesn't
> >> mention in the article but it is discussed here:
>
> >>http://piotrsarnacki.com/2008/06/18/upload-progress-bar-with-mod_pass...
> >> (it involves compiling and installing an apache module).
> >> The author also doesn't mention changes needed in settings.py:
> >> from django.conf import global_settings
>
> >> FILE_UPLOAD_HANDLERS = ('path.to.UploadProgressCachedHandler', ) +
> >> \    <-- change path here
> >>    global_settings.FILE_UPLOAD_HANDLERS
>
> >> If you are using nginx or apache for the server side instead of
> >> django, you will need to modify progressUrl to point to whatever url
> >> you set up for accessing progress reports.
>
> >> If you are looking for a demo, there is one linked in the article
> >> creecode posted.
> >> -Brad
>
> >> On May 30, 12:23 pm, Venkatraman S  wrote:
> >> > HI creecode,
>
> >> > Can you share the project please? I can probably work on it and see what
> >> is
> >> > happening.
> >> > Till now, i havent even been able to get this working.
>
> >> > -V
>
> >> > On Sun, May 30, 2010 at 10:45 PM, creecode  wrote:
> >> > > Hello V,
>
> >> > > On May 29, 11:00 pm, Venkatraman S  wrote:
>
> >> > > > I have been trying to build a simple file upload with progress bar.
>
> >> > > AFAIK there isn't a simple solution.  Perhaps this info <
>
> >> > >http://www.fairviewcomputing.com/blog/2008/10/21/ajax-upload-progress.
> >> ..
> >> > > > will point you in the right direction.
>
> >> > > I've experimented with a solution based tthe above but I wasn't
> >> > > entirely satisfied with my implementation.  I'm having a problem with
> >> > > the progress bar not reaching 100% many times and some problems with
> >> > > the percentage complete number.
>
> >> > > I've put my project on the back burner for now but if anyone has any
> >> > > examples they'd like to share I'd be interested in seeing them.
>
> >> > > Toodle-looo...
> >> > > 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-us...@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-us...@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-us...@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-us...@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.



Postgres's website to migrate to Django

2010-06-03 Thread Masklinn
http://seeknuance.com/2010/06/03/postgres-site-will-migrate-to-django/

During PostgreSQL BOF at OpenSourceBridge, Josh Berkus announced the site was 
going to be migrated to Django (from what is currently a mishmash of PHP 
scripts).

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: Model Issue - wont let me name it follower or followee

2010-06-03 Thread Frank Wiles
On Wed, Jun 2, 2010 at 10:36 PM, joelklabo  wrote:
> http://dpaste.org/JjE4/

This should fix it up for you:

class Follow(models.Model):
 follower = models.ForeignKey(User, related_name='following')
 followee = models.ForeignKey(User, related_name='followers')

What I used for the related name on these isn't important, just the
fact that I'm using it.  The problem here is that the ORM is trying to
setup two different 'follow_set' relationships (on the Follow model)
and it won't sort it out for you.  You HAVE to supply a related_name
anytime you have two ForeignKeys to the same model.

Hope that helps!

-- 
Frank Wiles
Revolution Systems | http://www.revsys.com/
fr...@revsys.com   | (800) 647-6298

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: Something like admin.StackedInline where 'extra'

2010-06-03 Thread Frank Wiles
On Thu, Jun 3, 2010 at 9:56 AM, jeremy07  wrote:
> Hi, I have a simple booking app where first form gets number of
> travelers. Based on that number I need to generate another form with
> number of rows equal to entered number of travelers to get their
> names.  Something like admin.StackedInline where 'extra' would be a
> number of travelers. Any idea?

Look into inline formsets:

http://docs.djangoproject.com/en/dev/topics/forms/modelforms/#inline-formsets

This is what you're wanting.

-- 
Frank Wiles
Revolution Systems | http://www.revsys.com/
fr...@revsys.com   | (800) 647-6298

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: this field is required

2010-06-03 Thread bastir
Hey Luca,
i think u can give every formfield a dict of error messages like this:
forms.InputField(error_messages={'required':u'your MSG'})
Hope this helps
Sebastian

On 3 Jun., 18:34, luca72  wrote:
> hello at all.
> during the renderig of a form in any required field is write "this
> field is required", how i can overwrite this or delete it.
>
> Thanks
> Luca

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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.



Error with dumpdata: User matching query does not exist.

2010-06-03 Thread bastir
Hey,
i'm suddenly getting an error with dumpdata:
django.contrib.auth.models.DoesNotExist: User matching query does not
exist.
What's wrong here. I did not change anything (especiallyin the User
model)
Thx,
Sebastian

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: Error with dumpdata: User matching query does not exist.

2010-06-03 Thread Lee Hinde
On Thu, Jun 3, 2010 at 12:36 PM, bastir  wrote:
> Hey,
> i'm suddenly getting an error with dumpdata:
> django.contrib.auth.models.DoesNotExist: User matching query does not
> exist.
> What's wrong here. I did not change anything (especiallyin the User
> model)
> Thx,
> Sebastian

I just ran into that and, in my case, it was due to an orphaned
record.  Don't look at the user table, look at a table that links to
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-us...@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 sessions issue

2010-06-03 Thread aa56280
Django's docs say: "When a user logs in, Django adds a row to the
django_session database table. Django updates this row each time the
session data changes. If the user logs out manually, Django deletes
the row. But if the user does not log out, the row never gets
deleted."

I'm logging out of my app but I notice that the row DOES NOT get
deleted. Is there something I'm missing here?

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: Error with dumpdata: User matching query does not exist.

2010-06-03 Thread bastir
thx 4 your answer. If there is a foreign user key that links to a user
that does not exist is this the problem? Because I'm pretty sure that
is not the case in my db. I only have one foreign user key in one
table. And this table only has one entry at the moment.
But i will look at my data again.  any other hints how to fix this.
thx a lot
Sebastian



On 3 Jun., 21:41, Lee Hinde  wrote:
> On Thu, Jun 3, 2010 at 12:36 PM, bastir  wrote:
> > Hey,
> > i'm suddenly getting an error with dumpdata:
> > django.contrib.auth.models.DoesNotExist: User matching query does not
> > exist.
> > What's wrong here. I did not change anything (especiallyin the User
> > model)
> > Thx,
> > Sebastian
>
> I just ran into that and, in my case, it was due to an orphaned
> record.  Don't look at the user table, look at a table that links to
> 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-us...@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: Error with dumpdata: User matching query does not exist.

2010-06-03 Thread bastir
okay, found the problem. It is not allowed that there are zero valued
foreign keys.

On 3 Jun., 22:36, bastir  wrote:
> thx 4 your answer. If there is a foreign user key that links to a user
> that does not exist is this the problem? Because I'm pretty sure that
> is not the case in my db. I only have one foreign user key in one
> table. And this table only has one entry at the moment.
> But i will look at my data again.  any other hints how to fix this.
> thx a lot
> Sebastian
>
> On 3 Jun., 21:41, Lee Hinde  wrote:
>
> > On Thu, Jun 3, 2010 at 12:36 PM, bastir  wrote:
> > > Hey,
> > > i'm suddenly getting an error with dumpdata:
> > > django.contrib.auth.models.DoesNotExist: User matching query does not
> > > exist.
> > > What's wrong here. I did not change anything (especiallyin the User
> > > model)
> > > Thx,
> > > Sebastian
>
> > I just ran into that and, in my case, it was due to an orphaned
> > record.  Don't look at the user table, look at a table that links to
> > 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-us...@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: File Upload with Progress Bar

2010-06-03 Thread Brad Pitcher
Some versions of flash have a bug that causes the entire browser to
freeze while uploading.  I am afflicted by the bug, running Flash 10.0
r45 on Ubuntu 10.04.  It seems that there is no good solution at the
moment.  My host is Webfaction and I just discovered that they have a
non-configurable nginx server in front of everything that caches
uploads before sending them on to apache/django making it impossible
to do upload progress bars at the moment.  They are aware of the
problem, but who knows when it will be fixed.

On Jun 3, 8:31 am, Venkatraman S  wrote:
> Oh yes! I was referring to a stand alone app. I heard someone complain
> #django that filebrowser aint working right after uploadify was introduced.
> Is that True?
>
> On Thu, Jun 3, 2010 at 8:11 PM, patrickk  wrote:
> >http://code.google.com/p/django-filebrowser/
>
> > cheers,
> > patrick
>
> > On 3 Jun., 16:10, Venkatraman S  wrote:
> > > Hi Patrick,
>
> > > Can you share a simple django app which uses Uploadify?  Did you use
> > vanilla
> > > Uploadify or 
> > > django-uploadify(github.com/tstone/django-uploadify*)*
> > ?
> > > I have been simply unable to make it run.  I also tried a
> > django-uploadify,
> > > but no results! Frustrating it is.
>
> > > If you can share the code, i would rather use it along with some other
> > > experiments that I have been doing and publish it in the public domain.
>
> > > Regards.
>
> > > On Thu, Jun 3, 2010 at 5:39 PM, patrickk  wrote:
> > > > you could use uploadify, seehttp://www.uploadify.com/.
>
> > > > of course, it´s not an ideal solution since its flash-based.
> > > > we´ve been using uploadify with django and the filebrowser for about a
> > > > year now and it works quite well.
>
> > > > regards,
> > > > patrick
>
> > > > On 3 Jun., 06:32, Venkatraman S  wrote:
> > > > > Tell me about it! Its quite insane that there is no single-standard
> > > > solution
> > > > > for this.
> > > > > I have been hanging around in #django for sometime and there is still
> > > > > opposition to flash based solution. Also, i have not been to get it
> > > > working
> > > > > inspite of it being not an ideal solution.
> > > > > I hear that there are some issues with filebrowser since it uses
> > > > Uploadify.
> > > > > Also, i dont see any solution which works in both dev server and also
> > in
> > > > the
> > > > > production using httpd/apache.
>
> > > > > Going insane! Let me know if you get anything working.
>
> > > > > PS: As i said, html5 is cool and works, but the client does not want
> > to
> > > > use
> > > > > it!
>
> > > > > -V-http://twitter.com/venkasub
>
> > > > > On Thu, Jun 3, 2010 at 9:54 AM, Brad Pitcher 
> > > > wrote:
> > > > > > Sort of, that's what the default is in the demo, but now I've
> > noticed I
> > > > > > have the same problem with apache progress reporting as I did using
> > > > django
> > > > > > progress reporting.  It's behaving like it's not multi-threaded or
> > > > > > something.  It seems like I don't get any progress reports until
> > the
> > > > file
> > > > > > has finished uploading.  It's actually driving me a bit crazy so
> > I'm
> > > > going
> > > > > > to have to move on to something else for a while.
>
> > > > > > On Wed, Jun 2, 2010 at 9:16 PM, Venkatraman S 
> > > > wrote:
>
> > > > > >> Does this work with the Django development server?
>
> > > > > >> On Thu, Jun 3, 2010 at 8:13 AM, Brad Pitcher <
> > bradpitc...@gmail.com
> > > > >wrote:
>
> > > > > >>> Since I just spent much longer than it should have taken figuring
> > > > this
> > > > > >>> out, I will try and help you out.  I followed the instructions at
> > the
> > > > > >>> provided link and it sort of worked.  Not quite as well as I
> > liked.
> > > >  I
> > > > > >>> used Apache for the progress reporting, which the author doesn't
> > > > > >>> mention in the article but it is discussed here:
>
> > > >http://piotrsarnacki.com/2008/06/18/upload-progress-bar-with-mod_pass.
> > ..
> > > > > >>> (it involves compiling and installing an apache module).
> > > > > >>> The author also doesn't mention changes needed in settings.py:
> > > > > >>> from django.conf import global_settings
>
> > > > > >>> FILE_UPLOAD_HANDLERS = ('path.to.UploadProgressCachedHandler', )
> > +
> > > > > >>> \    <-- change path here
> > > > > >>>    global_settings.FILE_UPLOAD_HANDLERS
>
> > > > > >>> If you are using nginx or apache for the server side instead of
> > > > > >>> django, you will need to modify progressUrl to point to whatever
> > url
> > > > > >>> you set up for accessing progress reports.
>
> > > > > >>> If you are looking for a demo, there is one linked in the article
> > > > > >>> creecode posted.
> > > > > >>> -Brad
>
> > > > > >>> On May 30, 12:23 pm, Venkatraman S  wrote:
> > > > > >>> > HI creecode,
>
> > > > > >>> > Can you share the project please? I can probably work on it and
> > see
> > > > > >>> what is
> > > > > >>> > happening.
> > > > > >>> > Till now, i havent eve

analyzing slow view

2010-06-03 Thread Dmitry Beransky
Hi,

I'm trying to figure out why a certain view is taking a long time to
render.  It all comes down to DB access, but here's where I'm starting
to get confused.  Looking at connections[].queries, I can see that the
query in question takes around 300s to execute (does this include
re-hydration time as well?).  However, if I take this Django generated
query and run it against the database (MS SQL Server) directly (using
Management Studio), the results come back in around 10s.  The query
returns a single column table with 23 rows.  Below are also profiler
data for the view call.  Can anyone offer any theories why such a
disparity in execution times?  I can post additional code if need be,
just let me know.


Thanks
Dmitry


 72237 function calls (67692 primitive calls) in 1094.100 CPU seconds

   Ordered by: internal time, call count
   List reduced from 225 to 30 due to restriction <30>

   ncalls  tottime  percall  cumtime  percall filename:lineno(function)
4 1092.705  273.176 1092.706  273.177
c:\python26\lib\site-packages\sql_server\pyodbc\base.py:308(execute)
 2121/3030.2520.0000.7480.002
c:\python26\lib\site-packages\django\db\models\query.py:1120(get_cached_row)
 21220.2210.0000.3810.000
c:\python26\lib\site-packages\django\db\models\base.py:251(__init__)
115420.1420.0000.1750.000
c:\python26\lib\site-packages\sql_server\pyodbc\compiler.py:37(convert_values)
  3270.0970.0000.2770.001
c:\python26\lib\site-packages\sql_server\pyodbc\compiler.py:69(resolve_columns)
40.0810.0200.0850.021
c:\python26\lib\site-packages\sql_server\pyodbc\base.py:140(_cursor)
115520.0680.0000.0680.000
c:\python26\lib\site-packages\django\db\models\query_utils.py:222(select_related_descend)
90.0570.0060.0650.007
c:\python26\lib\site-packages\sql_server\pyodbc\base.py:349(fetchmany)
 42450.0510.0000.1240.000
c:\python26\lib\site-packages\django\dispatch\dispatcher.py:143(send)
 85150.0490.0000.0490.000
c:\python26\lib\site-packages\django\db\models\options.py:200(_fields)
 42440.0450.0000.0450.000
c:\python26\lib\site-packages\django\dispatch\dispatcher.py:11(_make_id)
  1404/600.0320.0000.0680.001
c:\python26\lib\copy.py:144(deepcopy)
 21220.0280.0000.0480.000
c:\python26\lib\site-packages\django\dispatch\dispatcher.py:208(_live_receivers)
 36440.0210.0000.0210.000
c:\python26\lib\site-packages\django\db\models\fields\__init__.py:252(get_internal_type)
  3300.0190.000 1093.2153.313
c:\python26\lib\site-packages\django\db\models\sql\compiler.py:666(results_iter)
 24240.0160.0000.0160.000
c:\python26\lib\site-packages\django\db\models\fields\__init__.py:249(get_cache_name)
 21220.0120.0000.0120.000
c:\python26\lib\site-packages\django\db\models\base.py:244(__init__)
  3060.0120.0001.2220.004
c:\python26\lib\site-packages\django\db\models\query.py:213(iterator)
 13650.0110.0000.0110.000
c:\python26\lib\copy.py:261(_keep_alive)
 18180.0100.0000.0100.000
c:\python26\lib\site-packages\django\db\models\fields\__init__.py:224(unique)
  6060.0080.0000.0110.000
c:\python26\lib\site-packages\django\db\models\fields\related.py:275(__get__)
  3280.0080.0000.0080.000
c:\python26\lib\site-packages\sql_server\pyodbc\base.py:326(format_results)
625/40.0080.0000.0320.008
c:\python26\lib\site-packages\django\db\models\fields\subclassing.py:45(inner)
10.0080.008 1094.100 1094.100
u:\qpsitools.trunk\src\scanner\crtracker\views.py:195(productlines)
   124/750.0070.0000.0560.001
c:\python26\lib\copy.py:224(_deepcopy_list)
  618/1980.0070.0000.0130.000
c:\python26\lib\json\encoder.py:284(_iterencode)
 12170.0060.0000.0060.000
c:\python26\lib\site-packages\django\db\models\fields\__init__.py:545(get_internal_type)
  3070.0060.0000.0100.000
c:\python26\lib\site-packages\django\db\utils.py:122(_route_db)
 12120.0060.0000.0060.000
c:\python26\lib\site-packages\django\db\models\fields\__init__.py:973(get_internal_type)
 10540.0050.0000.0050.000
c:\python26\lib\copy.py:197(_deepcopy_atomic)

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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 call label_tag?

2010-06-03 Thread Phlip
Djangoists:

Given a form, I can expand a template with {{ form.my_field.label }}
which inserts the string of label into my HTML.

How do I call label_tag? It seems to decorate the label string with
 and similar HTML-correctness.

{{ form.my_field.label_tag }} did not work.

--
  Phlip
  http://c2.com/cgi/wiki?ZeekLand

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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.



Directory structuring

2010-06-03 Thread EJ
Hi guys, first of all: Thanks! Django-users has been a great resource
for me so far; I've come across many solutions for my own problems
here.

I'm not even really sure if this question is totally appropriate for
this page, but here goes:

I'm a new developer working on a small social networking website which
has grown pretty tremendously since I've started my job (about 8-9
months ago).  I've had no training except for what I've learnt on the
job, some of which has been from another fairly new developer.  So far
I've been able to see examples on the internet of how to do things and
follow them without too much trouble, but I've found that the
development environment now is very insufficient and totally
backwards, and I have no idea what to do or how to fix it.

At the moment, every time we get a new organisation to sign up and
start using our software, we create a new apache, django, python, and
software installation, which simply duplicates the software in each
app.

All of our app software is in subversion control except for a few
files (base.html, team.html and localsettings.py are the main ones)
that change between each site, as they are 'skinned' differently 'ie
have different colours, header images, slightly different content etc'

I'm trying (and struggling) to somehow put all of these files under
version control and still have the ability to maintain each site
individually, as well as add new (python-based and template-based)
functions, features and bugfixes across the whole software.

At the moment the environment is like this:
In ~/webapps/ there's a directory for each organisation/site, and each
of those directories contains /apache2/, /bin/, /lib/, and /vanilla/
(our software).

For each organisation, they simply go to http://(their
name).vteam.com.au and see the site in their skin.

Currently when I have to roll out a change or bugfix I edit my
development site, test it, make sure it works, and then I run a script
which simply runs "svn update" on all the other apps (and an apache
restart if it's a python change)

This doesn't seem to be very sustainable or efficient...
a) It's not the standard.  I've looked around at subversion repository
tutorials but can't seem to wrap my head around applying that to our
software.
b) Sometimes we need to change something on one site, but can't as the
file is under version control and may cause a clash when I try to
update it for a different fix later.
c) If I'm working on a large job on a certain file on my development
site, I can't commit that file to roll out a quick bug fix.

I'm wondering if anybody has had or seen a similar situation.  Help or
advice would be appreciated muchly!

Thanks,
Ethan

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: design question - forms as meta-data to a model

2010-06-03 Thread Jason Beaudoin
Silence usually implies some key piece of documentation was missed, or
was this just lost amongst more interesting posts? :)


On Tue, Jun 1, 2010 at 9:54 PM, Jason Beaudoin  wrote:
> Hi,
>
> I've a situation where the following functionality is desirable..
>
>  - one central model is used and interacted with by users
>  - forms (multiple on multiple sites, pick a number for each.. 5 or
> 50, doesn't matter) are submitted by anonymous users and associated
> with this central model.. so these forms are sort of meta-data..
>  - it would be nice to be able to define a new form via the admin
> panel and allow this to be picked up more or less dynamically by the
> rest of the application - so once defined, a site could then start
> submitting forms and have them associated with and displayed as part
> of other instances of this model, no other code or (manual) db updates
> would really be necessary
>
> I'm an intermediate django user, and are pretty well-rooted in various
> aspects of django development, though I haven't really wrapped my head
> around the best way to implement these forms, the model, and the
> connection between the two.
>
> Thoughts?
>
>
> thanks!
>
> ~Jason
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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 should reusable apps handle url namespace?

2010-06-03 Thread HARRY POTTRER
I'm writing a forum app that I want to be reusable. All of my urls I
have named. Some of them are named like "index" and "thread" which are
generic and will likely collide with existing project's urls. I don't
want to do something like name all my urls "forum_index" and
"forum_thread" either.

I think the best way is to use the new namespace feature, but I'm not
quite sure how to do it for reusuable apps. The docs make it seem like
the only purpose of namespace urls is when you have two or more
instances of an app.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: Directory structuring

2010-06-03 Thread Mike Dewhirst

EJ - one comment below ...

On 4/06/2010 11:41am, EJ wrote:

Hi guys, first of all: Thanks! Django-users has been a great resource
for me so far; I've come across many solutions for my own problems
here.

I'm not even really sure if this question is totally appropriate for
this page, but here goes:

I'm a new developer working on a small social networking website which
has grown pretty tremendously since I've started my job (about 8-9
months ago).  I've had no training except for what I've learnt on the
job, some of which has been from another fairly new developer.  So far
I've been able to see examples on the internet of how to do things and
follow them without too much trouble, but I've found that the
development environment now is very insufficient and totally
backwards, and I have no idea what to do or how to fix it.

At the moment, every time we get a new organisation to sign up and
start using our software, we create a new apache, django, python, and
software installation, which simply duplicates the software in each
app.

All of our app software is in subversion control except for a few
files (base.html, team.html and localsettings.py are the main ones)
that change between each site, as they are 'skinned' differently 'ie
have different colours, header images, slightly different content etc'

I'm trying (and struggling) to somehow put all of these files under
version control and still have the ability to maintain each site
individually, as well as add new (python-based and template-based)
functions, features and bugfixes across the whole software.

At the moment the environment is like this:
In ~/webapps/ there's a directory for each organisation/site, and each
of those directories contains /apache2/, /bin/, /lib/, and /vanilla/
(our software).

For each organisation, they simply go to http://(their
name).vteam.com.au and see the site in their skin.

Currently when I have to roll out a change or bugfix I edit my
development site, test it, make sure it works, and then I run a script
which simply runs "svn update" on all the other apps (and an apache
restart if it's a python change)

This doesn't seem to be very sustainable or efficient...
a) It's not the standard.  I've looked around at subversion repository
tutorials but can't seem to wrap my head around applying that to our
software.
b) Sometimes we need to change something on one site, but can't as the
file is under version control and may cause a clash when I try to
update it for a different fix later.


Have you tried doing a subversion 'export' instead of 'update'?

That means the production stuff is not under version control and 
therefore cannot clash.


Give the user which runs your script sufficient privileges to completely 
remove the directory trees, completely recreate them, export from svn 
and then chown, chmod as required and touch your wsgi script so you 
don't have to restart Apache.


hth

Mike


c) If I'm working on a large job on a certain file on my development
site, I can't commit that file to roll out a quick bug fix.

I'm wondering if anybody has had or seen a similar situation.  Help or
advice would be appreciated muchly!

Thanks,
Ethan



--
You received this message because you are subscribed to the Google Groups "Django 
users" group.
To post to this group, send email to django-us...@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: design question - forms as meta-data to a model

2010-06-03 Thread Russell Keith-Magee
On Fri, Jun 4, 2010 at 12:03 PM, Jason Beaudoin  wrote:
> Silence usually implies some key piece of documentation was missed, or
> was this just lost amongst more interesting posts? :)

You've missed two important alternatives:
 * The people who can answer your question are busy
 * Nobody can understand your question.

Personally, I fall into both these categories. I'm still trying to dig
myself out from tasks stemming from DjangoCon; and I really can't work
out what it is you're trying to do.

In particular, you seem to be using the word "form" in a way that
isn't entirely consistent with normal Django form usage, but I can't
work out exactly what your usage entails. It sounds like you're trying
to use a model to dynamically define forms, but I'm not completely
certain about that.

So - perhaps if you explain your problem in more detail, you might
have more luck getting a response.

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-us...@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.