Re: Query overhead or not ?

2010-08-31 Thread Jirka Vejrazka
> tags = Tag.objects.all()
>
> for t in tags:
>    indexed_tags[t] = Post.objects.filter(tags__name=t).count()
>
> Next I would sort indexed_tags and I have a dictionary of which tags are used 
> the most.
>
> I'm wondering if this is a good idea ? Since if I have 1000 tags this would 
> require 1000 queries just for one simple tag cloud.
> Is there a better way of solving this without adding an extra count field to 
> the Tag model.

  Hi Jonas,

  your gut feeling was correct - it's not a very good idea, although
it might work for a small site. You might want to take a look at
database aggregation in Django:
http://docs.djangoproject.com/en/1.2/topics/db/aggregation/

   Cheers

 Jirka

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



apps for versioning

2010-08-31 Thread JonC
I need to implement some functionality, and I'm wondering if any of
you know of an app component that does this (so hopefully I don't have
to).  I want to have versioning on a text field similar to the way
WordPress lets you save drafts and multiple revisions.

I've checked out Django fullhistory, django-reversion, and django-
rcsfield, but it looks like those are used mostly for content backup.
Are there any apps that I might be able to pull in?  Or
recommendations of some projects I could check out that has this type
of functionality?  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.



RE: Re: Moderation of posts

2010-08-31 Thread Henrik Genssen
Hi,

I had a lot of problems, too. In the google groups settings google blamed me, 
that the mail-server
I was using is bouncing... - well - I used google mail...
Now I switched in the settings to a private mail account and most of all works 
fine now. Still not
everything all the time...

@Karen:
is there a view in the admin section, where you can filter posts that were 
never answered?
And if: can it be made public? There are a lot of peaple who might want to help 
- (see stackoverflow
or cempetitors...) but if one does not know...

Henrik

>reply to message:
>date: 30.08.2010 08:32:23
>from: "Shamail Tayyab" 
>to: 
>subject: Re: Moderation of posts
>
>On Mon, Aug 30, 2010 at 12:56 AM, Karen Tracey  wrote:
>> The mail you sent on August 24 was approved through moderation, you can see
>> it here:
>>
>> http://groups.google.com/group/django-users/browse_thread/thread/48ac828afbe07bf2/
>>
>> Since then your posts have not been moderated; generally once someone sends
>> a non-spam posting to the group they are allowed to post without moderation.
>> I don't see any record in my mail archive of any other messages held for
>> moderation from you. In fact I don't see that one either -- I have noticed
>> lately that there are  sometimes more messages from new posters in the
>> moderation queue than moderation emails I have received. If your other
>> message looked identical to the one that got posted then likely it was
>> removed as a duplicate by whoever approved the one that did go through. If
>> it was different, I have no idea what happened to it.
>>
>> Also, Google Groups does occasionally, and using no algorithm I can discern,
>> decide to hold posts from approved members because, it says, the "message
>> may be spam". When it does this no mail is sent to moderators until a day or
>> two (or three) later, so these posts sometimes do get held up for a while
>> Usually, though, there are enough new member postings that someone visits
>> the moderation page often enough to see these oddball cases and move them
>> along fairly quickly.
>>
>> Karen
>>
>
>
>Hi Karen,
>
>   Thanks for your prompt reply :-)
>
>/me is happy.
>
>
>-- 
>Shamail Tayyab
>Blog: http://shamail.in/blog
>
>-- 
>You received this message because you are subscribed to the Google Groups 
>"Django users" group.
>To post to this group, send email to django-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.



Web hosting?

2010-08-31 Thread Sithembewena Lloyd Dube
Hi folks,

I introduced Django at work not very long ago and the uptake has been good.
We are seeing early results working with the framework (somebody who never
previously used Python or Django has managed to build a web app well within
proposed time frames).

We will be going live in a while, and we need hosting. I have a host in
mind, but I wanted to know what others think? In your view, which host
provides good Django support and decent performance?

-- 
Regards,
Sithembewena Lloyd Dube
http://www.lloyddube.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: Web hosting?

2010-08-31 Thread Federico Maggi
On Aug 31, 2010, at 10:13 AM, Sithembewena Lloyd Dube wrote:

> We will be going live in a while, and we need hosting. I have a host in mind, 
> but I wanted to know what others think? In your view, which host provides 
> good Django support and decent performance?

http://djangofriendly.com/hosts/

-- 
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: Web hosting?

2010-08-31 Thread Sithembewena Lloyd Dube
Ah, thanks Federico :)

On Tue, Aug 31, 2010 at 10:15 AM, Federico Maggi
wrote:

> On Aug 31, 2010, at 10:13 AM, Sithembewena Lloyd Dube wrote:
>
> > We will be going live in a while, and we need hosting. I have a host in
> mind, but I wanted to know what others think? In your view, which host
> provides good Django support and decent performance?
>
> http://djangofriendly.com/hosts/
>
> --
> 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.
>
>


-- 
Regards,
Sithembewena Lloyd Dube
http://www.lloyddube.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: Web hosting?

2010-08-31 Thread Sithembewena Lloyd Dube
Looks like my proposed host is at the top there by a wide
margin



On Tue, Aug 31, 2010 at 10:17 AM, Sithembewena Lloyd Dube  wrote:

> Ah, thanks Federico :)
>
>
> On Tue, Aug 31, 2010 at 10:15 AM, Federico Maggi  > wrote:
>
>> On Aug 31, 2010, at 10:13 AM, Sithembewena Lloyd Dube wrote:
>>
>> > We will be going live in a while, and we need hosting. I have a host in
>> mind, but I wanted to know what others think? In your view, which host
>> provides good Django support and decent performance?
>>
>> http://djangofriendly.com/hosts/
>>
>> --
>> 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.
>>
>>
>
>
> --
> Regards,
> Sithembewena Lloyd Dube
> http://www.lloyddube.com
>



-- 
Regards,
Sithembewena Lloyd Dube
http://www.lloyddube.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: Web hosting?

2010-08-31 Thread Kenneth Gonsalves
On Tue, 2010-08-31 at 10:13 +0200, Sithembewena Lloyd Dube wrote:
> We will be going live in a while, and we need hosting. I have a host
> in
> mind, but I wanted to know what others think? In your view, which host
> provides good Django support and decent performance? 

low cost small site - webfaction
slightly higher cost - medium site - linode/slicehost/gandi
more pricey for bigger sites - hetzner
huge sites - amazon
-- 
regards
Kenneth Gonsalves

-- 
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: Staticstic app, ask for idea.

2010-08-31 Thread sebastien piquemal
To integrate a calculated value with search features from admin app, I
don't know any other way than create and save a calculated field on
your model ...
This calculated field, you can calculate it with cube ... but if you
don't use the Cube for any other statistic than that, it is too much
overhead.

On Aug 31, 5:30 am, Lucian Romi  wrote:
> Thanks Sebastien.
>
> Can I integrate Cube with filter and search features from the admin app?
> Also, to make things simple, I'm going to use GChart, but I need
> statistic data.
> Let me download Cube and spend some time on it. Thanks.
>
> On Mon, Aug 30, 2010 at 4:16 PM, sebastien piquemal  wrote:
> > I created an app to easily generate the stats part :
> >http://code.google.com/p/django-cube/; however you still have to
> > create the chart, for example with matplotlib :
> >http://www.scipy.org/Cookbook/Matplotlib/Django.
>
> > To create your stats with django-cube, you can use this code :
>
> >    from cube.models import Cube, Dimension
>
> >    class MyModelCube(Cube):
> >        my_dimension = Dimension(field='my_float_field__range',
> > sample_space=[(0, 1.5), (1.5, 6.2)])
>
> >       �...@static
> >        def aggregation(queryset):
> >            return queryset.count()/MyModel.objects.count() * 100
>
> > - You specify one dimension for the cube, this dimension refers to the
> > field lookup 'my_float_field__range' (where 'my_float_field' is of
> > course the name of your field)
> > - then you specify a sample space for this dimension, which in fact
> > means that you specify for which ranges the stats will be calculated
> > (here, on the ranges (0, 1.5) and (1.5, 6.2))
> > - then you write your aggregation function, which is in your case a
> > percentage calculation ('queryset' is the queryset filtered according
> > to the dimensions you will use while querying the cube, divided by the
> > total, multiplied by 100)
> > - finally, you instantiate a cube with a base queryset, and use one of
> > the methods provided to calculate the statistics
>
> > Ok, the doc is kind of bad for now, but I can help you if you want to
> > use it but you don't manage to do so.
>
> > On Aug 30, 8:24 pm, hollando  wrote:
> >> I want to make a statistic app.
> >> There is a float field in my model(table).I want to use a chart to
> >> show what's the percentage in each range.
> >> Any suggestion to make such and app that can fit into django model.
> >> 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.



Re: Custom attributes in Django

2010-08-31 Thread Sebastian Pawlus
Hi thanks for quick response.

I was thinking more about real custom attributes. Be able to define a
string, or choice filed from admin. And after all create query and/or
render form on it.
Application that we are working at requires different attributes on
objects from client to client.
We were looking for something like alex's
http://github.com/alex/django-taggit, but perfect situation will be a
tag with a type(or choice)

thanks

On Mon, Aug 30, 2010 at 6:20 PM, Beres Botond  wrote:
> Hi Sebastian,
>
> I suppose you are trying to do something like this?
>
> class CustomAttributes(models.Model):
>    name = models.CharField(max_length=30)
>    value = models.CharField(max_length=50)
>
> class ObjectWithCustom(models.Model):
>    name = models.CharField(max_length=30)
>    attributes = models.ManyToManyField(CustomAttributes)
>
> new_attr = o.attributes.create(name='custom_attr', value='value')
>
> ObjectWithCustom.objects.filter(attributes__value='value')
>
> For more info about many-to-many check out docs:
> http://www.djangoproject.com/documentation/models/many_to_many/
> Maybe describe in some detail what you are trying to accomplish (in
> terms of resulting functionality), as this might not necessarily be
> the best way to do it.
>
> Cheers,
>
> Béres Botond
>
> On Aug 30, 5:54 pm, Sebastian Pawlus 
> wrote:
>> Hi
>>
>> Maybe im looking in wrong places or maybe there is no application to
>> cover functionality of carrying custom/admin defined attributes, or
>> maybe it isn't even possible.
>>
>> Use Case could looks like
>> Defining models
>>
>> from customr_attr import models
>>
>> class ObjectWithCustom(models.Model):
>>      name = models.CharField(max_length=30)
>>
>> o = ObjectWithCustom.objects.create(name='test')
>> o.custom_attr.create(name='custom_attr', value='value')
>>
>> >> o.custom_attr
>>
>> value
>>
>> >> ObjectWithCustom.objects.filter(custom_attr='value')
>>
>> [o]
>>
>> any ideas?
>
> --
> 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: Web hosting?

2010-08-31 Thread Sithembewena Lloyd Dube
Thanks Kenneth, interesting summary. We would likely start off with WF as
our needs at this point should be covered by their hosting.

On Tue, Aug 31, 2010 at 10:25 AM, Kenneth Gonsalves wrote:

> On Tue, 2010-08-31 at 10:13 +0200, Sithembewena Lloyd Dube wrote:
> > We will be going live in a while, and we need hosting. I have a host
> > in
> > mind, but I wanted to know what others think? In your view, which host
> > provides good Django support and decent performance?
>
> low cost small site - webfaction
> slightly higher cost - medium site - linode/slicehost/gandi
> more pricey for bigger sites - hetzner
> huge sites - amazon
> --
> regards
> Kenneth Gonsalves
>
> --
> 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.
>
>


-- 
Regards,
Sithembewena Lloyd Dube
http://www.lloyddube.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: Web hosting?

2010-08-31 Thread Robbington
I use a Linode with Ubuntu serving django with a uwsgi/cherokee setup.
Its remarkable how easy and intuitive it is and its hardly bank
breaking at £10 a month.
You cant beat the flexibility that you get.
The only complaint I've got is the compatiblity issues with Django 1.1
and Cms. Its caused me countless re-installs.

On Aug 31, 9:13 am, Sithembewena Lloyd Dube  wrote:
> Hi folks,
>
> I introduced Django at work not very long ago and the uptake has been good.
> We are seeing early results working with the framework (somebody who never
> previously used Python or Django has managed to build a web app well within
> proposed time frames).
>
> We will be going live in a while, and we need hosting. I have a host in
> mind, but I wanted to know what others think? In your view, which host
> provides good Django support and decent performance?
>
> --
> Regards,
> Sithembewena Lloyd Dubehttp://www.lloyddube.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: Django UserProfile's - the hardest part of the whole framework

2010-08-31 Thread bruno desthuilliers
On 31 août, 06:16, reduxdj  wrote:
> So, I'm still newer to django. I have user registration,
> authentication, imagefields, filters, and more all built into my
> application and working. So now, I need a user to be able to edit his
> own email and upload an image to the user_profile. First, I am using
> RegistrationProfile for the django registration just fine, should be
> no conflict right?

Nope, these are distinct apps and needs and whatnot...

> Here's my problem, I know you don't get direct access to the user
> model,

Yes you do.

> so making the user email editable is kind of tricky

Why so ?

> here's my
> FAILED attempt:
>
> from settings.py:
>
> AUTH_PROFILE_MODULE = "gather.models.UserProfile"
>
> From models.py:
>
> class UserProfile(models.Model):
>     user = models.ForeignKey(User, unique=True)
>     image = models.ImageField(null=True,upload_to='images/users')
>
>     def save(self, *args, **kwargs):
>         super(UserProfile, self).save(*args, **kwargs)
>
>     def update(self, *args, **kwargs):
>          super(UserProfile, self).update(*args, **kwargs)
>
>     def delete(self, *args, **kwargs):
>         super(UserProfile, self).delete(*args, **kwargs)

You don't need any of these three methods - your current
implementation just duplicate what would happen without them.

> class UserProfileForm(UserProfileForm):
>     class Meta:
>         model = UserProfile
>         exclude = ['user']
>
> from forms.py:
>
> class UserProfileForm(forms.ModelForm):

I personnaly don't use a ModelForm for user profiles - since you
(usually) have to mix&match data from both the user and profile
models, I find it simpler to use a plain forms.Form and handle the
fields/models mapping, saving etc by myself

(snip form's code - not sure whether it's ok)

>
> from views.py:
>
> def account(request):
>     #return render_to_response('account.html',
> context_instance=RequestContext(request))
>     if request.method == "POST":
>         form =
> UserProfileForm(request.user,request.POST,request.FILES)
>         if form.is_valid():
>             form.save()
>             return HttpResponseRedirect('/account/')
>     else:
>         form = UserProfileForm(request.user)
>         return render_to_response('account.html', {'form': form},
> context_instance=RequestContext(request))
>
> So, this seems simple enough but doesn't work, here's my output:
>
> Caught AttributeError while rendering: 'User' object has no attribute
> 'get'
>

You should have a full traceback, it might help if you post it so we
know where the exception is raised. But from your code and the error
message, I'd say the problem is somewhere in your template (wild
guess...).

> Thanks, as I am at a stoppage.
> appreciated.

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

2010-08-31 Thread Robbington
Also the Linode support team are amazing, I have been left nothing but
impressed by them.

On Aug 31, 10:25 am, Robbington  wrote:
> I use a Linode with Ubuntu serving django with a uwsgi/cherokee setup.
> Its remarkable how easy and intuitive it is and its hardly bank
> breaking at £10 a month.
> You cant beat the flexibility that you get.
> The only complaint I've got is the compatiblity issues with Django 1.1
> and Cms. Its caused me countless re-installs.
>
> On Aug 31, 9:13 am, Sithembewena Lloyd Dube  wrote:
>
>
>
> > Hi folks,
>
> > I introduced Django at work not very long ago and the uptake has been good.
> > We are seeing early results working with the framework (somebody who never
> > previously used Python or Django has managed to build a web app well within
> > proposed time frames).
>
> > We will be going live in a while, and we need hosting. I have a host in
> > mind, but I wanted to know what others think? In your view, which host
> > provides good Django support and decent performance?
>
> > --
> > Regards,
> > Sithembewena Lloyd Dubehttp://www.lloyddube.com- Hide quoted text -
>
> - Show quoted text -

-- 
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 add two numbers with django - revisited

2010-08-31 Thread Kenneth Gonsalves
hi,

there was a recent thread on this subject, and I had an idea that this
may be a good way to give a basic instruction in the way django works to
people who come from radically different backgrounds:

http://lawgon.livejournal.com/80621.html
-- 
regards
Kenneth Gonsalves

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



Extending LogEntry model

2010-08-31 Thread vishy
I  want to add a column  to the logentry model in admin section.How
can I do this?
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.



Re: Re: Moderation of posts

2010-08-31 Thread Karen Tracey
On Tue, Aug 31, 2010 at 2:45 AM, Henrik Genssen wrote:

> @Karen:
> is there a view in the admin section, where you can filter posts that were
> never answered?
> And if: can it be made public? There are a lot of peaple who might want to
> help - (see stackoverflow
> or cempetitors...) but if one does not know...
>

No, nothing like that. The easiest way to get that sort of view is probably
to subscribe to get the posts emailed and use your favorite email client
that displays threads well and look for threads with just one post.

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

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-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 create a gerarchical list in admin for flatpages?

2010-08-31 Thread Karim Gorjux
Hi all! I'm working to create my CMS on Django, I would like to
realize a easy admin page for my flat pages that in Django-CMS is
called "site map". How I can do that? Are there any tutorial or how to
about that? Have you any advice?

Thanks!

The site map in Django-CMS:
http://www.django-cms.org/media/uploads/cms_page_media/2/3_pagelist___.png

-- 
Karim Gojux
www.karimblog.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: set utf8 as default database char set

2010-08-31 Thread Karen Tracey
On Tue, Aug 31, 2010 at 3:14 AM, Elim Qiu  wrote:

> I'm in tutorial 2. Looks like I did something wrong. Please help. thanks
> See the image attached
>

The image looks fine to me. What do you see that you think is wrong?

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

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

2010-08-31 Thread Jonas Geiregat
Thanks for your advise. I'm short of time right now so I briefly looked at 
django's aggregation possibilities.
I'll look into them more deeply tonight.

But I stumbled upon a problem.

Post.objects.values('tags')

Gives me:

FieldError: Invalid field name: 'tags'

In [56]: Post.tags
Post.tags  

In [56]: Post.tags
Out[56]: 

Post.tags does exist. Maybe it's because it's a ManyToManyField ? So I tried 
Post.objects.values('tags__name'). Still got an error ?

I'm wondering why ?

Op 31-aug-2010, om 09:28 heeft Jirka Vejrazka het volgende geschreven:

>> tags = Tag.objects.all()
>> 
>> for t in tags:
>>indexed_tags[t] = Post.objects.filter(tags__name=t).count()
>> 
>> Next I would sort indexed_tags and I have a dictionary of which tags are 
>> used the most.
>> 
>> I'm wondering if this is a good idea ? Since if I have 1000 tags this would 
>> require 1000 queries just for one simple tag cloud.
>> Is there a better way of solving this without adding an extra count field to 
>> the Tag model.
> 
>  Hi Jonas,
> 
>  your gut feeling was correct - it's not a very good idea, although
> it might work for a small site. You might want to take a look at
> database aggregation in Django:
> http://docs.djangoproject.com/en/1.2/topics/db/aggregation/
> 
>   Cheers
> 
> Jirka
> 
> -- 
> 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.
> 

Met vriendelijke groeten,

Jonas Geiregat
jo...@geiregat.org




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

2010-08-31 Thread Robbington
Hi,

I seem to be having a problem setting up django and postgresql.

I have created a database and switched users to postgres then sync'd
the database successfully in my django project directory. But it isn't
finding the admin page still. No errors, just cant find them.


Can any one help with Postgres or point me in the direction of a good
tutorial?

Thanks

Rob

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



Chat application in Django

2010-08-31 Thread Shamail Tayyab

Hi,

  I am working on a chat application in Django, how can I ensure that I 
do not have to poll the server for any chat data.


Possible approaches that I've been to:

1. BAD - use polling.

2. Use long polling - bad approach afa browser support is concerned.

3. Using sockets in flash - makes the application flash dependent.

Is there some good way to do this? Or if there is something Django 
specific? Something like HTTPBinding or any 3rd party tested libraries?

I am expected to provide support till IE6. :-(

Correct me if I am wrong, flash is available on 95% of the systems, this 
approach looks like safest bet, is it good to go?


Btw, how does Gmail and FB chat works?

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.



Re: Django + Postgres

2010-08-31 Thread Albert Hopkins
On Tue, 2010-08-31 at 04:30 -0700, Robbington wrote:
> Hi,
> 
> I seem to be having a problem setting up django and postgresql.
> 
> I have created a database and switched users to postgres then sync'd
> the database successfully in my django project directory. But it isn't
> finding the admin page still. No errors, just cant find them.

What is "it" and what is meant by "it isn't finding the admin page"?

Did you enable the admin in INSTALLED_APPS and urls.py?


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



Chat application in Django

2010-08-31 Thread Shamail Tayyab

Hi,

  I am working on a chat application in Django, how can I ensure that I 
do not have to poll the server for any chat data.


Possible approaches that I've been to:

1. BAD - use polling.

2. Use long polling - bad approach afa browser support is concerned.

3. Using sockets in flash - makes the application flash dependent.

Is there some good way to do this? Or if there is something Django 
specific? Something like HTTPBinding or any 3rd party tested libraries?

I am expected to provide support till IE6. :-(

Correct me if I am wrong, flash is available on 95% of the systems, this 
approach looks like safest bet, is it good to go?


Btw, how does Gmail and FB chat works?

Thanks

--
Shamail Tayyab
Blog: http://shamail.in/blog

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

2010-08-31 Thread Xavier Ordoquy

Also, what kind of users are you speaking about ? system, database or django 
users ?
Do you have the admin site available in the urls ? Did you uncomment both the 
url and the auto discovering part ?
Did syncdb showed django_admin_log table being created (or can you check it has 
been created) ?

Regards,
Xavier.


Le 31 août 2010 à 13:34, Albert Hopkins a écrit :

> On Tue, 2010-08-31 at 04:30 -0700, Robbington wrote:
>> Hi,
>> 
>> I seem to be having a problem setting up django and postgresql.
>> 
>> I have created a database and switched users to postgres then sync'd
>> the database successfully in my django project directory. But it isn't
>> finding the admin page still. No errors, just cant find them.
> 
> What is "it" and what is meant by "it isn't finding the admin page"?
> 
> Did you enable the admin in INSTALLED_APPS and urls.py?
> 
> 
> -- 
> 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: Django + Postgres

2010-08-31 Thread Robbington
Apologies I should have been more clear,

'It' refers to my domain name when visited "/admin"
All the django settings are correct, I've used sqlite3 and got the
admin up and working.

So I have installed postgres, pyscopg2.

su postgres
created a database
updated my settings.py:
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql_psycopg2',
'NAME': 'template1',
'USER': 'postgres',
'PASSWORD': 'postgres',

Then I have su postgres
postg...@myvps:/var/www/django/$ python manage.py syncdb

That upates the database, with all the admin database stuff, but it
doesnt find anything at the admin url


On Aug 31, 12:42 pm, Xavier Ordoquy  wrote:
> Also, what kind of users are you speaking about ? system, database or django 
> users ?
> Do you have the admin site available in the urls ? Did you uncomment both the 
> url and the auto discovering part ?
> Did syncdb showed django_admin_log table being created (or can you check it 
> has been created) ?
>
> Regards,
> Xavier.
>
> Le 31 août 2010 à 13:34, Albert Hopkins a écrit :
>
>
>
> > On Tue, 2010-08-31 at 04:30 -0700, Robbington wrote:
> >> Hi,
>
> >> I seem to be having a problem setting up django and postgresql.
>
> >> I have created a database and switched users to postgres then sync'd
> >> the database successfully in my django project directory. But it isn't
> >> finding the admin page still. No errors, just cant find them.
>
> > What is "it" and what is meant by "it isn't finding the admin page"?
>
> > Did you enable the admin in INSTALLED_APPS and urls.py?
>
> > --
> > 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.- Hide quoted text -
>
> - Show quoted text -

-- 
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: Chat application in Django

2010-08-31 Thread Jeff Bell
Pretty sure fb uses Erlang for chat.

On Aug 31, 2010 7:34 AM, "Shamail Tayyab"  wrote:
> Hi,
>
> I am working on a chat application in Django, how can I ensure that I
> do not have to poll the server for any chat data.
>
> Possible approaches that I've been to:
>
> 1. BAD - use polling.
>
> 2. Use long polling - bad approach afa browser support is concerned.
>
> 3. Using sockets in flash - makes the application flash dependent.
>
> Is there some good way to do this? Or if there is something Django
> specific? Something like HTTPBinding or any 3rd party tested libraries?
> I am expected to provide support till IE6. :-(
>
> Correct me if I am wrong, flash is available on 95% of the systems, this
> approach looks like safest bet, is it good to go?
>
> Btw, how does Gmail and FB chat works?
>
> Thanks
>
> --
> Shamail Tayyab
> Blog: http://shamail.in/blog
>
> --
> You received this message because you are subscribed to the Google Groups
"Django users" group.
> To post to this group, send email to django-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: Chat application in Django

2010-08-31 Thread Alexandre González
I've seen this project: http://code.google.com/p/django-chat/ but I don't
test it... perhaps the code can helps you.

What about use a free protocol as XMPP (jabber) and write a "client" for
django?

On Tue, Aug 31, 2010 at 14:08, Jeff Bell wrote:

> Pretty sure fb uses Erlang for chat.
>
> On Aug 31, 2010 7:34 AM, "Shamail Tayyab"  wrote:
> > Hi,
> >
> > I am working on a chat application in Django, how can I ensure that I
> > do not have to poll the server for any chat data.
> >
> > Possible approaches that I've been to:
> >
> > 1. BAD - use polling.
> >
> > 2. Use long polling - bad approach afa browser support is concerned.
> >
> > 3. Using sockets in flash - makes the application flash dependent.
> >
> > Is there some good way to do this? Or if there is something Django
> > specific? Something like HTTPBinding or any 3rd party tested libraries?
> > I am expected to provide support till IE6. :-(
> >
> > Correct me if I am wrong, flash is available on 95% of the systems, this
> > approach looks like safest bet, is it good to go?
> >
> > Btw, how does Gmail and FB chat works?
> >
> > Thanks
> >
> > --
> > Shamail Tayyab
> > Blog: http://shamail.in/blog
> >
> > --
> > You received this message because you are subscribed to the Google Groups
> "Django users" group.
> > To post to this group, send email to django-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.
>



-- 
Please, don't send me files with extensions: .doc, .docx, .xls, .xlsx, .ppt
and/or .pptx

-- 
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: set utf8 as default database char set

2010-08-31 Thread Elim Qiu
I just feel kind of redundant to have the same text in and above the
textfields. And also the odd table layout that makes choice fields and
votes' fields so apart; and doubt if I did something wrong.

At the moment, I only care about following the tutorial correctly. If you
think it looks fine, then it's fine and I'll move forward:)

Thanks Karen

On Tue, Aug 31, 2010 at 5:10 AM, Karen Tracey  wrote:

> On Tue, Aug 31, 2010 at 3:14 AM, Elim Qiu  wrote:
>
>> I'm in tutorial 2. Looks like I did something wrong. Please help. thanks
>> See the image attached
>>
>
> The image looks fine to me. What do you see that you think is wrong?
>
> Karen
> --
> http://tracey.org/kmt/
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-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: Overriding flatpages class meta

2010-08-31 Thread Goran
Thanks Owen but is doesn't work. The similar Error message:

contribute_to_class
if self.meta:
AttributeError: 'Options' object has no attribute 'meta'

On Aug 30, 8:03 pm, Owen Nelson  wrote:
> Sorry to be guessing here, but I was looking at something similar recently.
> My attempt (untested at this point) would be something like:
>
> from copy import copy
> class NewFlatpage(FlatPage):
>     _meta = copy(FlatPage._meta)
>     _meta.verbose_name_plural = "foo"

-- 
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: Please wait page trouble

2010-08-31 Thread Bradley Hintze
I'll look into this. I have no idea what you mean by 'ajax' or 'json'.
Thus your code doe'snt really make sense given my lack of knowlege. I
will do some googling to see if I can piece it together. Thanks for
the help!

On Mon, Aug 30, 2010 at 10:37 PM, Rolando Espinoza La Fuente
 wrote:
> On Mon, Aug 30, 2010 at 7:18 PM, Bradley Hintze
>  wrote:
>> I am attempting to do a lengthe calculation that will require the user
>> to wait a bit. I want a 'Please wait page to come up while the lengthy
>> calculation is performed. I thought this might work:
>>
>> views.py
>>
>> def please_wait(request):
>>    return HttpResponse('Please Wait..')
>>
>> def run_DHM(request):
>>    please_wait(request)
>>    lengthy calculations...
>>
>> This did not show the 'Please Wait' page. Is there a better way to do
>> what I am trying to do?
>>
>
> You are not returning the HttpResponse object from please_wait(). But anyway,
> doesn't work that way. At least with django.
>
> What you can do is render a normal html with the message "Please wait",
> then perform an ajax call to start the calculations and finally return
> a json response
> to display the result in the client-side.
>
> Roughly:
>
> def please_wait(request):
>    # ... setup context or something
>    return render_to_response("please_wait.html")
>
> def run_DHM(request)
>    # ... perform calculations and collect the result in a dict
>    data = {"result": something}
>    return HttpResponse(json.dumps(data), mimetype="application/json")
>
>
> # using jquery in your html
> 
> $.getJSON("/run_DHM/", function(data) {
>    // do something with result
>    console.log(data.result);
> });
> 
>
>
> Rolando Espinoza La fuente
> www.insophia.com
>
>> --
>> Bradley J. Hintze
>> Graduate Student
>> Duke University
>> School of Medicine
>> 801-712-8799
>>
>> --
>> 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.
>
>



-- 
Bradley J. Hintze
Graduate Student
Duke University
School of Medicine
801-712-8799

-- 
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: Django + Postgres

2010-08-31 Thread Xavier Ordoquy
Hi,

Actually, there is a confusion between the administrative data django fills and 
the data the admin application owns itself.
Unless I'm mistaken, Django admin application only creates 1 table I named in 
my previous message (django_admin_log).
Can you check this table has been created ?
If it has been created, the second step would be to paste our urls.py file.
Otherwise, I would advice to take the time to read the django tutorial 
(http://docs.djangoproject.com/en/1.2/).

Regards,
Xavier.

Le 31 août 2010 à 13:53, Robbington a écrit :

> Apologies I should have been more clear,
> 
> 'It' refers to my domain name when visited "/admin"
> All the django settings are correct, I've used sqlite3 and got the
> admin up and working.
> 
> So I have installed postgres, pyscopg2.
> 
> su postgres
> created a database
> updated my settings.py:
> DATABASES = {
>'default': {
>'ENGINE': 'django.db.backends.postgresql_psycopg2',
>'NAME': 'template1',
>'USER': 'postgres',
>'PASSWORD': 'postgres',
> 
> Then I have su postgres
> postg...@myvps:/var/www/django/$ python manage.py syncdb
> 
> That upates the database, with all the admin database stuff, but it
> doesnt find anything at the admin url
> 
> 
> On Aug 31, 12:42 pm, Xavier Ordoquy  wrote:
>> Also, what kind of users are you speaking about ? system, database or django 
>> users ?
>> Do you have the admin site available in the urls ? Did you uncomment both 
>> the url and the auto discovering part ?
>> Did syncdb showed django_admin_log table being created (or can you check it 
>> has been created) ?
>> 
>> Regards,
>> Xavier.
>> 
>> Le 31 août 2010 à 13:34, Albert Hopkins a écrit :
>> 
>> 
>> 
>>> On Tue, 2010-08-31 at 04:30 -0700, Robbington wrote:
 Hi,
>> 
 I seem to be having a problem setting up django and postgresql.
>> 
 I have created a database and switched users to postgres then sync'd
 the database successfully in my django project directory. But it isn't
 finding the admin page still. No errors, just cant find them.
>> 
>>> What is "it" and what is meant by "it isn't finding the admin page"?
>> 
>>> Did you enable the admin in INSTALLED_APPS and urls.py?
>> 
>>> --
>>> 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.- Hide quoted text -
>> 
>> - Show quoted text -
> 
> -- 
> 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.



Django Satchmo render company_name problem and some mods

2010-08-31 Thread maumercado
Hello everyone...

Ive been having the following problem in my satchmo shop, when
registering a new account, the template welcome.txt is not loading the
variable 'company_name' --> debug info : http://dpaste.com/236858/


Besides that there are two things that I want to do... One is to
reverse the order o appearance of the date of birth now it starts with
1910 but I want it to start with 2010, since its a list... I tought I
would be done with the reverse() method on the function but it does
not.. The other thing that I want is to make a required field
optional, Im talking about the postal code field... in the models is
already set with require=False but it is still mark as required...

Ill be thankfull if you can give me some ideas... Im kind of a newb
developing. Thank you all...

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

2010-08-31 Thread Juan de Dios Manjón Pérez

Webfaction +2
http://www.webfaction.com/demos/django

Regards
Juande



We will be going live in a while, and we need hosting. I have a host 
in mind, but I wanted to know what others think? In your view, which 
host provides good Django support and decent performance?


--
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: Chat application in Django

2010-08-31 Thread David Koblas

 Funny you should ask --

The basic challenge with any chat application is the long polling bit, 
django by default isn't really designed to handle that.  Other servers 
(Tornado, etc.) are much better at handling the long polling cycle that 
typical web chat applications require.


I was just finishing an exploration of Django+Tornado -- building a chat 
application -- which I've now pushed up to github.


http://github.com/koblas/django-on-tornado

The only "trick" at the moment is that a response that is returned via 
the async Tornado handler isn't passed back up the middleware stack, 
pondering good ways to deal with that.  But in the mean time, here's a 
functional chat application to play with if you're interested.


--koblas

On 8/31/10 4:34 AM, Shamail Tayyab wrote:

Hi,

  I am working on a chat application in Django, how can I ensure that 
I do not have to poll the server for any chat data.


Possible approaches that I've been to:

1. BAD - use polling.

2. Use long polling - bad approach afa browser support is concerned.

3. Using sockets in flash - makes the application flash dependent.

Is there some good way to do this? Or if there is something Django 
specific? Something like HTTPBinding or any 3rd party tested libraries?

I am expected to provide support till IE6. :-(

Correct me if I am wrong, flash is available on 95% of the systems, 
this approach looks like safest bet, is it good to go?


Btw, how does Gmail and FB chat works?

Thanks

--
Shamail Tayyab
Blog: http://shamail.in/blog



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

2010-08-31 Thread Owen Nelson
The meta class instance is accessed through ClassName._meta -- not
ClassName.meta
I tried this when I got back last night and had (other) issues myself, so
this might not be the right approach anyway.

-- 
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: Overriding flatpages class meta

2010-08-31 Thread Karim Gorjux
Try to modify the flatpages source! You can find it directly in your
django installation.


-- 
Karim Gojux
www.karimblog.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: How to create a gerarchical list in admin for flatpages?

2010-08-31 Thread Karim Gorjux
On Tue, Aug 31, 2010 at 14:11, Karim Gorjux  wrote:
> I would like to
> realize a easy admin page for my flat pages that in Django-CMS is
> called "site map".

I found what I need. Is here: http://code.google.com/p/django-mptt/

-- 
Karim Gojux
www.karimblog.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: Overriding flatpages class meta

2010-08-31 Thread Owen Nelson
Actually, I would *avoid* modifying the flatpages source, but that does
raise a good point -- look at the source and copy/paste the Meta defined
inside the class, making the overrides you need in your subclass (redefine
the Meta).
You'll have to watch for changes if/when you switch django versions, but hey
-- if it works, it works.

Owen Nelson



On Tue, Aug 31, 2010 at 12:38 PM, Karim Gorjux  wrote:

> Try to modify the flatpages source! You can find it directly in your
> django installation.
>
>
> --
> Karim Gojux
> www.karimblog.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.
>
>

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



PIL on 10.6 = PAIN

2010-08-31 Thread keynesiandreamer
Howdy!

I have been working with Django/Pinax on a 10.6.4 system with python
2.6.6 and have had no luck getting PIL to work. I have looked through
about 10-15 paged including ones listed on this group with no results.
Currently the error I am getting is:
The _imaging C module is not installed

I have verified _imaging.so is in the file system. So it seems like a
syspath issue. I tried verifying that in the python prompt:

>>> import _imaging
dlopen("/opt/local/Library/Frameworks/Python.framework/Versions/2.6/
lib/python2.6/site-packages/PIL/_imaging.so", 2);
Traceback (most recent call last):
  File "", line 1, in 
ImportError: dlopen(/opt/local/Library/Frameworks/Python.framework/
Versions/2.6/lib/python2.6/site-packages/PIL/_imaging.so, 2): Symbol
not found: _jpeg_resync_to_restart
  Referenced from: /opt/local/Library/Frameworks/Python.framework/
Versions/2.6/lib/python2.6/site-packages/PIL/_imaging.so
  Expected in: flat namespace
 in /opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/
python2.6/site-packages/PIL/_imaging.so

Any help would be greatly appreciated, too many hours stuck on this
with no results.. :-(

-- 
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: PIL on 10.6 = PAIN

2010-08-31 Thread Bill Freeman
This sounds more like libjpeg isn't on the library load path, a
system, rather than python, setting.

I haven't done this with a Mac, but PIL has been troublesome on *nix
servers for us as well.

The common problems for us don't sound like your problem.  [Some
versions of PIL install as "Imaging" rather than PIL.  If libjpeg
isn't installed first, including development data (headers, stub
library (called import library on Windows)) when your packaging system
separates them, when you first build PIL, you can rebuild it until you
are blue in the face and it won't pick up libjpeg that you installed
later - need to totally remove PIL and rebuild]

You seem to have successfully built to use libjpeg, but it isn't
there.  I can think of three possibilities:

1. It really isn't there, maybe the reverse problem of installing a
"development" package but not the main one.

2. It's there, but it doesn't match the version your _imagning.so was
built against.

3. It's there, but the library loader hasn't been told about it.  On
linux this means findable via ld.conf (or ld.so.conf) and ldconfig has
been run since.  Package installation scripts usually take care of
this, but it sometimes needs to be done by hand, if you're just, for
example, unpacking a tarball.  I don't know the equivalent for osx.

Good luck.

Bill

On Tue, Aug 31, 2010 at 12:41 PM, keynesiandreamer
 wrote:
> Howdy!
>
> I have been working with Django/Pinax on a 10.6.4 system with python
> 2.6.6 and have had no luck getting PIL to work. I have looked through
> about 10-15 paged including ones listed on this group with no results.
> Currently the error I am getting is:
> The _imaging C module is not installed
>
> I have verified _imaging.so is in the file system. So it seems like a
> syspath issue. I tried verifying that in the python prompt:
>
 import _imaging
> dlopen("/opt/local/Library/Frameworks/Python.framework/Versions/2.6/
> lib/python2.6/site-packages/PIL/_imaging.so", 2);
> Traceback (most recent call last):
>  File "", line 1, in 
> ImportError: dlopen(/opt/local/Library/Frameworks/Python.framework/
> Versions/2.6/lib/python2.6/site-packages/PIL/_imaging.so, 2): Symbol
> not found: _jpeg_resync_to_restart
>  Referenced from: /opt/local/Library/Frameworks/Python.framework/
> Versions/2.6/lib/python2.6/site-packages/PIL/_imaging.so
>  Expected in: flat namespace
>  in /opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/
> python2.6/site-packages/PIL/_imaging.so
>
> Any help would be greatly appreciated, too many hours stuck on this
> with no results.. :-(
>
> --
> 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: PIL on 10.6 = PAIN

2010-08-31 Thread Mathieu Leduc-Hamel
To work with PIL and other librairies a little bit weird and difficult
to install the best way is to install Macport and after that:

port install py26-pil

and you'll need to use the python of the macport installation:

$ /opt/local/bin/python2.6

It's the samething on linux, i'm alway using the PIL package from my distro...

On Tue, Aug 31, 2010 at 7:10 PM, Bill Freeman  wrote:
> This sounds more like libjpeg isn't on the library load path, a
> system, rather than python, setting.
>
> I haven't done this with a Mac, but PIL has been troublesome on *nix
> servers for us as well.
>
> The common problems for us don't sound like your problem.  [Some
> versions of PIL install as "Imaging" rather than PIL.  If libjpeg
> isn't installed first, including development data (headers, stub
> library (called import library on Windows)) when your packaging system
> separates them, when you first build PIL, you can rebuild it until you
> are blue in the face and it won't pick up libjpeg that you installed
> later - need to totally remove PIL and rebuild]
>
> You seem to have successfully built to use libjpeg, but it isn't
> there.  I can think of three possibilities:
>
> 1. It really isn't there, maybe the reverse problem of installing a
> "development" package but not the main one.
>
> 2. It's there, but it doesn't match the version your _imagning.so was
> built against.
>
> 3. It's there, but the library loader hasn't been told about it.  On
> linux this means findable via ld.conf (or ld.so.conf) and ldconfig has
> been run since.  Package installation scripts usually take care of
> this, but it sometimes needs to be done by hand, if you're just, for
> example, unpacking a tarball.  I don't know the equivalent for osx.
>
> Good luck.
>
> Bill
>
> On Tue, Aug 31, 2010 at 12:41 PM, keynesiandreamer
>  wrote:
>> Howdy!
>>
>> I have been working with Django/Pinax on a 10.6.4 system with python
>> 2.6.6 and have had no luck getting PIL to work. I have looked through
>> about 10-15 paged including ones listed on this group with no results.
>> Currently the error I am getting is:
>> The _imaging C module is not installed
>>
>> I have verified _imaging.so is in the file system. So it seems like a
>> syspath issue. I tried verifying that in the python prompt:
>>
> import _imaging
>> dlopen("/opt/local/Library/Frameworks/Python.framework/Versions/2.6/
>> lib/python2.6/site-packages/PIL/_imaging.so", 2);
>> Traceback (most recent call last):
>>  File "", line 1, in 
>> ImportError: dlopen(/opt/local/Library/Frameworks/Python.framework/
>> Versions/2.6/lib/python2.6/site-packages/PIL/_imaging.so, 2): Symbol
>> not found: _jpeg_resync_to_restart
>>  Referenced from: /opt/local/Library/Frameworks/Python.framework/
>> Versions/2.6/lib/python2.6/site-packages/PIL/_imaging.so
>>  Expected in: flat namespace
>>  in /opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/
>> python2.6/site-packages/PIL/_imaging.so
>>
>> Any help would be greatly appreciated, too many hours stuck on this
>> with no results.. :-(
>>
>> --
>> 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.
>
>



-- 
Mathieu Leduc-Hamel

-- 
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: Django UserProfile's - the hardest part of the whole framework

2010-08-31 Thread reduxdj
Here's my problem, I have successfully got the user to update his/her
email. However, I can not figure out why my imageField for my profile
is not updating, neither the copying of the file or the image path is
adding to my user profile table. I have included the mimetype on my
form. I've done  this before with another view with no problem.

Here's some snippets:

settings.py:

AUTH_PROFILE_MODULE = "gather.UserProfile"

template form:
 

 {{ user.first_name}} 
{{user.last_name}} Personal Info






Primary 
Email




Your Profile Photo


http://allaboutrecordings.com/find_media/images/
avatar.jpg" alt="">










views.py:
def account(request):
if request.method == "POST":
form = UserProfileForm(request.POST,request.FILES)
form.user = request.user

if form.is_valid():
form.save()
try:
profile = request.user.get_profile()
profile.save()
except UserProfile.DoesNotExist:
profile = UserProfile(user=request.user)
profile.save()

return HttpResponseRedirect('/account/')
else:
return render_to_response('account.html',
{'form':form},context_instance=RequestContext(request))
else:
form = UserProfileForm()

return render_to_response('account.html', {'form': form},
context_instance=RequestContext(request))

forms.py:

class UserProfileForm(forms.ModelForm):

email = forms.EmailField(label="Primary Email",help_text='')
image = forms.ImageField(required=False)

def __init__(self, *args, **kwargs):
super(UserProfileForm, self).__init__(*args, **kwargs)

def save(self, *args, **kwargs):
"""
Update the primary email address on the related User object as
well.
"""
u = User.objects.get(id=self.user.id) # Get the first user in
the system
u.email = self.cleaned_data['email']
u.save()

models.py:

class UserProfile(models.Model):
user = models.ForeignKey(User, unique=True)
image = models.ImageField(null=True,upload_to='images/listings/
main')

def save(self, *args, **kwargs):
super(UserProfile, self).save(*args, **kwargs)

def update(self, *args, **kwargs):
super(UserProfile, self).update(*args, **kwargs)

def delete(self, *args, **kwargs):
super(UserProfile, self).delete(*args, **kwargs)


Thanks for the help!

Patrick


On Aug 31, 5:25 am, bruno desthuilliers
 wrote:
> On 31 août, 06:16, reduxdj  wrote:
>
> > So, I'm still newer to django. I have user registration,
> > authentication, imagefields, filters, and more all built into my
> > application and working. So now, I need a user to be able to edit his
> > own email and upload an image to the user_profile. First, I am using
> > RegistrationProfile for the django registration just fine, should be
> > no conflict right?
>
> Nope, these are distinct apps and needs and whatnot...
>
> > Here's my problem, I know you don't get direct access to the user
> > model,
>
> Yes you do.
>
> > so making the user email editable is kind of tricky
>
> Why so ?
you can't query for a user with request.user but I can with user_id as
above.

>
>
>
> > here's my
> > FAILED attempt:
>
> > from settings.py:
>
> > AUTH_PROFILE_MODULE = "gather.models.UserProfile"
>
> > From models.py:
>
> > class UserProfile(models.Model):
> >     user = models.ForeignKey(User, unique=True)
> >     image = models.ImageField(null=True,upload_to='images/users')
>
> >     def save(self, *args, **kwargs):
> >         super(UserProfile, self).save(*args, **kwargs)
>
> >     def update(self, *args, **kwargs):
> >          super(UserProfile, self).update(*args, **kwargs)
>
> >     def delete(self, *args, **kwargs):
> >         super(UserProfile, self).delete(*args, **kwargs)
>
> You don't need any of these three methods - your current
> implementation just duplicate what would happen without them.
>
> > class Use

Re: Chat application in Django

2010-08-31 Thread reduxdj
Check this out:  It's pretty awesome and works with tornado on flash
and serves AMF objects.

On Aug 31, 12:03 pm, David Koblas  wrote:
>   Funny you should ask --
>
> The basic challenge with any chat application is the long polling bit,
> django by default isn't really designed to handle that.  Other servers
> (Tornado, etc.) are much better at handling the long polling cycle that
> typical web chat applications require.
>
> I was just finishing an exploration of Django+Tornado -- building a chat
> application -- which I've now pushed up to github.
>
>      http://github.com/koblas/django-on-tornado
>
> The only "trick" at the moment is that a response that is returned via
> the async Tornado handler isn't passed back up the middleware stack,
> pondering good ways to deal with that.  But in the mean time, here's a
> functional chat application to play with if you're interested.
>
> --koblas
>
> On 8/31/10 4:34 AM, Shamail Tayyab wrote:
>
> > Hi,
>
> >   I am working on a chat application in Django, how can I ensure that
> > I do not have to poll the server for any chat data.
>
> > Possible approaches that I've been to:
>
> > 1. BAD - use polling.
>
> > 2. Use long polling - bad approach afa browser support is concerned.
>
> > 3. Using sockets in flash - makes the application flash dependent.
>
> > Is there some good way to do this? Or if there is something Django
> > specific? Something like HTTPBinding or any 3rd party tested libraries?
> > I am expected to provide support till IE6. :-(
>
> > Correct me if I am wrong, flash is available on 95% of the systems,
> > this approach looks like safest bet, is it good to go?
>
> > Btw, how does Gmail and FB chat works?
>
> > Thanks
>
> > --
> > Shamail Tayyab
> > Blog:http://shamail.in/blog

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

2010-08-31 Thread Bradley Hintze
I'm getting no where with this, are there any other suggestions on row
to render a 'please wait' page while other python works? Can I call a
view.my function to run from my 'please wait' template?

Please be as elementary as possible as javascript, AJAX, jquery, and
the like are brand new to me.

Thanks,
Bradley

On Tue, Aug 31, 2010 at 10:38 AM, Bradley Hintze
 wrote:
> I'll look into this. I have no idea what you mean by 'ajax' or 'json'.
> Thus your code doe'snt really make sense given my lack of knowlege. I
> will do some googling to see if I can piece it together. Thanks for
> the help!
>
> On Mon, Aug 30, 2010 at 10:37 PM, Rolando Espinoza La Fuente
>  wrote:
>> On Mon, Aug 30, 2010 at 7:18 PM, Bradley Hintze
>>  wrote:
>>> I am attempting to do a lengthe calculation that will require the user
>>> to wait a bit. I want a 'Please wait page to come up while the lengthy
>>> calculation is performed. I thought this might work:
>>>
>>> views.py
>>>
>>> def please_wait(request):
>>>    return HttpResponse('Please Wait..')
>>>
>>> def run_DHM(request):
>>>    please_wait(request)
>>>    lengthy calculations...
>>>
>>> This did not show the 'Please Wait' page. Is there a better way to do
>>> what I am trying to do?
>>>
>>
>> You are not returning the HttpResponse object from please_wait(). But anyway,
>> doesn't work that way. At least with django.
>>
>> What you can do is render a normal html with the message "Please wait",
>> then perform an ajax call to start the calculations and finally return
>> a json response
>> to display the result in the client-side.
>>
>> Roughly:
>>
>> def please_wait(request):
>>    # ... setup context or something
>>    return render_to_response("please_wait.html")
>>
>> def run_DHM(request)
>>    # ... perform calculations and collect the result in a dict
>>    data = {"result": something}
>>    return HttpResponse(json.dumps(data), mimetype="application/json")
>>
>>
>> # using jquery in your html
>> 
>> $.getJSON("/run_DHM/", function(data) {
>>    // do something with result
>>    console.log(data.result);
>> });
>> 
>>
>>
>> Rolando Espinoza La fuente
>> www.insophia.com
>>
>>> --
>>> Bradley J. Hintze
>>> Graduate Student
>>> Duke University
>>> School of Medicine
>>> 801-712-8799
>>>
>>> --
>>> 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.
>>
>>
>
>
>
> --
> Bradley J. Hintze
> Graduate Student
> Duke University
> School of Medicine
> 801-712-8799
>



-- 
Bradley J. Hintze
Graduate Student
Duke University
School of Medicine
801-712-8799

-- 
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: PIL on 10.6 = PAIN

2010-08-31 Thread keynesiandreamer
Thanks Bill and Mathieu!

I will try the Mac port option first, in fact I did look at it last
night probably around 1am or so...

I treied rebuilding the virtual env I was using as well just to
verify, but the problem seem higher up the stream and Bill indicated.
I will take a look for the ld.conf equiv in OSX at lunch today.

Thanks!
Ben

On Aug 31, 10:20 am, Mathieu Leduc-Hamel  wrote:
> To work with PIL and other librairies a little bit weird and difficult
> to install the best way is to install Macport and after that:
>
> port install py26-pil
>
> and you'll need to use the python of the macport installation:
>
> $ /opt/local/bin/python2.6
>
> It's the samething on linux, i'm alway using the PIL package from my distro...
>
>
>
>
>
> On Tue, Aug 31, 2010 at 7:10 PM, Bill Freeman  wrote:
> > This sounds more like libjpeg isn't on the library load path, a
> > system, rather than python, setting.
>
> > I haven't done this with a Mac, but PIL has been troublesome on *nix
> > servers for us as well.
>
> > The common problems for us don't sound like your problem.  [Some
> > versions of PIL install as "Imaging" rather than PIL.  If libjpeg
> > isn't installed first, including development data (headers, stub
> > library (called import library on Windows)) when your packaging system
> > separates them, when you first build PIL, you can rebuild it until you
> > are blue in the face and it won't pick up libjpeg that you installed
> > later - need to totally remove PIL and rebuild]
>
> > You seem to have successfully built to use libjpeg, but it isn't
> > there.  I can think of three possibilities:
>
> > 1. It really isn't there, maybe the reverse problem of installing a
> > "development" package but not the main one.
>
> > 2. It's there, but it doesn't match the version your _imagning.so was
> > built against.
>
> > 3. It's there, but the library loader hasn't been told about it.  On
> > linux this means findable via ld.conf (or ld.so.conf) and ldconfig has
> > been run since.  Package installation scripts usually take care of
> > this, but it sometimes needs to be done by hand, if you're just, for
> > example, unpacking a tarball.  I don't know the equivalent for osx.
>
> > Good luck.
>
> > Bill
>
> > On Tue, Aug 31, 2010 at 12:41 PM, keynesiandreamer
> >  wrote:
> >> Howdy!
>
> >> I have been working with Django/Pinax on a 10.6.4 system with python
> >> 2.6.6 and have had no luck getting PIL to work. I have looked through
> >> about 10-15 paged including ones listed on this group with no results.
> >> Currently the error I am getting is:
> >> The _imaging C module is not installed
>
> >> I have verified _imaging.so is in the file system. So it seems like a
> >> syspath issue. I tried verifying that in the python prompt:
>
> > import _imaging
> >> dlopen("/opt/local/Library/Frameworks/Python.framework/Versions/2.6/
> >> lib/python2.6/site-packages/PIL/_imaging.so", 2);
> >> Traceback (most recent call last):
> >>  File "", line 1, in 
> >> ImportError: dlopen(/opt/local/Library/Frameworks/Python.framework/
> >> Versions/2.6/lib/python2.6/site-packages/PIL/_imaging.so, 2): Symbol
> >> not found: _jpeg_resync_to_restart
> >>  Referenced from: /opt/local/Library/Frameworks/Python.framework/
> >> Versions/2.6/lib/python2.6/site-packages/PIL/_imaging.so
> >>  Expected in: flat namespace
> >>  in /opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/
> >> python2.6/site-packages/PIL/_imaging.so
>
> >> Any help would be greatly appreciated, too many hours stuck on this
> >> with no results.. :-(
>
> >> --
> >> 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 
> > athttp://groups.google.com/group/django-users?hl=en.
>
> --
> Mathieu Leduc-Hamel

-- 
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: Please wait page trouble

2010-08-31 Thread Alec Shaner
Rolando's suggestion is a pretty straight forward method to achieve what you
want. You probably need to elaborate where in the process you're having
trouble (although based on your response maybe it's the first step?). You
can indeed call a view.my function from your please wait template, but you
want to do it in the background, i.e., with an AJAX request in order to keep
the Please Wait message displayed while your server processes the request.

On Tue, Aug 31, 2010 at 2:46 PM, Bradley Hintze  wrote:

> I'm getting no where with this, are there any other suggestions on row
> to render a 'please wait' page while other python works? Can I call a
> view.my function to run from my 'please wait' template?
>
> Please be as elementary as possible as javascript, AJAX, jquery, and
> the like are brand new to me.
>
> Thanks,
> Bradley
>
> On Tue, Aug 31, 2010 at 10:38 AM, Bradley Hintze
>  wrote:
> > I'll look into this. I have no idea what you mean by 'ajax' or 'json'.
> > Thus your code doe'snt really make sense given my lack of knowlege. I
> > will do some googling to see if I can piece it together. Thanks for
> > the help!
> >
> > On Mon, Aug 30, 2010 at 10:37 PM, Rolando Espinoza La Fuente
> >  wrote:
> >> On Mon, Aug 30, 2010 at 7:18 PM, Bradley Hintze
> >>  wrote:
> >>> I am attempting to do a lengthe calculation that will require the user
> >>> to wait a bit. I want a 'Please wait page to come up while the lengthy
> >>> calculation is performed. I thought this might work:
> >>>
> >>> views.py
> >>>
> >>> def please_wait(request):
> >>>return HttpResponse('Please Wait..')
> >>>
> >>> def run_DHM(request):
> >>>please_wait(request)
> >>>lengthy calculations...
> >>>
> >>> This did not show the 'Please Wait' page. Is there a better way to do
> >>> what I am trying to do?
> >>>
> >>
> >> You are not returning the HttpResponse object from please_wait(). But
> anyway,
> >> doesn't work that way. At least with django.
> >>
> >> What you can do is render a normal html with the message "Please wait",
> >> then perform an ajax call to start the calculations and finally return
> >> a json response
> >> to display the result in the client-side.
> >>
> >> Roughly:
> >>
> >> def please_wait(request):
> >># ... setup context or something
> >>return render_to_response("please_wait.html")
> >>
> >> def run_DHM(request)
> >># ... perform calculations and collect the result in a dict
> >>data = {"result": something}
> >>return HttpResponse(json.dumps(data), mimetype="application/json")
> >>
> >>
> >> # using jquery in your html
> >> 
> >> $.getJSON("/run_DHM/", function(data) {
> >>// do something with result
> >>console.log(data.result);
> >> });
> >> 
> >>
> >>
> >> Rolando Espinoza La fuente
> >> www.insophia.com
> >>
> >>> --
> >>> Bradley J. Hintze
> >>> Graduate Student
> >>> Duke University
> >>> School of Medicine
> >>> 801-712-8799
> >>>
> >>> --
> >>> 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.
> >>
> >>
> >
> >
> >
> > --
> > Bradley J. Hintze
> > Graduate Student
> > Duke University
> > School of Medicine
> > 801-712-8799
> >
>
>
>
> --
> Bradley J. Hintze
> Graduate Student
> Duke University
> School of Medicine
> 801-712-8799
>
> --
> 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: PIL on 10.6 = PAIN

2010-08-31 Thread Andrew Frankel
I suffered for a couple of days trying to install PIL on snow leopard
myself just a few weeks ago. I'm on 10.6.4 as well, although I'm using
python 2.7. But most of the hurt is related to libjpeg, so that
shouldn't matter.

I eventually got everything running by following the directions posted
here: . This worked both on my personal and office machines,
so I trust the details completely.

In particular, notice the extra steps involved to build libjpeg. This
corrects the library load path problem Bill pointed out.

curl -O -L 
http://downloads.sourceforge.net/project/libjpeg/libjpeg/6b/jpegsrc.v6b.tar.gz
tar xzvf jpgscr.v6b.tar.gz
cd jpeg-6b
cp /usr/share/libtool/config/config.sub .
cp /usr/share/libtool/config/config.guess .
./configure --enable-shared --enable-static
make

You'll want to delete anything that was installed by a previous
attempt at building libjpeg before following the above. Once you build
the dependencies (jpeg and freetype2) correctly, pip is able to
install PIL quite smoothly.

I've had trouble with macports in the past, so I'm a little leery of
it. It's been particularly troublesome on snow leopard, so I've come
back to prefer plain ol' source based installs instead.

Cheers,
Andrew


On Aug 31, 2:49 pm, keynesiandreamer  wrote:
> Thanks Bill and Mathieu!
>
> I will try the Mac port option first, in fact I did look at it last
> night probably around 1am or so...
>
> I treied rebuilding the virtual env I was using as well just to
> verify, but the problem seem higher up the stream and Bill indicated.
> I will take a look for the ld.conf equiv in OSX at lunch today.
>
> Thanks!
> Ben
>
> On Aug 31, 10:20 am, Mathieu Leduc-Hamel  wrote:
>
>
>
> > To work with PIL and other librairies a little bit weird and difficult
> > to install the best way is to install Macport and after that:
>
> > port install py26-pil
>
> > and you'll need to use the python of the macport installation:
>
> > $ /opt/local/bin/python2.6
>
> > It's the samething on linux, i'm alway using the PIL package from my 
> > distro...
>
> > On Tue, Aug 31, 2010 at 7:10 PM, Bill Freeman  wrote:
> > > This sounds more like libjpeg isn't on the library load path, a
> > > system, rather than python, setting.
>
> > > I haven't done this with a Mac, but PIL has been troublesome on *nix
> > > servers for us as well.
>
> > > The common problems for us don't sound like your problem.  [Some
> > > versions of PIL install as "Imaging" rather than PIL.  If libjpeg
> > > isn't installed first, including development data (headers, stub
> > > library (called import library on Windows)) when your packaging system
> > > separates them, when you first build PIL, you can rebuild it until you
> > > are blue in the face and it won't pick up libjpeg that you installed
> > > later - need to totally remove PIL and rebuild]
>
> > > You seem to have successfully built to use libjpeg, but it isn't
> > > there.  I can think of three possibilities:
>
> > > 1. It really isn't there, maybe the reverse problem of installing a
> > > "development" package but not the main one.
>
> > > 2. It's there, but it doesn't match the version your _imagning.so was
> > > built against.
>
> > > 3. It's there, but the library loader hasn't been told about it.  On
> > > linux this means findable via ld.conf (or ld.so.conf) and ldconfig has
> > > been run since.  Package installation scripts usually take care of
> > > this, but it sometimes needs to be done by hand, if you're just, for
> > > example, unpacking a tarball.  I don't know the equivalent for osx.
>
> > > Good luck.
>
> > > Bill
>
> > > On Tue, Aug 31, 2010 at 12:41 PM, keynesiandreamer
> > >  wrote:
> > >> Howdy!
>
> > >> I have been working with Django/Pinax on a 10.6.4 system with python
> > >> 2.6.6 and have had no luck getting PIL to work. I have looked through
> > >> about 10-15 paged including ones listed on this group with no results.
> > >> Currently the error I am getting is:
> > >> The _imaging C module is not installed
>
> > >> I have verified _imaging.so is in the file system. So it seems like a
> > >> syspath issue. I tried verifying that in the python prompt:
>
> > > import _imaging
> > >> dlopen("/opt/local/Library/Frameworks/Python.framework/Versions/2.6/
> > >> lib/python2.6/site-packages/PIL/_imaging.so", 2);
> > >> Traceback (most recent call last):
> > >>  File "", line 1, in 
> > >> ImportError: dlopen(/opt/local/Library/Frameworks/Python.framework/
> > >> Versions/2.6/lib/python2.6/site-packages/PIL/_imaging.so, 2): Symbol
> > >> not found: _jpeg_resync_to_restart
> > >>  Referenced from: /opt/local/Library/Frameworks/Python.framework/
> > >> Versions/2.6/lib/python2.6/site-packages/PIL/_imaging.so
> > >>  Expected in: flat namespace
> > >>  in /opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/
> > >> python2.6/site-packages/PIL/_imaging.so
>
> > >> Any help would be greatly appreciated, too many hou

Re: Please wait page trouble

2010-08-31 Thread Bradley Hintze
Ok, I'll try to elaborate. again java is foreign to me although I've
spent all day trying to learn some.
 Here's the code:

def please_wait(request):
   # ... setup context or something
   return render_to_response("please_wait.html")

def run_DHM(request)
   # ... perform calculations and collect the result in a dict
   data = {"result": something}
   return HttpResponse(json.dumps(data), mimetype="application/json")


# using jquery in your html

$.getJSON("/run_DHM/", function(data) {
   // do something with result
   console.log(data.result);
});


def run_DHM(request) is straight forward then it falls apart.

$.getJSON("/run_DHM/", function(data) {
   // do something with result
   console.log(data.result);
});

I presume that '$.getJSON("/run_DHM/", function(data)' somehow runs
the run_DHM function? How can it even find the function since it lives
in view.py? '// do something with result' I want to send another
page to the client with the results but do I do this here? If not,
what do I do here? What does 'console.log(data.result);' do? Why does
def run_DHM(request) return a HttpResponse? I have a template I want
it to return so shouldn't I use render_to_response? Obviously, I am
not getting how the javascript works so I have no idea how to set this
up. I was hoping there was a pythonic solution :).

I hope this explains my utter confusion sufficiently.

Bradley

On Tue, Aug 31, 2010 at 4:12 PM, Alec Shaner  wrote:
> Rolando's suggestion is a pretty straight forward method to achieve what you
> want. You probably need to elaborate where in the process you're having
> trouble (although based on your response maybe it's the first step?). You
> can indeed call a view.my function from your please wait template, but you
> want to do it in the background, i.e., with an AJAX request in order to keep
> the Please Wait message displayed while your server processes the request.
>
> On Tue, Aug 31, 2010 at 2:46 PM, Bradley Hintze
>  wrote:
>>
>> I'm getting no where with this, are there any other suggestions on row
>> to render a 'please wait' page while other python works? Can I call a
>> view.my function to run from my 'please wait' template?
>>
>> Please be as elementary as possible as javascript, AJAX, jquery, and
>> the like are brand new to me.
>>
>> Thanks,
>> Bradley
>>
>> On Tue, Aug 31, 2010 at 10:38 AM, Bradley Hintze
>>  wrote:
>> > I'll look into this. I have no idea what you mean by 'ajax' or 'json'.
>> > Thus your code doe'snt really make sense given my lack of knowlege. I
>> > will do some googling to see if I can piece it together. Thanks for
>> > the help!
>> >
>> > On Mon, Aug 30, 2010 at 10:37 PM, Rolando Espinoza La Fuente
>> >  wrote:
>> >> On Mon, Aug 30, 2010 at 7:18 PM, Bradley Hintze
>> >>  wrote:
>> >>> I am attempting to do a lengthe calculation that will require the user
>> >>> to wait a bit. I want a 'Please wait page to come up while the lengthy
>> >>> calculation is performed. I thought this might work:
>> >>>
>> >>> views.py
>> >>>
>> >>> def please_wait(request):
>> >>>    return HttpResponse('Please Wait..')
>> >>>
>> >>> def run_DHM(request):
>> >>>    please_wait(request)
>> >>>    lengthy calculations...
>> >>>
>> >>> This did not show the 'Please Wait' page. Is there a better way to do
>> >>> what I am trying to do?
>> >>>
>> >>
>> >> You are not returning the HttpResponse object from please_wait(). But
>> >> anyway,
>> >> doesn't work that way. At least with django.
>> >>
>> >> What you can do is render a normal html with the message "Please wait",
>> >> then perform an ajax call to start the calculations and finally return
>> >> a json response
>> >> to display the result in the client-side.
>> >>
>> >> Roughly:
>> >>
>> >> def please_wait(request):
>> >>    # ... setup context or something
>> >>    return render_to_response("please_wait.html")
>> >>
>> >> def run_DHM(request)
>> >>    # ... perform calculations and collect the result in a dict
>> >>    data = {"result": something}
>> >>    return HttpResponse(json.dumps(data), mimetype="application/json")
>> >>
>> >>
>> >> # using jquery in your html
>> >> 
>> >> $.getJSON("/run_DHM/", function(data) {
>> >>    // do something with result
>> >>    console.log(data.result);
>> >> });
>> >> 
>> >>
>> >>
>> >> Rolando Espinoza La fuente
>> >> www.insophia.com
>> >>
>> >>> --
>> >>> Bradley J. Hintze
>> >>> Graduate Student
>> >>> Duke University
>> >>> School of Medicine
>> >>> 801-712-8799
>> >>>
>> >>> --
>> >>> 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

Breaking many-to-many connections

2010-08-31 Thread Christos Jonathan Hayward
I have an Entity which has a many-to-many field "tags" to Tags. I'm trying
to pin down a bug, and wanted a sanity check:

entity = directory.models.Entity.objects.get(id =
  int(search.group(1)))
entity.tags.remove(directory.models.Tag.objects.get(id =
  int(search.group(2
entity.save()

Is the code above, with the .tags.remove() code, enough, or do both the
Entity and the Tag need to have a call to break the link?

-- 
[image: Christos Jonathan Hayward] 
Christos Jonathan Hayward, an Orthodox Christian author.

Author Bio  • Books
 • *Email * •
Facebook
 • LinkedIn  •
Twitter
 • *Web * • What's
New?
I invite you to visit my "theology, literature, and other creative works"
site.

-- 
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: Breaking many-to-many connections

2010-08-31 Thread Christos Jonathan Hayward
I finally pinned down the problem; it was in an unrelated area.

Thanks,

On Tue, Aug 31, 2010 at 5:59 PM, Christos Jonathan Hayward <
christos.jonathan.hayw...@gmail.com> wrote:

> I have an Entity which has a many-to-many field "tags" to Tags. I'm trying
> to pin down a bug, and wanted a sanity check:
>
> entity = directory.models.Entity.objects.get(id =
>   int(search.group(1)))
> entity.tags.remove(directory.models.Tag.objects.get(id =
>   int(search.group(2
> entity.save()
>
> Is the code above, with the .tags.remove() code, enough, or do both the
> Entity and the Tag need to have a call to break the link?
>
> --
> [image: Christos Jonathan Hayward] 
> Christos Jonathan Hayward, an Orthodox Christian author.
>
> Author Bio  • 
> Books
>  • *Email * • 
> Facebook
>  • LinkedIn  • 
> Twitter
>  • *Web * • What's 
> New?
> I invite you to visit my "theology, literature, and other creative works"
> site.
>
>


-- 
[image: Christos Jonathan Hayward] 
Christos Jonathan Hayward, an Orthodox Christian author.

Author Bio  • Books
 • *Email * •
Facebook
 • LinkedIn  •
Twitter
 • *Web * • What's
New?
I invite you to visit my "theology, literature, and other creative works"
site.

-- 
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: Please wait page trouble

2010-08-31 Thread Alec Shaner
$.getJSON should be embedded in your initial Page Wait response page. The
first argument isn't a view, rather a URL. So you might want to use the
django url template tag, e.g.,

$.getJSON('{% url whatever.run_DHM %}', ...)

The second argument is a callback function. The browser stores the callback
and subsequently calls it when the url requested returns a response. It also
might be confusing because the function is defined inline (anonymous), which
is a frequent shortcut used in javascript. But anyway, when the callback
function executes he just put console.log(result.data) as way to see what
gets returned.

 You say you want to send the user to another page with the results, but you
could return a rendered chunk of html code and replace the Please Wait
message using jquery to mainupulate the DOM (jquery documentation has
tutorials). Or if you want to redirect to a new page you could store the
calculation results in the session and redirect to a view that pulls from
that same session data (or use memcached). So maybe instead of
console.log(result.data), you could use
window.location="/some/url/to/show/calculations/";

His example returns a HttpResponse just to illustrate the concept of how to
return JSON data. You don't have to return JSON, but it's a good method if
you want to return structured data. In the above example of a redirect you
could just return anything I suppose, i.e., just an 'OK'.

On Tue, Aug 31, 2010 at 5:11 PM, Bradley Hintze  wrote:

> Ok, I'll try to elaborate. again java is foreign to me although I've
> spent all day trying to learn some.
>  Here's the code:
>
> def please_wait(request):
>   # ... setup context or something
>   return render_to_response("please_wait.html")
>
> def run_DHM(request)
>   # ... perform calculations and collect the result in a dict
>   data = {"result": something}
>   return HttpResponse(json.dumps(data), mimetype="application/json")
>
>
> # using jquery in your html
> 
> $.getJSON("/run_DHM/", function(data) {
>   // do something with result
>   console.log(data.result);
> });
> 
>
> def run_DHM(request) is straight forward then it falls apart.
>
> $.getJSON("/run_DHM/", function(data) {
>   // do something with result
>   console.log(data.result);
> });
>
> I presume that '$.getJSON("/run_DHM/", function(data)' somehow runs
> the run_DHM function? How can it even find the function since it lives
> in view.py? '// do something with result' I want to send another
> page to the client with the results but do I do this here? If not,
> what do I do here? What does 'console.log(data.result);' do? Why does
> def run_DHM(request) return a HttpResponse? I have a template I want
> it to return so shouldn't I use render_to_response? Obviously, I am
> not getting how the javascript works so I have no idea how to set this
> up. I was hoping there was a pythonic solution :).
>
> I hope this explains my utter confusion sufficiently.
>
> Bradley
>
>
>

-- 
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: Chat application in Django

2010-08-31 Thread ebry1
I am interested in this problem too, I need to pass some additional
data along side chat messages.

Why did you decide to abandon polling?  I was thinking of thinking of
using it and updating about twice a second.



On Aug 31, 6:34 am, Shamail Tayyab  wrote:
> Hi,
>
>    I am working on a chat application in Django, how can I ensure that I
> do not have to poll the server for any chat data.
>
> Possible approaches that I've been to:
>
> 1. BAD - use polling.
>
> 2. Use long polling - bad approach afa browser support is concerned.
>
> 3. Using sockets in flash - makes the application flash dependent.
>
> Is there some good way to do this? Or if there is something Django
> specific? Something like HTTPBinding or any 3rd party tested libraries?
> I am expected to provide support till IE6. :-(
>
> Correct me if I am wrong, flash is available on 95% of the systems, this
> approach looks like safest bet, is it good to go?
>
> Btw, how does Gmail and FB chat works?
>
> Thanks
>
> --
> Shamail Tayyab
> Blog:http://shamail.in/blog

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

2010-08-31 Thread keynesiandreamer
So I tried the Macports option and it started to look good, but then I
got:

--->  Installing py26-pil @1.1.7_1
--->  Activating py26-pil @1.1.7_1
Error: Target org.macports.activate returned: Image error: /opt/local/
Library/Frameworks/Python.framework/Versions/2.6/bin/pilconvert.py
already exists and does not belong to a registered port.  Unable to
activate port py26-pil. Use 'port -f activate py26-pil' to force the
activation.
Log for py26-pil is at: /opt/local/var/macports/logs/
_opt_local_var_macports_sources_rsync.macports.org_release_ports_python_py26-
pil/main.log
Error: Status 1 encountered during processing.
To report a bug, see 
Ben-Jammin-MacBook:~ martinek$ port -f activate py26-pil
Warning: Failed to open Portfile from registry for py26-pil @1.1.7_1
--->  Activating py26-pil
Error: port activate failed: sqlite error: attempt to write a readonly
database (8)
Ben-Jammin-MacBook:~ martinek$ sudo port install py26-pil

Sudo didn't work either
:-(

I am not even sure what DB is being discussed there...

I also tried reinstalling PIL after the failure of MacPorts and
something might have worked here. I don't get the same problem at the
python prompt trying import _imaging

Unfortunately Django/Pinax doesn't seem to see this after reactivating
the ENV and restarting the server:

BLurghh!!!

Is it worth trying to remake the virtualenv I am working with? Would
that help or is the problem still up the stream?

-Ben

On Aug 31, 11:49 am, keynesiandreamer 
wrote:
> Thanks Bill and Mathieu!
>
> I will try the Mac port option first, in fact I did look at it last
> night probably around 1am or so...
>
> I treied rebuilding the virtual env I was using as well just to
> verify, but the problem seem higher up the stream and Bill indicated.
> I will take a look for the ld.conf equiv in OSX at lunch today.
>
> Thanks!
> Ben
>
> On Aug 31, 10:20 am, Mathieu Leduc-Hamel  wrote:
>
>
>
> > To work with PIL and other librairies a little bit weird and difficult
> > to install the best way is to install Macport and after that:
>
> > port install py26-pil
>
> > and you'll need to use the python of the macport installation:
>
> > $ /opt/local/bin/python2.6
>
> > It's the samething on linux, i'm alway using the PIL package from my 
> > distro...
>
> > On Tue, Aug 31, 2010 at 7:10 PM, Bill Freeman  wrote:
> > > This sounds more like libjpeg isn't on the library load path, a
> > > system, rather than python, setting.
>
> > > I haven't done this with a Mac, but PIL has been troublesome on *nix
> > > servers for us as well.
>
> > > The common problems for us don't sound like your problem.  [Some
> > > versions of PIL install as "Imaging" rather than PIL.  If libjpeg
> > > isn't installed first, including development data (headers, stub
> > > library (called import library on Windows)) when your packaging system
> > > separates them, when you first build PIL, you can rebuild it until you
> > > are blue in the face and it won't pick up libjpeg that you installed
> > > later - need to totally remove PIL and rebuild]
>
> > > You seem to have successfully built to use libjpeg, but it isn't
> > > there.  I can think of three possibilities:
>
> > > 1. It really isn't there, maybe the reverse problem of installing a
> > > "development" package but not the main one.
>
> > > 2. It's there, but it doesn't match the version your _imagning.so was
> > > built against.
>
> > > 3. It's there, but the library loader hasn't been told about it.  On
> > > linux this means findable via ld.conf (or ld.so.conf) and ldconfig has
> > > been run since.  Package installation scripts usually take care of
> > > this, but it sometimes needs to be done by hand, if you're just, for
> > > example, unpacking a tarball.  I don't know the equivalent for osx.
>
> > > Good luck.
>
> > > Bill
>
> > > On Tue, Aug 31, 2010 at 12:41 PM, keynesiandreamer
> > >  wrote:
> > >> Howdy!
>
> > >> I have been working with Django/Pinax on a 10.6.4 system with python
> > >> 2.6.6 and have had no luck getting PIL to work. I have looked through
> > >> about 10-15 paged including ones listed on this group with no results.
> > >> Currently the error I am getting is:
> > >> The _imaging C module is not installed
>
> > >> I have verified _imaging.so is in the file system. So it seems like a
> > >> syspath issue. I tried verifying that in the python prompt:
>
> > > import _imaging
> > >> dlopen("/opt/local/Library/Frameworks/Python.framework/Versions/2.6/
> > >> lib/python2.6/site-packages/PIL/_imaging.so", 2);
> > >> Traceback (most recent call last):
> > >>  File "", line 1, in 
> > >> ImportError: dlopen(/opt/local/Library/Frameworks/Python.framework/
> > >> Versions/2.6/lib/python2.6/site-packages/PIL/_imaging.so, 2): Symbol
> > >> not found: _jpeg_resync_to_restart
> > >>  Referenced from: /opt/local/Library/Frameworks/Python.framework/
> > >> Versions/2.6/lib/python2.6/site-packages/PIL/_imaging.so
> > >>  Expected in: flat namesp

Re: set utf8 as default database char set

2010-08-31 Thread Lachlan Musicman
On Tue, Aug 31, 2010 at 23:52, Elim Qiu  wrote:

> I just feel kind of redundant to have the same text in and above the
> textfields.


This is a result of the tutorial - they aren't always the same :)



>

And also the odd table layout that makes choice fields and votes' fields so
> apart; and doubt if I did something wrong.
>
> At the moment, I only care about following the tutorial correctly. If you
> think it looks fine, then it's fine and I'll move forward:)
>
> Thanks Karen
>
>
> On Tue, Aug 31, 2010 at 5:10 AM, Karen Tracey  wrote:
>
>> On Tue, Aug 31, 2010 at 3:14 AM, Elim Qiu  wrote:
>>
>>> I'm in tutorial 2. Looks like I did something wrong. Please help. thanks
>>> See the image attached
>>>
>>
>> The image looks fine to me. What do you see that you think is wrong?
>>
>> Karen
>> --
>> http://tracey.org/kmt/
>>
>>  --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To post to this group, send email to django-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.
>



-- 
These simple functions belong to a sub-class known as strictly dominating
functions, meaning that their output is always bigger than their inputs. A
striking fact, known as the complementation theorem, holds for all such
functions. It says there is always an infinite collection of inputs that
when fed into the function will produce a collection of outputs that is
precisely the non-inputs.
- http://bit.ly/d3Fsrw

-- 
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: {% csrf_token %} template tag not outputting the hidden field

2010-08-31 Thread Erik
Hi Daniel-
 Thanks for your response.
 No, I wasn't generating the form within django; I had hand coded
a form into the page; because I had intended that this form appear on
every page in the side.
 I'll try it as you suggest and report back.  This may involve
learning how to write template tags.

thanks,
Erik


On Aug 30, 4:16 pm, Daniel Lathrop  wrote:
> I may misunderstand how csrf_token works, but I think it needs to be used in
> conjunction with the forms system, which would require you to pass a form to
> your template. Are you doing that?
>
> Daniel Lathrop
> News Applications Editor
> The Dallas Morning News
> ---
> Daniel Lathrop
> 206.718.0349 (cell)
>
>
>
> On Mon, Aug 30, 2010 at 11:46 AM, Erik  wrote:
> > Hi Django Users-
> >     I'm having trouble with the {% csrf_token %} tag.
> >     On my site I have a regular login view / page / url, which uses
> > the django contrib registration app.  I include the CSRF token in my
> > login template and it works fine.
> >     I'd also like a little login box in the corner of every page,
> > which will either show a login form or a "you're logged in!" message
> > depending on whether the user is logged in.  So, I wrote a little form
> > into my base.html template that other templates inherit from; and I
> > stuck the {% csrf_token %} tag in there as well.
> >     The part I don't understand is, if I load the login url in the
> > browser ( mysite.com/login/ ) both forms work, I can login with them,
> > and when I view the source the CSRF token tag has put a hidden field
> > into my form.
> >     However, when I'm on any other page - for example the front page
> > - the token tag just leaves a blank space and doesn't output anything,
> > but it doesn't give me an error message on loading the page - as it
> > would when I try to use a token tag that doesn't exist - such as {%
> > faketokentag  %}.  Of course, because the csrf token tag doesn't
> > create any output (in the HTML source generated) when the form is
> > submitted the CSRF error occurs.
> >     I'm rendering all such pages with the generic view
> > direct_to_template , which, because it's a generic view, the
> > documentation suggests should just work with CSRF.
> >     Does anyone have any suggestions?
>
> > Thank you,
> > Erik
>
> > --
> > 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 > groups.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: Django UserProfile's - the hardest part of the whole framework

2010-08-31 Thread bruno desthuilliers
(snip 'programming by accident' code)

I'm not sure you really understand what you're doing :-/


> > > Here's my problem, I know you don't get direct access to the user
> > > model,
>
> > Yes you do.
>
> > > so making the user email editable is kind of tricky
>
> > Why so ?
>
> you can't query for a user with request.user

Query what ?

> but I can with user_id as
> above.

Where exactly ?

> > I personnaly don't use a ModelForm for user profiles - since you
> > (usually) have to mix&match data from both the user and profile
> > models, I find it simpler to use a plain forms.Form and handle the
> > fields/models mapping, saving etc by myself
>
> Do you have an example, I keep piecing together stuff from the b-list
> etc.

Yeps, that's what your code looks like - copy/paste without true
undrestanding...

Here's a (shortened and simplified) snippet:

class ProfileForm(forms.Form):
# User fields
first_name = forms.CharField(
label=_("First name"),
max_length=30
)

last_name = forms.CharField(
label=_("Last name"),
max_length=30
)

email = forms.EmailField(
label=_("E-mail"),
max_length=128,
help_text=_(u"ex : pre...@exemple.com")
)

_USER_FIELDS = (
'first_name',
'last_name',
'email'
)

# Profile fields
address1 = forms.CharField(
label=_("Address 1"),
max_length=80
)

address2 = forms.CharField(
label=_("Address 2"),
max_length=80,
required=False
)

postcode = forms.CharField(
label=_("Postcode"),
max_length=10, # should be enough for most cases ? NB : max 8
in current dataset
required=False# no postcode for IR ???
)

town = forms.CharField(
label=_("Town"),
max_length=100
)


#
--
def _from_model(self, name):
if name in self._USER_FIELDS:
return getattr(self.user, name)
else:
return getattr(self.profile, name)

#
--
def _to_model(self, name, value):
if name in self._USER_FIELDS:
setattr(self.user, name, value)
else:
setattr(self.profile, name, value)

#
--
def __init__(self, profile, *args, **kw):
self.prefix = kw.get("prefix", None)
data = kw.pop('data', {}).copy()

self.profile = profile
self.user = user = profile.user

for name in self.base_fields:
data.setdefault(self.add_prefix(name),
self._from_model(name))

kw['data'] = data
super(ProfileForm, self).__init__(*args, **kw)


#
--
def save(self):
if not self.is_valid():
raise ValueError("trying to save an invalid form")

# XXX : handle transaction here ?
self.user.save()
self.profile.save()

return self.profile, self.user

#
--
#
--
@login_required
@csrf_protect
def profile_edit(request, *args, **kw):
user = request.user
profile = user.get_profile()

if request.method == "POST":
profile_form = ProfileForm(profile, data=request.POST)
if profile_form.is_valid():
profile_form.save()
user.message_set.create(message=_("Your profile has been
modified successfully"))
return HttpResponseRedirect(reverse("core_profile_edit"))
else:
profile_form = ProfileForm(profile)

context = dict(
profile=profile,
profile_form=profile_form,
)

return render_to_response(
"core/profile_edit.html",
context,
context_instance=RequestContext(request)
)


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

2010-08-31 Thread Trent Mick
You could try ActivePython:

   http://www.activestate.com/activepython/downloads

Then

{{{
$ pypm install pil
The following packages will be installed to ~/.local (2.6):
 pil-1.1.7-1
Get: [pypm-free.activestate.com] pil 1.1.7-1
Installing pil-1.1.7-1
Fixing script ~/.local/bin/pilconvert.py
Fixing script ~/.local/bin/pildriver.py
Fixing script ~/.local/bin/pilfile.py
Fixing script ~/.local/bin/pilprint.py
[22:17:39 tre...@boa:~/Movies/tech]
$ python
ActivePython 2.6.6.15 (ActiveState Software Inc.) based on
Python 2.6.6 (r266:84292, Aug 24 2010, 16:02:28)
[GCC 4.2.1 (Apple Inc. build 5664)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import _imaging
}}}



Trent

-- 
Trent Mick

-- 
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: Chat application in Django

2010-08-31 Thread Shamail Tayyab
Hi,

@Jeff, Erlang! Pretty surprised to see that.
@Alexander, doesn't work :( - or might be I am not able to get it..
@David, cool I'll try this, but will this work using mod_python / Apache?
@ebry1,
Imagine 1 people live chatting, that means 1 requests per
second, but in real world, only 3000 messages might have been
delivered. (as example). Polling will bring your net throughput of the
server to almost one tenth.

@all,
Can you suggest me the side effects of using Sockets via 1x1px flash
applet embedded on the page? Apart from the fact that flash is
required.

Thanks

On Wed, Sep 1, 2010 at 5:23 AM, ebry1  wrote:
> I am interested in this problem too, I need to pass some additional
> data along side chat messages.
>
> Why did you decide to abandon polling?  I was thinking of thinking of
> using it and updating about twice a second.
>
>
>
> On Aug 31, 6:34 am, Shamail Tayyab  wrote:
>> Hi,
>>
>>    I am working on a chat application in Django, how can I ensure that I
>> do not have to poll the server for any chat data.
>>
>> Possible approaches that I've been to:
>>
>> 1. BAD - use polling.
>>
>> 2. Use long polling - bad approach afa browser support is concerned.
>>
>> 3. Using sockets in flash - makes the application flash dependent.
>>
>> Is there some good way to do this? Or if there is something Django
>> specific? Something like HTTPBinding or any 3rd party tested libraries?
>> I am expected to provide support till IE6. :-(
>>
>> Correct me if I am wrong, flash is available on 95% of the systems, this
>> approach looks like safest bet, is it good to go?
>>
>> Btw, how does Gmail and FB chat works?
>>
>> Thanks
>>
>> --
>> Shamail Tayyab
>> Blog:http://shamail.in/blog
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To post to this group, send email to django-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.
>
>



-- 
Shamail Tayyab
Blog: http://shamail.in/blog

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