Re: [Forms] Avoiding Repetition

2011-06-22 Thread Nikhil Somaru
Andre, you're right.

But a subclass would probably save me one line:
model = OrderItem

The rest follows a pattern but is otherwise unique. I'm going to look into
dynamic forms as suggested by Derek

On Tue, Jun 21, 2011 at 5:42 PM, Andre Terra  wrote:

> I'm reading this on my phone, so I apologize in advice if I missed
> something crucial, but what's stopping you from subclassing and
> overriding just the relevant parts?
>
> Sincerely,
> Andre Terra
>
> On 6/17/11, Nikhil Somaru  wrote:
> > Hi,
> >
> > Is there a way to reduce the repetition in the following form classes:
> >
> > class ItemsStep2(ModelForm): #approval
> > class Meta:
> > model = OrderItem
> > fields = ('item', 'quantity_requested', 'quantity_approved')
> > widgets = {
> > 'quantity_requested':
> TextInput(attrs={'readonly':'readonly'})
> >  }
> >
> >
> > class ItemsStep3(ModelForm): #ship
> > class Meta:
> > model = OrderItem
> > fields = ('item', 'quantity_requested', 'quantity_approved')
> > widgets = {
> > 'quantity_requested':
> TextInput(attrs={'readonly':'readonly'}),
> > 'quantity_approved': TextInput(attrs={'readonly':'readonly'})
> >  }
> >
> >
> > class ItemsStep4(ModelForm): #confirm receipt
> > class Meta:
> > model = OrderItem
> > fields = ('item', 'quantity_requested', 'quantity_approved',
> > 'quantity_received')
> > widgets = {
> > 'quantity_requested':
> TextInput(attrs={'readonly':'readonly'}),
> > 'quantity_approved': TextInput(attrs={'readonly':'readonly'})
> >  }
> >
> >
> > class ItemsStep5(ModelForm): #order summary
> > class Meta:
> > model = OrderItem
> > fields = ('item', 'quantity_requested', 'quantity_approved',
> > 'quantity_received')
> > widgets = {
> > 'quantity_requested':
> TextInput(attrs={'readonly':'readonly'}),
> > 'quantity_approved':
> TextInput(attrs={'readonly':'readonly'}),
> > 'quantity_received':
> TextInput(attrs={'readonly':'readonly'}),
> >  }
> >
> > The model that uses these forms has a ForeignKey (Order hasMany
> OrderItems)
> > to an associated model that has a attribute "step" (order_instance.step)
> > which determines the class above to use (this code is in views)
> >
> > Thanks in advance.
> > --
> > Yours,
> > Nikhil Somaru
> >
> > --
> > You received this message because you are subscribed to the Google Groups
> > "Django users" group.
> > To post to this group, send email to django-users@googlegroups.com.
> > To unsubscribe from this group, send email to
> > django-users+unsubscr...@googlegroups.com.
> > For more options, visit this group at
> > http://groups.google.com/group/django-users?hl=en.
> >
> >
>
> --
> Sent from my mobile device
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>


-- 
Yours,
Nikhil Somaru

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



Re: updating a user form?

2011-06-22 Thread raj
nevermind, i figured it out. thanks anyway

On Jun 22, 5:11 pm, raj  wrote:
> I think I'm starting to get the hang of it a little. I was able to
> extract the data from the profile and set it as the initial value.
> From what I understand, you would like me to set each user field one
> at a time, but if I have 20-30 fields that need to be updated at once,
> I'm at a loss. The way that I have my files set up is that I have a
> view with the following code:
> ### views.py ###
> def profileFields(request):
>     user = request.user
>     if request.method == 'POST':
>         form = userProf(request.POST)
>         if form.is_valid():
>             user = form.save(request.POST, user)
>             return HttpResponseRedirect('/user/update/success')
>     else:
>         form = userProf(instance=user.get_profile())
>     return render_to_response("/home/oneadmin/webapps/oneadmin/
> oneadmin/templates/oneadmissions/profile.html", {'form': form},
> context_instance = RequestContext(request))
>
> now my userProf form module has the following save function:
> def save(self, new_data, user):
>         user.get_profile().colleges = new_data['colleges']
>         .dozen other new_data fields would go here...
>         user.save()
>         return user
>
> From what I understand, you want me to put the save information in the
> views.py file, but my actual form class is in a different document. So
> i decided that it would be better to put it there. Am I on the right
> track? Why isn't any information actually being updated?
>
> On Jun 22, 5:05 am, Herman Schistad  wrote:
>
>
>
>
>
>
>
> > On Wed, Jun 22, 2011 at 10:14, raj  wrote:
> > > If I didn't have the url
> > > set up in this manner, how would I manage to extract the userprofile?
>
> > If you have the "AuthenticationMiddleware" activated you would use 
> > request.user
> > This returns a User object, which you then can use to further edit things.
>
> > E.g.
> > user = request.user
> > user.username = "Somethingnew"
> > user.save()
>
> > Or, as Kevin Renskers said, you would create a seperate model for the
> > userprofile if you wanted to extend it. Here you will need to get the
> > user profile with user.get_profile() and remember to set the
> > following: AUTH_PROFILE_MODULE = "myapp.mysiteprofile"
>
> > Then you could use the above example like this:
> > user = request.user
> > user.get_profile().homepage = "http://example.org;
> > user.save()
>
> > --
> > With regards, Herman Schistad

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



Re: Want to give a talk at Djangocon, the time to submit is now

2011-06-22 Thread Kenneth Gonsalves
On Thu, 2011-06-23 at 07:13 +0800, Russell Keith-Magee wrote:
> In the interim, the best option is your local Python conference;
> PyCon.AU, PyCon.NZ or PyCon.APAC. 

and as already mentionedS
http://in.pycon.org/2011/
-- 
regards
KG
http://lawgon.livejournal.com
Coimbatore LUG rox
http://ilugcbe.techstud.org/

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



Creating an instance of a subclass when superclass instance already exists

2011-06-22 Thread Matt Gardner
Hello all,

I have a model hierarchy in my django app, and there is one very
important task that I do not know how to do.  I have a bunch of
instances of the superclass (Word is the model name), and on input
from a user I want to create a subclass instance (Verb) from that
superclass instance.  For example, I might have code like this:

>>> word = Word.objects.get(pk=[input from user])
>>> verb = Verb.createFromSuperclassInstance(word)
>>> verb.save()

The only problem is that I know of no such
"createFromSuperclassInstance" method, nor where to look for it.  I do
know how to do this through the database itself (just add a row to the
verb table with the correct foreign key), but I was hoping django
would provide some nice way to do it without me having to explicitly
write SQL.  The Verb class's __init__ method creates a new Word
instance, so that doesn't work, unless there's a way to use it that I
don't know about.

Any help?

Thanks,
Matt

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



Re: how to display form data with original values after validation failure?

2011-06-22 Thread snfctech
Figured it out - you have to populate both fs._errors _and_ loop
through each form in the formset and populate its _errors attribute,
as well.

On Jun 22, 2:50 pm, snfctech  wrote:
> Hi, Michal.
>
> I tried that, but the errors don't get rendered for some reason (see
> my first post).
>
> Tony
>
> On Jun 22, 1:59 pm, Michał Sawicz  wrote:
>
>
>
>
>
>
>
> > Dnia 2011-06-22, śro o godzinie 13:44 -0700, snfctech pisze:
>
> > > Which passes the form with the same post data and some error messages
> > > back to the user.
>
> > Maybe you could just reinstantiate a clean RegistrationFormSet without
> > passing request.POST to it? Maybe copying errors from the original,
> > bound one.
>
> > Just my c2.
>
> > Cheers
> > --
> > Michał (Saviq) Sawicz 
>
> >  signature.asc
> > < 1KViewDownload

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



Re: Possible interest in a webcast/presentation about Django site with 40mil+ rows of data??

2011-06-22 Thread Cal Leeming [Simplicity Media Ltd]
I was thinking.. what would be really nice would be a monkey patch that
could catch any inserts/updates/saves from the ORM, and defer them until the
user triggered the bulk update some how.. That way, DSE would be completely
interchangeable with existing code, making it much more likely for people to
adopt it.


On Wed, Jun 22, 2011 at 11:39 PM, Thomas Weholt wrote:

> On Wed, Jun 22, 2011 at 4:47 PM, Cal Leeming [Simplicity Media Ltd]
>  wrote:
> >
> >
> > On Wed, Jun 22, 2011 at 3:25 PM, Andre Terra 
> wrote:
> >>
> >> Hello, Cal
> >>
> >> First of all, congrats on the newborn! The Django community will surely
> >> benefit from having yet another success story, especially considering
> how
> >> big this project sounds. Is there any chance you could open-source some
> of
> >> your custom made improvements so that they could eventually be merged to
> >> trunk?
> >
> > Thank you! Yeah, the plan is to release as much of the improvements as
> open
> > source as possible. Although I'd rely heavily on the community to make
> them
> > 'patch worthy' for the core, as the amount of spare time I have is
> somewhat
> > limited.
> > The improvements list is growing by the day, and I usually try and post
> as
> > many snippets as I can, and/or tickets etc.
> > It sounds like Thomas's DSE might be the perfect place for the bulk
> update
> > code too.
>
> FYI: Inspired by this discussion I've allready started on a similar
> feature ( allthough somewhat simplified ) for DSE v2.2.0 and you're
> right; the speed increase is huge using the method described here,
> even compared to my current solution ( using cursor.executemany ),
> which is considerably faster than the django orm allready. My testing
> so far have been using postgresql, not sure how mysql will perform. I
> expect to release DSE v.2.2.0 with this feature in the next few days.
>
> --
> Mvh/Best regards,
> Thomas Weholt
> http://www.weholt.org
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>

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



Re: Possible interest in a webcast/presentation about Django site with 40mil+ rows of data??

2011-06-22 Thread william ratcliff
Definitely looking forward to it!

On Wed, Jun 22, 2011 at 6:50 PM, Cal Leeming [Simplicity Media Ltd] <
cal.leem...@simplicitymedialtd.co.uk> wrote:

> Nice!
>
> On Wed, Jun 22, 2011 at 11:39 PM, Thomas Weholt 
> wrote:
>
>> On Wed, Jun 22, 2011 at 4:47 PM, Cal Leeming [Simplicity Media Ltd]
>>  wrote:
>> >
>> >
>> > On Wed, Jun 22, 2011 at 3:25 PM, Andre Terra 
>> wrote:
>> >>
>> >> Hello, Cal
>> >>
>> >> First of all, congrats on the newborn! The Django community will surely
>> >> benefit from having yet another success story, especially considering
>> how
>> >> big this project sounds. Is there any chance you could open-source some
>> of
>> >> your custom made improvements so that they could eventually be merged
>> to
>> >> trunk?
>> >
>> > Thank you! Yeah, the plan is to release as much of the improvements as
>> open
>> > source as possible. Although I'd rely heavily on the community to make
>> them
>> > 'patch worthy' for the core, as the amount of spare time I have is
>> somewhat
>> > limited.
>> > The improvements list is growing by the day, and I usually try and post
>> as
>> > many snippets as I can, and/or tickets etc.
>> > It sounds like Thomas's DSE might be the perfect place for the bulk
>> update
>> > code too.
>>
>> FYI: Inspired by this discussion I've allready started on a similar
>> feature ( allthough somewhat simplified ) for DSE v2.2.0 and you're
>> right; the speed increase is huge using the method described here,
>> even compared to my current solution ( using cursor.executemany ),
>> which is considerably faster than the django orm allready. My testing
>> so far have been using postgresql, not sure how mysql will perform. I
>> expect to release DSE v.2.2.0 with this feature in the next few days.
>>
>
> Nice! Looking forward to seeing this :)
>
>
>>
>> --
>> Mvh/Best regards,
>> Thomas Weholt
>> http://www.weholt.org
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To post to this group, send email to django-users@googlegroups.com.
>> To unsubscribe from this group, send email to
>> django-users+unsubscr...@googlegroups.com.
>> For more options, visit this group at
>> http://groups.google.com/group/django-users?hl=en.
>>
>>
>  --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>

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



Re: Want to give a talk at Djangocon, the time to submit is now

2011-06-22 Thread Russell Keith-Magee
On Thu, Jun 23, 2011 at 12:15 AM, Addy Yeow  wrote:
> Any plan to host Djangcon in Asia?

This exact question was asked (and answered) on django-users
yesterday. There aren't any current plans for a DjangoCon.AU, NZ, or
APAC. What is required is an interested group from the community to
organize the conference. If such a group emerges, the Django Software
Foundation will do whatever it can to assist.

In the interim, the best option is your local Python conference;
PyCon.AU, PyCon.NZ or PyCon.APAC.

Yours,
Russ Magee %-)

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



Re: Possible interest in a webcast/presentation about Django site with 40mil+ rows of data??

2011-06-22 Thread Cal Leeming [Simplicity Media Ltd]
Nice!

On Wed, Jun 22, 2011 at 11:39 PM, Thomas Weholt wrote:

> On Wed, Jun 22, 2011 at 4:47 PM, Cal Leeming [Simplicity Media Ltd]
>  wrote:
> >
> >
> > On Wed, Jun 22, 2011 at 3:25 PM, Andre Terra 
> wrote:
> >>
> >> Hello, Cal
> >>
> >> First of all, congrats on the newborn! The Django community will surely
> >> benefit from having yet another success story, especially considering
> how
> >> big this project sounds. Is there any chance you could open-source some
> of
> >> your custom made improvements so that they could eventually be merged to
> >> trunk?
> >
> > Thank you! Yeah, the plan is to release as much of the improvements as
> open
> > source as possible. Although I'd rely heavily on the community to make
> them
> > 'patch worthy' for the core, as the amount of spare time I have is
> somewhat
> > limited.
> > The improvements list is growing by the day, and I usually try and post
> as
> > many snippets as I can, and/or tickets etc.
> > It sounds like Thomas's DSE might be the perfect place for the bulk
> update
> > code too.
>
> FYI: Inspired by this discussion I've allready started on a similar
> feature ( allthough somewhat simplified ) for DSE v2.2.0 and you're
> right; the speed increase is huge using the method described here,
> even compared to my current solution ( using cursor.executemany ),
> which is considerably faster than the django orm allready. My testing
> so far have been using postgresql, not sure how mysql will perform. I
> expect to release DSE v.2.2.0 with this feature in the next few days.
>

Nice! Looking forward to seeing this :)


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

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



Re: Possible interest in a webcast/presentation about Django site with 40mil+ rows of data??

2011-06-22 Thread Cal Leeming [Simplicity Media Ltd]
Nice, seems like there is a lot of positive feedback.

Here's some further info about the webcast/webinar:

*Expected Date:* July/August
*Expected Time:* Somewhere between 9AM - 9PM GMT+0 (UK Time), I'll probably
run a webpage vote so you guys can decide.
*Via:* GoToWebinar - screen share with voip.
*Length:* 1 hour max for actual presentation, 5 minute break, then another 1
hour max for Q
*Presentation Size: *1920x1080 (1080p)

There will be some basic slides (to keep things structured), but the
majority of the time will be spent inside the browser + IDE + shell etc.

Cal


On Wed, Jun 22, 2011 at 10:49 PM, Mishen'ka wrote:

> I really like the idea, hope i can see it soon.
>
> Interessting thanks
>
> On 22 jun, 15:15, "Cal Leeming [Simplicity Media Ltd]"
>  wrote:
> > Hi all,
> >
> > Some of you may have noticed, in the last few months I've done quite a
> few
> > posts/snippets about handling large data sets in Django. At the end of
> this
> > month (after what seems like a lifetime of trial and error), we're
> finally
> > going to be releasing a new site which holds around 40mil+ rows of data,
> > grows by about 300-500k rows each day, handles 5GB of uploads per day,
> and
> > can handle around 1024 requests per second on stress test on a moderately
> > spec'd server.
> >
> > As the entire thing is written in Django (and a bunch of other open
> source
> > products), I'd really like to give something back to the community.
> (stack
> > incls Celery/RabbitMQ/Sphinx SE/PYQuery/Percona
> > MySQL/NGINX/supervisord/debian etc)
> >
> > Therefore, I'd like to see if there would be any interest in webcast in
> > which I would explain how we handle such large amounts of data, the trial
> > and error processes we went through, some really neat tricks we've done
> to
> > avoid bottlenecks, our own approach to smart content filtering, and some
> of
> > the valuable lessons we have learned. The webcast would be completely
> free
> > of charge, last a couple of hours (with a short break) and anyone can
> > attend. I'd also offer up a Q session at the end.
> >
> > If you're interested, please reply on-list so others can see.
> >
> > Thanks
> >
> > Cal
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>

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



Re: Possible interest in a webcast/presentation about Django site with 40mil+ rows of data??

2011-06-22 Thread Thomas Weholt
On Wed, Jun 22, 2011 at 4:47 PM, Cal Leeming [Simplicity Media Ltd]
 wrote:
>
>
> On Wed, Jun 22, 2011 at 3:25 PM, Andre Terra  wrote:
>>
>> Hello, Cal
>>
>> First of all, congrats on the newborn! The Django community will surely
>> benefit from having yet another success story, especially considering how
>> big this project sounds. Is there any chance you could open-source some of
>> your custom made improvements so that they could eventually be merged to
>> trunk?
>
> Thank you! Yeah, the plan is to release as much of the improvements as open
> source as possible. Although I'd rely heavily on the community to make them
> 'patch worthy' for the core, as the amount of spare time I have is somewhat
> limited.
> The improvements list is growing by the day, and I usually try and post as
> many snippets as I can, and/or tickets etc.
> It sounds like Thomas's DSE might be the perfect place for the bulk update
> code too.

FYI: Inspired by this discussion I've allready started on a similar
feature ( allthough somewhat simplified ) for DSE v2.2.0 and you're
right; the speed increase is huge using the method described here,
even compared to my current solution ( using cursor.executemany ),
which is considerably faster than the django orm allready. My testing
so far have been using postgresql, not sure how mysql will perform. I
expect to release DSE v.2.2.0 with this feature in the next few days.

-- 
Mvh/Best regards,
Thomas Weholt
http://www.weholt.org

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



Re: how to display form data with original values after validation failure?

2011-06-22 Thread snfctech
Hi, Michal.

I tried that, but the errors don't get rendered for some reason (see
my first post).

Tony

On Jun 22, 1:59 pm, Michał Sawicz  wrote:
> Dnia 2011-06-22, śro o godzinie 13:44 -0700, snfctech pisze:
>
> > Which passes the form with the same post data and some error messages
> > back to the user.
>
> Maybe you could just reinstantiate a clean RegistrationFormSet without
> passing request.POST to it? Maybe copying errors from the original,
> bound one.
>
> Just my c2.
>
> Cheers
> --
> Michał (Saviq) Sawicz 
>
>  signature.asc
> < 1KViewDownload

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



Re: Possible interest in a webcast/presentation about Django site with 40mil+ rows of data??

2011-06-22 Thread Mishen'ka
I really like the idea, hope i can see it soon.

Interessting thanks

On 22 jun, 15:15, "Cal Leeming [Simplicity Media Ltd]"
 wrote:
> Hi all,
>
> Some of you may have noticed, in the last few months I've done quite a few
> posts/snippets about handling large data sets in Django. At the end of this
> month (after what seems like a lifetime of trial and error), we're finally
> going to be releasing a new site which holds around 40mil+ rows of data,
> grows by about 300-500k rows each day, handles 5GB of uploads per day, and
> can handle around 1024 requests per second on stress test on a moderately
> spec'd server.
>
> As the entire thing is written in Django (and a bunch of other open source
> products), I'd really like to give something back to the community. (stack
> incls Celery/RabbitMQ/Sphinx SE/PYQuery/Percona
> MySQL/NGINX/supervisord/debian etc)
>
> Therefore, I'd like to see if there would be any interest in webcast in
> which I would explain how we handle such large amounts of data, the trial
> and error processes we went through, some really neat tricks we've done to
> avoid bottlenecks, our own approach to smart content filtering, and some of
> the valuable lessons we have learned. The webcast would be completely free
> of charge, last a couple of hours (with a short break) and anyone can
> attend. I'd also offer up a Q session at the end.
>
> If you're interested, please reply on-list so others can see.
>
> Thanks
>
> Cal

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



Re: I need to create a Django WebService to be consumed by AspNet

2011-06-22 Thread David Markey
Xml-rpc or SOAP?

On 22 June 2011 22:19, Emmanuel Rojas  wrote:

> Hi,
>
> I was test a lot of tutorials in internet but I can´t get it yet, I do
> not understand how to create a web service in Django, would you help
> me?
>
> Thanks in advance
> Emmanuel
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>

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



Re: Possible interest in a webcast/presentation about Django site with 40mil+ rows of data??

2011-06-22 Thread serek
Great idea.
I also would like to see this webcast

On Jun 22, 6:00 pm, "Cal Leeming [Simplicity Media Ltd]"
 wrote:
> On Wed, Jun 22, 2011 at 4:55 PM, creecode  wrote:
> > Hello SleepyCal,
>
> > On Wednesday, June 22, 2011 6:15:48 AM UTC-7, SleepyCal wrote:
>
> > If you're interested, please reply on-list so others can see.
>
> > +1
>
> > Also if the webcast could be stored for later viewing that would be grand.
>
> Yup, I'm planning on recording in 1080p and posting on Youtube shortly
> afterwards.
>
>
>
>
>
>
>
>
>
> > Toodle-loo..
> > creecode
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "Django users" group.
> > To view this discussion on the web visit
> >https://groups.google.com/d/msg/django-users/-/SZabiWnq_S0J.
>
> > To post to this group, send email to django-users@googlegroups.com.
> > To unsubscribe from this group, send email to
> > django-users+unsubscr...@googlegroups.com.
> > For more options, visit this group at
> >http://groups.google.com/group/django-users?hl=en.

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



I need to create a Django WebService to be consumed by AspNet

2011-06-22 Thread Emmanuel Rojas
Hi,

I was test a lot of tutorials in internet but I can´t get it yet, I do
not understand how to create a web service in Django, would you help
me?

Thanks in advance
Emmanuel

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



Re: updating a user form?

2011-06-22 Thread raj
I think I'm starting to get the hang of it a little. I was able to
extract the data from the profile and set it as the initial value.
>From what I understand, you would like me to set each user field one
at a time, but if I have 20-30 fields that need to be updated at once,
I'm at a loss. The way that I have my files set up is that I have a
view with the following code:
### views.py ###
def profileFields(request):
user = request.user
if request.method == 'POST':
form = userProf(request.POST)
if form.is_valid():
user = form.save(request.POST, user)
return HttpResponseRedirect('/user/update/success')
else:
form = userProf(instance=user.get_profile())
return render_to_response("/home/oneadmin/webapps/oneadmin/
oneadmin/templates/oneadmissions/profile.html", {'form': form},
context_instance = RequestContext(request))

now my userProf form module has the following save function:
def save(self, new_data, user):
user.get_profile().colleges = new_data['colleges']
.dozen other new_data fields would go here...
user.save()
return user

>From what I understand, you want me to put the save information in the
views.py file, but my actual form class is in a different document. So
i decided that it would be better to put it there. Am I on the right
track? Why isn't any information actually being updated?


On Jun 22, 5:05 am, Herman Schistad  wrote:
> On Wed, Jun 22, 2011 at 10:14, raj  wrote:
> > If I didn't have the url
> > set up in this manner, how would I manage to extract the userprofile?
>
> If you have the "AuthenticationMiddleware" activated you would use 
> request.user
> This returns a User object, which you then can use to further edit things.
>
> E.g.
> user = request.user
> user.username = "Somethingnew"
> user.save()
>
> Or, as Kevin Renskers said, you would create a seperate model for the
> userprofile if you wanted to extend it. Here you will need to get the
> user profile with user.get_profile() and remember to set the
> following: AUTH_PROFILE_MODULE = "myapp.mysiteprofile"
>
> Then you could use the above example like this:
> user = request.user
> user.get_profile().homepage = "http://example.org;
> user.save()
>
> --
> With regards, Herman Schistad

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



Re: how to display form data with original values after validation failure?

2011-06-22 Thread Michał Sawicz
Dnia 2011-06-22, śro o godzinie 13:44 -0700, snfctech pisze:
> Which passes the form with the same post data and some error messages
> back to the user. 

Maybe you could just reinstantiate a clean RegistrationFormSet without
passing request.POST to it? Maybe copying errors from the original,
bound one.

Just my c2.

Cheers
-- 
Michał (Saviq) Sawicz 


signature.asc
Description: This is a digitally signed message part


Re: Possible interest in a webcast/presentation about Django site with 40mil+ rows of data??

2011-06-22 Thread Malcolm Box
On 22 June 2011 14:15, Cal Leeming [Simplicity Media Ltd] <
cal.leem...@simplicitymedialtd.co.uk> wrote:

> Hi all,
>
> Therefore, I'd like to see if there would be any interest in webcast in
> which I would explain how we handle such large amounts of data, the trial
> and error processes we went through, some really neat tricks we've done to
> avoid bottlenecks, our own approach to smart content filtering, and some of
> the valuable lessons we have learned. The webcast would be completely free
> of charge, last a couple of hours (with a short break) and anyone can
> attend. I'd also offer up a Q session at the end.
>
> If you're interested, please reply on-list so others can see.
>

Count me in.

Malcolm

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



Re: how to display form data with original values after validation failure?

2011-06-22 Thread snfctech
Hi, Kevin.  Thanks for your reply.

I actually don't want to show the entered values - I basically want
the original form with values prior to the user submitting the form -
but with the validation errors that prompt them to enter new values in
the proper fields.  I have already overridden the particular field's
clean method (clean_guests), but I don't understand how to preserve
the field's original value.

class RegistrationForm(ModelForm):
guests = forms.IntegerField(error_messages={'invalid': 'Please
enter a number greater than zero.'})

# enforce role/price limits
def clean_guests(self):
data = self.cleaned_data['guests']
if self.instance.price.parent.price_limit:
spaces_available = self.instance.price.spaces_available
delta = data - self.instance.guests
if delta > 0:
if spaces_available == 1 and delta > 1:
print self.instance.guests
raise forms.ValidationError("There is only 1 more
space available for this role.")
elif spaces_available > 1 and delta >
spaces_available:
raise forms.ValidationError("There are only %s
more spaces available for this role." % spaces_available)
else:
raise forms.ValidationError("Sorry, there are no
more spaces available for this role.")

return data

class Meta:
model = JosJeventsRegistration
fields = ['id', 'guests']

My view creates the form with the POST data in the standard fashion:

if request.method == 'POST':
fs = RegistrationFormSet(request.POST)
if fs.is_valid():
...

Which passes the form with the same post data and some error messages
back to the user.

On Jun 22, 1:14 am, Kevin Renskers  wrote:
> If I understand this correctly, then you want something like this?
>
> 1) Show a form to edit something
> 2) User changes fields, submits the form
> 3) If the form was not valid, not only show the errors and the form with the
> entered values, but also the *old* values, pre-edit.
>
> I think your best bet is to create custom valid_field() validation functions
> in the form class, which access the form instance to show the old values in
> the error message.

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



Share connection between Django and SqlAlchemy

2011-06-22 Thread Vladimir Mihailenco
I am trying to share connection between Django and SqlAlchemy. I tried
following code:

from django.db import connection
from sqlalchemy import create_engine

def get_connection():
if connection.connection is None:
connection._cursor()  # TODO: better way to open new
connection?
return connection.connection

engine = create_engine('postgresql+psycopg2://',
   creator=get_connection)
engine.execute(s) # s - SqlAlchemy query

But this results in various fails in SqlAchemy (like connection is
already closed, can't execute some queries). More details are
available here: 
http://stackoverflow.com/questions/6439119/django-and-sqlalchemy-share-connection

So I have following question:

- does anyone know working solution?
- how big will be performance impact if I use separate connection for
Django and SqlAlchemy?
- any explanations why current code is not working :)

Thanks.

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



Re: templatetags and refresh

2011-06-22 Thread Daniel Roseman
On Wednesday, 22 June 2011 14:32:10 UTC+1, Wim Feijen wrote:
>
> Hello, 
>
> At www.mkb-rotterdam.nl we use a template tag to display NewsItems in 
> different formats on the homepage. 
>
> However, when a new NewsItem is added, it does not appear at once. 
>
> Might this have to do with the fact that we use a template tag to get 
> the NewsItems out of the db? 
>
> Our query is: 
>
> newsitems = NewsItem.objects.filter(Q(expires_at__gt = datetime.now()) 
> | Q(expires_at__isnull = True), effective_at__lte = datetime.now(), 
> is_active=True).order_by('-news_timestamp') 
>
> Or is datetime.now() fixed to the past? 
>
> What would be a proper way to solve this then? Maybe add a post-save 
> signal but how could we use this then to refresh the tag? 
>
> If something else is the matter, or just if you're interested: we host 
> our site using a virtual apache + mod_wsgi + nginx. 
>
> Thanks for your help! 
>
> Wim 
>
>
>
Please show the full code for the templatetag.
--
DR. 

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



Re: WMD-editor: Where's wmd/urls.py?

2011-06-22 Thread Micky Hulse
On Wed, Jun 22, 2011 at 1:20 AM, Kevin Renskers  wrote:
> I think it's an error in the documentation. Since there are no views, it's
> probable that there are no urls as well.

Everything works perfectly if I ignore the part about the urls.py file. :D

Thanks Kevin!

Have a great day.

Cheers,
Micky

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



Re: making instance of auth User results in: maximum recursion depth exceeded while calling a Python object

2011-06-22 Thread Karen Tracey
No, you're not stupid. The only reason I could guess what the problem was is
I've seen it done many times. Many languages would complain about the
"redefinition"; Python just quietly does what you tell it and re-binds the
name to a new value. That can actually be a very useful feature, but it also
lets you shoot yourself in the foot when it's not really what you intended
to do.

Karen

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



Re: Possible interest in a webcast/presentation about Django site with 40mil+ rows of data??

2011-06-22 Thread creecode
Hello SleepyCal,

On Wednesday, June 22, 2011 9:00:15 AM UTC-7, SleepyCal wrote:

Yup, I'm planning on recording in 1080p and posting on Youtube shortly 
> afterwards.
>

Fantastic!

Thank you,

Toodle-l...
creecode 

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



Multiple Inheritence of Abstract Base Model Classes, or plain Mixins?

2011-06-22 Thread br
I asked a similar question a few days ago but got no response.  Since
then, I've poked around SO and come up with a few potential ways to do
it, but wonder if there is a *correct* Django way to do it or if there
are hidden problems lurking behind one of them.

Basically I have a few different base concepts for models and would
like to mix and match them . . . Organizational, Taggable, and
TimeStamped .

I've been using Abstract base models for each, but wonder if Mixins
(where there is no inner "Meta" class with abstract=True, and does not
extend from models.Model) is better for some reason than having each
be an abstract base model and using multiple inheritance for each
child class that needs these properties.  Mixins were suggested to me
on SO, but it seems that Abstract models were created just for this
sort of thing . . . just haven't seen them used with multiple
inheritance.

Anyone have any guidance here, or is it 6 cents one way half a dozen
the other. . .

Ben

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



Re: WMD-editor: Where's wmd/urls.py?

2011-06-22 Thread Micky Hulse
On Wed, Jun 22, 2011 at 1:20 AM, Kevin Renskers  wrote:
> I think it's an error in the documentation. Since there are no views, it's
> probable that there are no urls as well.

Hehe, that's a great point!

I did not think about looking inside the views.py file. :(

Thanks Kevin!

Cheers,
Micky

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



Re: Want to give a talk at Djangocon, the time to submit is now

2011-06-22 Thread Sean O'Connor
Not by the organizers of Djangocon.US. So far, each of the regional conferences 
(djangocon.us, djangocon.eu, djangoski, etc) have been organized by independent 
organizations. That being said, we do all collaborate to some extent. Should 
anybody be interested in organizing a Djangocon in Asia, I and I'm sure other 
organizers would be happy to provide guidance and support in what ever ways we 
can.

-- 
Sean O'Connor
http://www.seanoc.com

On Wednesday, June 22, 2011 at 12:15 PM, Addy Yeow wrote:

> Any plan to host Djangcon in Asia?
> 
> On Thu, Jun 23, 2011 at 12:08 AM, Sean O'Connor  (mailto:sean.b.ocon...@gmail.com)> wrote:
> > Hey Everybody,
> > 
> > I know we're a bit late this year but the new Djangocon.US 
> > (http://Djangocon.US) site is finally up and we are accepting talk 
> > proposals today. 
> > 
> > Unfortunately, thanks to our lateness we will only be able to accept 
> > proposals for the next two weeks. This means if you want to have a chance 
> > to speak at this year's Djangocon, you need to get your proposal in ASAP. 
> > 
> > You can read more about submitting a proposal at 
> > http://djangocon.us/blog/2011/06/22/call-papers/ and feel free to contact 
> > me directly if you have any questions or concerns. 
> > 
> > -Sean O'Connor
> > s...@seanoc.com (mailto:s...@seanoc.com)
> > 
> >  -- 
> >  You received this message because you are subscribed to the Google Groups 
> > "Django users" group.
> >  To view this discussion on the web visit 
> > https://groups.google.com/d/msg/django-users/-/5cZtk6GOBNIJ.
> >  To post to this group, send email to django-users@googlegroups.com 
> > (mailto:django-users@googlegroups.com).
> >  To unsubscribe from this group, send email to 
> > django-users+unsubscr...@googlegroups.com 
> > (mailto:django-users%2bunsubscr...@googlegroups.com).
> >  For more options, visit this group at 
> > http://groups.google.com/group/django-users?hl=en.
> 
> 
> 
> -- 
> http://www.dazzlepod.com . http://twitter.com/dazzlepod
>  We write elegant and minimal apps that works. We develop web apps with 
> Django framework.
>  -- 
>  You received this message because you are subscribed to the Google Groups 
> "Django users" group.
>  To post to this group, send email to django-users@googlegroups.com 
> (mailto:django-users@googlegroups.com).
>  To unsubscribe from this group, send email to 
> django-users+unsubscr...@googlegroups.com 
> (mailto:django-users+unsubscr...@googlegroups.com).
>  For more options, visit this group at 
> http://groups.google.com/group/django-users?hl=en.

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



Re: Want to give a talk at Djangocon, the time to submit is now

2011-06-22 Thread Addy Yeow
Any plan to host Djangcon in Asia?

On Thu, Jun 23, 2011 at 12:08 AM, Sean O'Connor wrote:

> Hey Everybody,
>
> I know we're a bit late this year but the new Djangocon.US site is finally
> up and we are accepting talk proposals today.
>
> Unfortunately, thanks to our lateness we will only be able to accept
> proposals for the next* *two weeks.  This means if you want to have a
> chance to speak at this year's Djangocon, you need to get your proposal in
> ASAP.
>
> You can read more about submitting a proposal at
> http://djangocon.us/blog/2011/06/22/call-papers/ and feel free to contact
> me directly if you have any questions or concerns.
>
> -Sean O'Connor
> s...@seanoc.com
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/django-users/-/5cZtk6GOBNIJ.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>



-- 
http://www.dazzlepod.com . http://twitter.com/dazzlepod
We write elegant and minimal apps that works. We develop web apps with
Django framework.

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



Want to give a talk at Djangocon, the time to submit is now

2011-06-22 Thread Sean O'Connor
Hey Everybody,

I know we're a bit late this year but the new Djangocon.US site is finally 
up and we are accepting talk proposals today.

Unfortunately, thanks to our lateness we will only be able to accept 
proposals for the next* *two weeks.  This means if you want to have a chance 
to speak at this year's Djangocon, you need to get your proposal in ASAP.

You can read more about submitting a proposal 
at http://djangocon.us/blog/2011/06/22/call-papers/ and feel free to contact 
me directly if you have any questions or concerns.

-Sean O'Connor
s...@seanoc.com

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



Re: Possible interest in a webcast/presentation about Django site with 40mil+ rows of data??

2011-06-22 Thread Brian Bouterse
+1 for making it viewable after the fact

On Wed, Jun 22, 2011 at 11:55 AM, creecode  wrote:

> Hello SleepyCal,
>
>
> On Wednesday, June 22, 2011 6:15:48 AM UTC-7, SleepyCal wrote:
>
> If you're interested, please reply on-list so others can see.
>
>
> +1
>
> Also if the webcast could be stored for later viewing that would be grand.
>
> Toodle-loo..
> creecode
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/django-users/-/SZabiWnq_S0J.
>
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>



-- 
Brian Bouterse
ITng Services

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



Re: Possible interest in a webcast/presentation about Django site with 40mil+ rows of data??

2011-06-22 Thread Cal Leeming [Simplicity Media Ltd]
On Wed, Jun 22, 2011 at 4:55 PM, creecode  wrote:

> Hello SleepyCal,
>
>
> On Wednesday, June 22, 2011 6:15:48 AM UTC-7, SleepyCal wrote:
>
> If you're interested, please reply on-list so others can see.
>
>
> +1
>
> Also if the webcast could be stored for later viewing that would be grand.
>

Yup, I'm planning on recording in 1080p and posting on Youtube shortly
afterwards.


>
> Toodle-loo..
> creecode
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/django-users/-/SZabiWnq_S0J.
>
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>

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



Re: how to set up user profile in django-registration ?

2011-06-22 Thread Shawn Milochik

On 06/22/2011 11:41 AM, Satyajit Sarangi wrote:

Now I get a database error

relation "registration_userprofile" does not exist
LINE 1: ..."."id", "registration_userprofile"."user_id" FROM "registrat...



That looks like a migration/syncdb issue. Either you added a field to an 
already-synced model or you created a model and didnt' do a syncdb.


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



Re: Possible interest in a webcast/presentation about Django site with 40mil+ rows of data??

2011-06-22 Thread creecode
Hello SleepyCal,

On Wednesday, June 22, 2011 6:15:48 AM UTC-7, SleepyCal wrote:

If you're interested, please reply on-list so others can see.


+1

Also if the webcast could be stored for later viewing that would be grand.

Toodle-loo..
creecode 

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



Re: Possible interest in a webcast/presentation about Django site with 40mil+ rows of data??

2011-06-22 Thread Anurag Chourasia
I am in :-)

On Wed, Jun 22, 2011 at 11:39 AM, Ivan Aleman  wrote:

>
>
> On 22 June 2011 08:15, Cal Leeming [Simplicity Media Ltd] <
> cal.leem...@simplicitymedialtd.co.uk> wrote:
>
>>
>> If you're interested, please reply on-list so others can see.
>>
>>
>>
> Sweet! Count me in :)
>
>
>>
>>
> --
> Iván
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>

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



Re: templatetags and refresh

2011-06-22 Thread Michał Sawicz
Dnia 2011-06-22, śro o godzinie 06:32 -0700, Wim Feijen pisze:
> Our query is:
> 
> newsitems = NewsItem.objects.filter(Q(expires_at__gt = datetime.now())
> | Q(expires_at__isnull = True), effective_at__lte = datetime.now(),
> is_active=True).order_by('-news_timestamp')
> 
> Or is datetime.now() fixed to the past? 

You're probably gonna have to elaborate on your code, but did you try
datetime.now without calling it? IIUC that helps here and there, not
sure it will in your particular case.
-- 
Michał (Saviq) Sawicz 


signature.asc
Description: This is a digitally signed message part


Re: how to set up user profile in django-registration ?

2011-06-22 Thread Satyajit Sarangi
Now I get a database error

relation "registration_userprofile" does not exist
LINE 1: ..."."id", "registration_userprofile"."user_id" FROM "registrat...



On Wed, Jun 22, 2011 at 8:58 PM, Shawn Milochik  wrote:

> On 06/22/2011 11:25 AM, Satyajit Sarangi wrote:
>
>> Traceback:
>>
>>  60.url(r'^profile/$',UserProfile,**
>> name='UserProfile'),
>>
>> Exception Type: NameError at /accounts/profile/
>> Exception Value: name 'UserProfile' is not defined
>>
>>
> It appears that you have a view named UserProfile in your views.py but it's
> not imported into urls.py, so you get the 'is not defined' message.
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to django-users+unsubscribe@**
> googlegroups.com .
> For more options, visit this group at http://groups.google.com/**
> group/django-users?hl=en
> .
>
>


-- 
*Satyajit Sarangi*

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



Re: Possible interest in a webcast/presentation about Django site with 40mil+ rows of data??

2011-06-22 Thread Ivan Aleman
On 22 June 2011 08:15, Cal Leeming [Simplicity Media Ltd] <
cal.leem...@simplicitymedialtd.co.uk> wrote:

>
> If you're interested, please reply on-list so others can see.
>
>
>
Sweet! Count me in :)


>
>
-- 
Iván

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



Re: django page loads forever

2011-06-22 Thread Shawn Milochik

On 06/22/2011 11:26 AM, jay K. wrote:

Hello, everyone

I have a django page which loads indefinitely

some of the javascript that is supposed to come up does not appear on
the screen (while
the page is still loading), but i checked with firebugs and there are
no error messages at all

any advice would be helpful

thanks

jay k

Put some logging statements in the view and see if it finishes. Instead 
of just returning your render or render_to_response, assign it to a 
variable, print it out in the log, then return the variable.


This will help you determine whether the problem is in the view (view 
logic or template rendering) or a JS/other problem in your browser.



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



Re: how to set up user profile in django-registration ?

2011-06-22 Thread Shawn Milochik

On 06/22/2011 11:25 AM, Satyajit Sarangi wrote:

Traceback:
  60.   
 url(r'^profile/$',UserProfile,name='UserProfile'),


Exception Type: NameError at /accounts/profile/
Exception Value: name 'UserProfile' is not defined



It appears that you have a view named UserProfile in your views.py but 
it's not imported into urls.py, so you get the 'is not defined' message.


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



django page loads forever

2011-06-22 Thread jay K.

Hello, everyone

I have a django page which loads indefinitely

some of the javascript that is supposed to come up does not appear on
the screen (while
the page is still loading), but i checked with firebugs and there are
no error messages at all

any advice would be helpful

thanks

jay k

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



Re: how to set up user profile in django-registration ?

2011-06-22 Thread Satyajit Sarangi
Traceback:
File "/usr/local/lib/python2.6/dist-packages/django/core/handlers/base.py"
in get_response
  101. request.path_info)
File "/usr/local/lib/python2.6/dist-packages/django/core/urlresolvers.py" in
resolve
  252. sub_match = pattern.resolve(new_path)
File "/usr/local/lib/python2.6/dist-packages/django/core/urlresolvers.py" in
resolve
  250. for pattern in self.url_patterns:
File "/usr/local/lib/python2.6/dist-packages/django/core/urlresolvers.py" in
_get_url_patterns
  279. patterns = getattr(self.urlconf_module, "urlpatterns",
self.urlconf_module)
File "/usr/local/lib/python2.6/dist-packages/django/core/urlresolvers.py" in
_get_urlconf_module
  274. self._urlconf_module = import_module(self.urlconf_name)
File "/usr/local/lib/python2.6/dist-packages/django/utils/importlib.py" in
import_module
  35. __import__(name)
File "/usr/local/lib/python2.6/dist-packages/registration/urls.py" in

  60.
 url(r'^profile/$',UserProfile,name='UserProfile'),

Exception Type: NameError at /accounts/profile/
Exception Value: name 'UserProfile' is not defined

On Wed, Jun 22, 2011 at 8:52 PM, Shawn Milochik  wrote:

> On 06/22/2011 11:21 AM, Satyajit Sarangi wrote:
>
>> These are my steps .
>> 1. Not using django-profile
>> 2. Create my own view to show the profile by using user.get_profile()
>> 3. Created my own view and also a model in django-registration to view the
>> profile .
>> 4 . Did changes to urls.py  url(r'^profile/$',register.**
>> UserProfile,name='user.get_**profile()'),
>>
>> But this is giving me an error here .
>>
>>
> What's the error? Please provide the full stack trace.
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to django-users+unsubscribe@**
> googlegroups.com .
> For more options, visit this group at http://groups.google.com/**
> group/django-users?hl=en
> .
>
>


-- 
*Satyajit Sarangi*

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



Re: how to set up user profile in django-registration ?

2011-06-22 Thread Satyajit Sarangi
These are my steps .
1. Not using django-profile
2. Create my own view to show the profile by using user.get_profile()
3. Created my own view and also a model in django-registration to view the
profile .
4 . Did changes to
urls.py  url(r'^profile/$',register.UserProfile,name='user.get_profile()'),

But this is giving me an error here .

On Wed, Jun 22, 2011 at 8:48 PM, Piotr Zalewa  wrote:

> On 06/22/11 16:09, Satyajit Sarangi wrote:
>
>> I am using django registration , which is not displaying any profile
>> when I log in . Thus I am not able to login . What should I do to
>> overcome this ?
>>
>>
> I assume you've been reading docs already. (django-registration and django
> user management ones, possibly also the django first project tutorial).
> Could you provide which steps you've already taken?
>
> zalun
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to django-users+unsubscribe@**
> googlegroups.com .
> For more options, visit this group at http://groups.google.com/**
> group/django-users?hl=en
> .
>
>


-- 
*Satyajit Sarangi*

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



Re: how to set up user profile in django-registration ?

2011-06-22 Thread Piotr Zalewa

On 06/22/11 16:09, Satyajit Sarangi wrote:

I am using django registration , which is not displaying any profile
when I log in . Thus I am not able to login . What should I do to
overcome this ?



I assume you've been reading docs already. (django-registration and 
django user management ones, possibly also the django first project 
tutorial).

Could you provide which steps you've already taken?

zalun

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



how to set up user profile in django-registration ?

2011-06-22 Thread Satyajit Sarangi
I am using django registration , which is not displaying any profile
when I log in . Thus I am not able to login . What should I do to
overcome this ?

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



Re: Possible interest in a webcast/presentation about Django site with 40mil+ rows of data??

2011-06-22 Thread Andre Terra
On Wed, Jun 22, 2011 at 11:47 AM, Cal Leeming [Simplicity Media Ltd] <
cal.leem...@simplicitymedialtd.co.uk> wrote:

>
>
> On Wed, Jun 22, 2011 at 3:25 PM, Andre Terra  wrote:
>
>>  Hello, Cal
>>
>> First of all, congrats on the newborn! The Django community will surely
>> benefit from having yet another success story, especially considering how
>> big this project sounds. Is there any chance you could open-source some of
>> your custom made improvements so that they could eventually be merged to
>> trunk?
>>
>
> Thank you! Yeah, the plan is to release as much of the improvements as open
> source as possible. Although I'd rely heavily on the community to make them
> 'patch worthy' for the core, as the amount of spare time I have is somewhat
> limited.
>
> The improvements list is growing by the day, and I usually try and post as
> many snippets as I can, and/or tickets etc.
>
> It sounds like Thomas's DSE might be the perfect place for the bulk update
> code too.
>

Thanks a lot for the quick reply. I'll keep my eyes open for the code, and
if unable to contribute with relevant modifications to the patches, I'll at
least try to doc and test them!



> I definitely noticed how you mentioned large dbs in the past few months. I,
>> along with many others I assume, would surely like to attend the webcast,
>> with the only impediment being my schedule/timezone.
>>
>
> Once we've got a list of all the people who want to attend, I'll send out a
> mail asking for everyones timezone and availability, so we can figure out
> what is best for everyone.
>

Definitely write me up for the list of attendees, then!



>  I recently asked about working with temporary tables for
>> filtering/grouping data from uploads and inserting queries from that
>> temporary table onto a permanent database. To make matters worse, I wanted
>> to make this as flexible as possible (i.e. dynamic models) so that
>> everything could be managed from a web app. Do you have any experience you
>> could share about any of these use cases? As far as I know, there's nothing
>> in the ORM that replicates PostgreSQL's CREATE TEMPORARY TABLE. My
>> experience with SQL is rather limited, but from asking around, it seems like
>> my project could indeed benefit from such a feature. If I had to guess, I
>> would assume other DBMSs would offer something similar, but being limited to
>> Postgres is okay for me, for now, anyway.
>>
>
> I haven't had any exposure to Postgres, but my experience with temporary
> tables hasn't been a nice one (in regards to MySQL at least). MySQL has many
> gotchas when it comes to temporary tables and indexing, and on more than one
> occasion, I found it was actually quicker to analyse/mangle/re-insert the
> data via Python code, than it was to attempt the modifications within MySQL
> using a temporary table.
>
> It really does depend on what your data is, and what you want to do with
> it, which can make planning ahead somewhat tedious lol.
>
> For our stuff, when we need to do bulk modifications, we have a filtering
> rules list which is ran every hour against new rows (with is_checked=1 set
> on rows which have been checked). We then use bulk queries of 50k (id >= 0
> AND id < 5), rather than using LIMIT/OFFSET (because LIMIT/OFFSET gets
> slower and slower the larger the result set). Those queries are
> analysed/mangled within a transaction, and bulk updated using the method
> mentioned in the reply to Thomas.
>
> Sadly though, I can't say if the methods we use would be suitable for you,
> as we haven't tried it against Postgres, and we've only tested it against
> our own data set + requirements. This is what I mean by trial and error,
> it's a pain in the ass :)
>


Thanks again for your enlightening input. Even with our different
requirements, this was actually quite relevant as far as solving several
doubts I had on how to go about this project.


Cheers,

André


On Wed, Jun 22, 2011 at 10:56 AM, Cal Leeming [Simplicity Media Ltd] <
cal.leem...@simplicitymedialtd.co.uk> wrote:

> Also, the 13.8 minutes per million, is basically a benchmark based on the
> amount of db writes, and the total amount of time it took to execute (which
> was 51s).
>
> Please also note, this code is doing a *heavy* amount of content analysis,
> but if you were to strip that out, the only overheads would be the
> map/filter/lambda, the time it takes to transmit to MySQL, and the time it
> takes for MySQL to perform the writes.
>
> The database hardware spec is:
>
> 1x X3440 quad core (2 cores assigned to MySQL).
> 12GB memory (4 GB assigned to MySQL).
> /var/lib/mysql mapped to 2x Intel M3 SSD drives in RAID 1.
>
> Cal
>
>
> On Wed, Jun 22, 2011 at 2:52 PM, Cal Leeming [Simplicity Media Ltd] <
> cal.leem...@simplicitymedialtd.co.uk> wrote:
>
>> Sorry, let me explain a little better.
>>
>
(...)

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

Re: Unit-Testing Dilemma

2011-06-22 Thread Nan

> Use Mock and assert_called_with:
> http://www.voidspace.org.uk/python/mock/mock.html#mock.Mock.assert_ca...
> In this case you'd set theAPI.call as your mock and check that under 
> different conditions it is called correctly.

Oh, perfect -- thank you, that will help a lot!

> You don't need mocks or dependency injection in this case. Just separate the
> message construction code, so you can test it in isolation:

Yeah, it looks like that may be a next step, but I'm hesitant to do
even that much refactoring without tests already in place, due to the
complexity and fragility of the logic.

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



Re: Possible interest in a webcast/presentation about Django site with 40mil+ rows of data??

2011-06-22 Thread Cal Leeming [Simplicity Media Ltd]
On Wed, Jun 22, 2011 at 3:25 PM, Andre Terra  wrote:

> Hello, Cal
>
> First of all, congrats on the newborn! The Django community will surely
> benefit from having yet another success story, especially considering how
> big this project sounds. Is there any chance you could open-source some of
> your custom made improvements so that they could eventually be merged to
> trunk?
>

Thank you! Yeah, the plan is to release as much of the improvements as open
source as possible. Although I'd rely heavily on the community to make them
'patch worthy' for the core, as the amount of spare time I have is somewhat
limited.

The improvements list is growing by the day, and I usually try and post as
many snippets as I can, and/or tickets etc.

It sounds like Thomas's DSE might be the perfect place for the bulk update
code too.


>
> I definitely noticed how you mentioned large dbs in the past few months. I,
> along with many others I assume, would surely like to attend the webcast,
> with the only impediment being my schedule/timezone.
>

Once we've got a list of all the people who want to attend, I'll send out a
mail asking for everyones timezone and availability, so we can figure out
what is best for everyone.


>
> I recently asked about working with temporary tables for filtering/grouping
> data from uploads and inserting queries from that temporary table onto a
> permanent database. To make matters worse, I wanted to make this as flexible
> as possible (i.e. dynamic models) so that everything could be managed from a
> web app. Do you have any experience you could share about any of these use
> cases? As far as I know, there's nothing in the ORM that replicates
> PostgreSQL's CREATE TEMPORARY TABLE. My experience with SQL is rather
> limited, but from asking around, it seems like my project could indeed
> benefit from such a feature. If I had to guess, I would assume other DBMSs
> would offer something similar, but being limited to Postgres is okay for me,
> for now, anyway.
>

I haven't had any exposure to Postgres, but my experience with temporary
tables hasn't been a nice one (in regards to MySQL at least). MySQL has many
gotchas when it comes to temporary tables and indexing, and on more than one
occasion, I found it was actually quicker to analyse/mangle/re-insert the
data via Python code, than it was to attempt the modifications within MySQL
using a temporary table.

It really does depend on what your data is, and what you want to do with it,
which can make planning ahead somewhat tedious lol.

For our stuff, when we need to do bulk modifications, we have a filtering
rules list which is ran every hour against new rows (with is_checked=1 set
on rows which have been checked). We then use bulk queries of 50k (id >= 0
AND id < 5), rather than using LIMIT/OFFSET (because LIMIT/OFFSET gets
slower and slower the larger the result set). Those queries are
analysed/mangled within a transaction, and bulk updated using the method
mentioned in the reply to Thomas.

Sadly though, I can't say if the methods we use would be suitable for you,
as we haven't tried it against Postgres, and we've only tested it against
our own data set + requirements. This is what I mean by trial and error,
it's a pain in the ass :)



>
>
>
> Cheers,
> André
>
>
> On Wed, Jun 22, 2011 at 10:56 AM, Cal Leeming [Simplicity Media Ltd] <
> cal.leem...@simplicitymedialtd.co.uk> wrote:
>
>> Also, the 13.8 minutes per million, is basically a benchmark based on the
>> amount of db writes, and the total amount of time it took to execute (which
>> was 51s).
>>
>> Please also note, this code is doing a *heavy* amount of content analysis,
>> but if you were to strip that out, the only overheads would be the
>> map/filter/lambda, the time it takes to transmit to MySQL, and the time it
>> takes for MySQL to perform the writes.
>>
>> The database hardware spec is:
>>
>> 1x X3440 quad core (2 cores assigned to MySQL).
>> 12GB memory (4 GB assigned to MySQL).
>> /var/lib/mysql mapped to 2x Intel M3 SSD drives in RAID 1.
>>
>> Cal
>>
>>
>> On Wed, Jun 22, 2011 at 2:52 PM, Cal Leeming [Simplicity Media Ltd] <
>> cal.leem...@simplicitymedialtd.co.uk> wrote:
>>
>>> Sorry, let me explain a little better.
>>>
>>> (51.98s) Found 49659 objs (match: 16563) (db writes: 51180) (range:
>>> 72500921 ~ 72550921), (avg 16.9 mins/million) - [('is_checked',
>>> 49659), ('is_image_blocked', 0), ('has_link', 1517), ('is_spam', 4)]
>>>
>>> map(lambda x: (x[0], len(x[1])), _obj_incs.iteritems()) = [('is_checked',
>>> 49659), ('is_image_blocked', 0), ('has_link', 1517), ('is_spam', 4)]
>>>
>>> In the above example, it has found 49659 rows which need 'is_checked'
>>> changing to the value '1' (same principle applied to the other 3), giving a
>>> total of 51,130 database writes, split into 4 queries.
>>>
>>> Those 4 fields have the IDs assigned to them:
>>>
>>> if _f == 'block_images':
>>>
>>> 

Re: Possible interest in a webcast/presentation about Django site with 40mil+ rows of data??

2011-06-22 Thread Cal Leeming [Simplicity Media Ltd]
Hmm, that's odd, the grouping (map/reduce/filter/lambda) is extremely quick
for me (even on a heavy data set).

My guess is that grouping would need to be done on a combination of field
name+value, and would need to allow the user to specify what bulk to use (to
prevent MemoryError exception - or find some way to reduce the bulk when
MemoryError is encountered).

If you end up introducing it into 3.0, I'll definitely be interested in
taking a look at the code :)

Cal

On Wed, Jun 22, 2011 at 3:17 PM, Thomas Weholt wrote:

> On Wed, Jun 22, 2011 at 3:52 PM, Cal Leeming [Simplicity Media Ltd]
>  wrote:
> > Sorry, let me explain a little better.
> > (51.98s) Found 49659 objs (match: 16563) (db writes: 51180) (range:
> > 72500921 ~ 72550921), (avg 16.9 mins/million) - [('is_checked',
> > 49659), ('is_image_blocked', 0), ('has_link', 1517), ('is_spam', 4)]
> > map(lambda x: (x[0], len(x[1])), _obj_incs.iteritems()) = [('is_checked',
> > 49659), ('is_image_blocked', 0), ('has_link', 1517), ('is_spam', 4)]
> > In the above example, it has found 49659 rows which need 'is_checked'
> > changing to the value '1' (same principle applied to the other 3), giving
> a
> > total of 51,130 database writes, split into 4 queries.
> > Those 4 fields have the IDs assigned to them:
> > if _f == 'block_images':
> >
> > _obj_incs.get('is_image_blocked').append(_hit_id)
> > if _parent_id:
> >
> > _obj_incs.get('is_image_blocked').append(_parent_id)
> > Then I loop through those fields, and do an update() using the necessary
> > IDs:
> > # now apply the obj changes in bulk (massive speed
> > improvements)
> > for _key, _value in _obj_incs.iteritems():
> > # update the child object
> > Post.objects.filter(
> > id__in = _value
> > ).update(
> > **{
> > _key : 1
> > }
> > )
> > So in simple terms, we're not doing 51 thousand update queries, instead
> > we're grouping them into bulk queries based on the row to be updated. It
> > doesn't yet to grouping based on key AND value, simply because we didn't
> > need it at the time, but if we release the code for public use,
> > we'd definitely add this in.
> > Hope this makes sense, let me know if I didn't explain it very well lol.
> > Cal
>
> Actually, I started working on something similar, but tried to find
> sets of fields, instead of just updating one field pr update, but
> didn't finish it because the actual grouping of the fields seem to
> take alot of time/cpu/memory. Perhaps if I focused on updating one
> field at the time it would be simpler. Might look at it again for DSE
> 3.0 ;-)
>
> Thomas
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>

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



Re: Possible interest in a webcast/presentation about Django site with 40mil+ rows of data??

2011-06-22 Thread Andre Terra
Hello, Cal

First of all, congrats on the newborn! The Django community will surely
benefit from having yet another success story, especially considering how
big this project sounds. Is there any chance you could open-source some of
your custom made improvements so that they could eventually be merged to
trunk?

I definitely noticed how you mentioned large dbs in the past few months. I,
along with many others I assume, would surely like to attend the webcast,
with the only impediment being my schedule/timezone.

I recently asked about working with temporary tables for filtering/grouping
data from uploads and inserting queries from that temporary table onto a
permanent database. To make matters worse, I wanted to make this as flexible
as possible (i.e. dynamic models) so that everything could be managed from a
web app. Do you have any experience you could share about any of these use
cases? As far as I know, there's nothing in the ORM that replicates
PostgreSQL's CREATE TEMPORARY TABLE. My experience with SQL is rather
limited, but from asking around, it seems like my project could indeed
benefit from such a feature. If I had to guess, I would assume other DBMSs
would offer something similar, but being limited to Postgres is okay for me,
for now, anyway.



Cheers,
André


On Wed, Jun 22, 2011 at 10:56 AM, Cal Leeming [Simplicity Media Ltd] <
cal.leem...@simplicitymedialtd.co.uk> wrote:

> Also, the 13.8 minutes per million, is basically a benchmark based on the
> amount of db writes, and the total amount of time it took to execute (which
> was 51s).
>
> Please also note, this code is doing a *heavy* amount of content analysis,
> but if you were to strip that out, the only overheads would be the
> map/filter/lambda, the time it takes to transmit to MySQL, and the time it
> takes for MySQL to perform the writes.
>
> The database hardware spec is:
>
> 1x X3440 quad core (2 cores assigned to MySQL).
> 12GB memory (4 GB assigned to MySQL).
> /var/lib/mysql mapped to 2x Intel M3 SSD drives in RAID 1.
>
> Cal
>
>
> On Wed, Jun 22, 2011 at 2:52 PM, Cal Leeming [Simplicity Media Ltd] <
> cal.leem...@simplicitymedialtd.co.uk> wrote:
>
>> Sorry, let me explain a little better.
>>
>> (51.98s) Found 49659 objs (match: 16563) (db writes: 51180) (range:
>> 72500921 ~ 72550921), (avg 16.9 mins/million) - [('is_checked',
>> 49659), ('is_image_blocked', 0), ('has_link', 1517), ('is_spam', 4)]
>>
>> map(lambda x: (x[0], len(x[1])), _obj_incs.iteritems()) = [('is_checked',
>> 49659), ('is_image_blocked', 0), ('has_link', 1517), ('is_spam', 4)]
>>
>> In the above example, it has found 49659 rows which need 'is_checked'
>> changing to the value '1' (same principle applied to the other 3), giving a
>> total of 51,130 database writes, split into 4 queries.
>>
>> Those 4 fields have the IDs assigned to them:
>>
>> if _f == 'block_images':
>>
>> _obj_incs.get('is_image_blocked').append(_hit_id)
>> if _parent_id:
>>
>> _obj_incs.get('is_image_blocked').append(_parent_id)
>>
>> Then I loop through those fields, and do an update() using the necessary
>> IDs:
>>
>> # now apply the obj changes in bulk (massive speed
>> improvements)
>> for _key, _value in _obj_incs.iteritems():
>> # update the child object
>> Post.objects.filter(
>> id__in = _value
>> ).update(
>> **{
>> _key : 1
>> }
>> )
>>
>> So in simple terms, we're not doing 51 thousand update queries, instead
>> we're grouping them into bulk queries based on the row to be updated. It
>> doesn't yet to grouping based on key AND value, simply because we didn't
>> need it at the time, but if we release the code for public use,
>> we'd definitely add this in.
>>
>> Hope this makes sense, let me know if I didn't explain it very well lol.
>>
>> Cal
>>
>> On Wed, Jun 22, 2011 at 2:45 PM, Thomas Weholt 
>> wrote:
>>
>>> On Wed, Jun 22, 2011 at 3:36 PM, Cal Leeming [Simplicity Media Ltd]
>>>  wrote:
>>> > Hey Thomas,
>>> > Yeah we actually spoke a little while ago about DSE. In the end, we
>>> actually
>>> > used a custom approach which analyses data in blocks of 50k rows,
>>> builds a
>>> > list of rows which need changing to the same value, then applied them
>>> in
>>> > bulk using update() + F().
>>>
>>> Hmmm, what do you mean by "bulk using update() + F()? Something like
>>> "update sometable set somefield1 = somevalue1, somefield2 = somevalue2
>>> where id in (1,2,3 .)" ? Does "avg 13.8 mins/million" mean you
>>> processed 13.8 million rows pr minute? What kind of hardware did you
>>> use?
>>>
>>> Thomas
>>>
>>> > Here's our benchmark:
>>> > (42.11s) Found 49426 objs (match: 16107) (db writes: 

Re: Possible interest in a webcast/presentation about Django site with 40mil+ rows of data??

2011-06-22 Thread Thomas Weholt
On Wed, Jun 22, 2011 at 3:52 PM, Cal Leeming [Simplicity Media Ltd]
 wrote:
> Sorry, let me explain a little better.
> (51.98s) Found 49659 objs (match: 16563) (db writes: 51180) (range:
> 72500921 ~ 72550921), (avg 16.9 mins/million) - [('is_checked',
> 49659), ('is_image_blocked', 0), ('has_link', 1517), ('is_spam', 4)]
> map(lambda x: (x[0], len(x[1])), _obj_incs.iteritems()) = [('is_checked',
> 49659), ('is_image_blocked', 0), ('has_link', 1517), ('is_spam', 4)]
> In the above example, it has found 49659 rows which need 'is_checked'
> changing to the value '1' (same principle applied to the other 3), giving a
> total of 51,130 database writes, split into 4 queries.
> Those 4 fields have the IDs assigned to them:
>                                     if _f == 'block_images':
>
> _obj_incs.get('is_image_blocked').append(_hit_id)
>                                         if _parent_id:
>
> _obj_incs.get('is_image_blocked').append(_parent_id)
> Then I loop through those fields, and do an update() using the necessary
> IDs:
>                     # now apply the obj changes in bulk (massive speed
> improvements)
>                     for _key, _value in _obj_incs.iteritems():
>                         # update the child object
>                         Post.objects.filter(
>                             id__in = _value
>                         ).update(
>                             **{
>                                 _key : 1
>                             }
>                         )
> So in simple terms, we're not doing 51 thousand update queries, instead
> we're grouping them into bulk queries based on the row to be updated. It
> doesn't yet to grouping based on key AND value, simply because we didn't
> need it at the time, but if we release the code for public use,
> we'd definitely add this in.
> Hope this makes sense, let me know if I didn't explain it very well lol.
> Cal

Actually, I started working on something similar, but tried to find
sets of fields, instead of just updating one field pr update, but
didn't finish it because the actual grouping of the fields seem to
take alot of time/cpu/memory. Perhaps if I focused on updating one
field at the time it would be simpler. Might look at it again for DSE
3.0 ;-)

Thomas

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



Re: Possible interest in a webcast/presentation about Django site with 40mil+ rows of data??

2011-06-22 Thread Cal Leeming [Simplicity Media Ltd]
Also, the 13.8 minutes per million, is basically a benchmark based on the
amount of db writes, and the total amount of time it took to execute (which
was 51s).

Please also note, this code is doing a *heavy* amount of content analysis,
but if you were to strip that out, the only overheads would be the
map/filter/lambda, the time it takes to transmit to MySQL, and the time it
takes for MySQL to perform the writes.

The database hardware spec is:

1x X3440 quad core (2 cores assigned to MySQL).
12GB memory (4 GB assigned to MySQL).
/var/lib/mysql mapped to 2x Intel M3 SSD drives in RAID 1.

Cal


On Wed, Jun 22, 2011 at 2:52 PM, Cal Leeming [Simplicity Media Ltd] <
cal.leem...@simplicitymedialtd.co.uk> wrote:

> Sorry, let me explain a little better.
>
> (51.98s) Found 49659 objs (match: 16563) (db writes: 51180) (range:
> 72500921 ~ 72550921), (avg 16.9 mins/million) - [('is_checked',
> 49659), ('is_image_blocked', 0), ('has_link', 1517), ('is_spam', 4)]
>
> map(lambda x: (x[0], len(x[1])), _obj_incs.iteritems()) = [('is_checked',
> 49659), ('is_image_blocked', 0), ('has_link', 1517), ('is_spam', 4)]
>
> In the above example, it has found 49659 rows which need 'is_checked'
> changing to the value '1' (same principle applied to the other 3), giving a
> total of 51,130 database writes, split into 4 queries.
>
> Those 4 fields have the IDs assigned to them:
>
> if _f == 'block_images':
>
> _obj_incs.get('is_image_blocked').append(_hit_id)
> if _parent_id:
>
> _obj_incs.get('is_image_blocked').append(_parent_id)
>
> Then I loop through those fields, and do an update() using the necessary
> IDs:
>
> # now apply the obj changes in bulk (massive speed
> improvements)
> for _key, _value in _obj_incs.iteritems():
> # update the child object
> Post.objects.filter(
> id__in = _value
> ).update(
> **{
> _key : 1
> }
> )
>
> So in simple terms, we're not doing 51 thousand update queries, instead
> we're grouping them into bulk queries based on the row to be updated. It
> doesn't yet to grouping based on key AND value, simply because we didn't
> need it at the time, but if we release the code for public use,
> we'd definitely add this in.
>
> Hope this makes sense, let me know if I didn't explain it very well lol.
>
> Cal
>
> On Wed, Jun 22, 2011 at 2:45 PM, Thomas Weholt wrote:
>
>> On Wed, Jun 22, 2011 at 3:36 PM, Cal Leeming [Simplicity Media Ltd]
>>  wrote:
>> > Hey Thomas,
>> > Yeah we actually spoke a little while ago about DSE. In the end, we
>> actually
>> > used a custom approach which analyses data in blocks of 50k rows, builds
>> a
>> > list of rows which need changing to the same value, then applied them in
>> > bulk using update() + F().
>>
>> Hmmm, what do you mean by "bulk using update() + F()? Something like
>> "update sometable set somefield1 = somevalue1, somefield2 = somevalue2
>> where id in (1,2,3 .)" ? Does "avg 13.8 mins/million" mean you
>> processed 13.8 million rows pr minute? What kind of hardware did you
>> use?
>>
>> Thomas
>>
>> > Here's our benchmark:
>> > (42.11s) Found 49426 objs (match: 16107) (db writes: 50847) (range:
>> 72300921
>> > ~ 72350921), (avg 13.8 mins/million) - [('is_checked', 49426),
>> > ('is_image_blocked', 0), ('has_link', 1420), ('is_spam', 1)]
>> > (44.50s) Found 49481 objs (match: 16448) (db writes: 50764) (range:
>> 72350921
>> > ~ 72400921), (avg 14.6 mins/million) - [('is_checked', 49481),
>> > ('is_image_blocked', 0), ('has_link', 1283), ('is_spam', 0)]
>> > (55.78s) Found 49627 objs (match: 18516) (db writes: 50832) (range:
>> 72400921
>> > ~ 72450921), (avg 18.3 mins/million) - [('is_checked', 49627),
>> > ('is_image_blocked', 0), ('has_link', 1205), ('is_spam', 0)]
>> > (42.03s) Found 49674 objs (match: 17244) (db writes: 51655) (range:
>> 72450921
>> > ~ 72500921), (avg 13.6 mins/million) - [('is_checked', 49674),
>> > ('is_image_blocked', 0), ('has_link', 1971), ('is_spam', 10)]
>> > (51.98s) Found 49659 objs (match: 16563) (db writes: 51180) (range:
>> 72500921
>> > ~ 72550921), (avg 16.9 mins/million) - [('is_checked', 49659),
>> > ('is_image_blocked', 0), ('has_link', 1517), ('is_spam', 4)]
>> > Could you let me know if those benchmarks are better/worse than using
>> DSE?
>> > I'd be interested to see the comparison!
>> > Cal
>> > On Wed, Jun 22, 2011 at 2:31 PM, Thomas Weholt > >
>> > wrote:
>> >>
>> >> Yes! I'm in.
>> >>
>> >> Out of curiosity: When inserting lots of data, how do you do it? Using
>> >> the orm? Have you looked at http://pypi.python.org/pypi/dse/2.1.0 ? I
>> >> wrote DSE to solve inserting/updating huge sets of data, but if

Re: Possible interest in a webcast/presentation about Django site with 40mil+ rows of data??

2011-06-22 Thread Cal Leeming [Simplicity Media Ltd]
Sorry, let me explain a little better.

(51.98s) Found 49659 objs (match: 16563) (db writes: 51180) (range:
72500921 ~ 72550921), (avg 16.9 mins/million) - [('is_checked',
49659), ('is_image_blocked', 0), ('has_link', 1517), ('is_spam', 4)]

map(lambda x: (x[0], len(x[1])), _obj_incs.iteritems()) = [('is_checked',
49659), ('is_image_blocked', 0), ('has_link', 1517), ('is_spam', 4)]

In the above example, it has found 49659 rows which need 'is_checked'
changing to the value '1' (same principle applied to the other 3), giving a
total of 51,130 database writes, split into 4 queries.

Those 4 fields have the IDs assigned to them:

if _f == 'block_images':

_obj_incs.get('is_image_blocked').append(_hit_id)
if _parent_id:

_obj_incs.get('is_image_blocked').append(_parent_id)

Then I loop through those fields, and do an update() using the necessary
IDs:

# now apply the obj changes in bulk (massive speed
improvements)
for _key, _value in _obj_incs.iteritems():
# update the child object
Post.objects.filter(
id__in = _value
).update(
**{
_key : 1
}
)

So in simple terms, we're not doing 51 thousand update queries, instead
we're grouping them into bulk queries based on the row to be updated. It
doesn't yet to grouping based on key AND value, simply because we didn't
need it at the time, but if we release the code for public use,
we'd definitely add this in.

Hope this makes sense, let me know if I didn't explain it very well lol.

Cal

On Wed, Jun 22, 2011 at 2:45 PM, Thomas Weholt wrote:

> On Wed, Jun 22, 2011 at 3:36 PM, Cal Leeming [Simplicity Media Ltd]
>  wrote:
> > Hey Thomas,
> > Yeah we actually spoke a little while ago about DSE. In the end, we
> actually
> > used a custom approach which analyses data in blocks of 50k rows, builds
> a
> > list of rows which need changing to the same value, then applied them in
> > bulk using update() + F().
>
> Hmmm, what do you mean by "bulk using update() + F()? Something like
> "update sometable set somefield1 = somevalue1, somefield2 = somevalue2
> where id in (1,2,3 .)" ? Does "avg 13.8 mins/million" mean you
> processed 13.8 million rows pr minute? What kind of hardware did you
> use?
>
> Thomas
>
> > Here's our benchmark:
> > (42.11s) Found 49426 objs (match: 16107) (db writes: 50847) (range:
> 72300921
> > ~ 72350921), (avg 13.8 mins/million) - [('is_checked', 49426),
> > ('is_image_blocked', 0), ('has_link', 1420), ('is_spam', 1)]
> > (44.50s) Found 49481 objs (match: 16448) (db writes: 50764) (range:
> 72350921
> > ~ 72400921), (avg 14.6 mins/million) - [('is_checked', 49481),
> > ('is_image_blocked', 0), ('has_link', 1283), ('is_spam', 0)]
> > (55.78s) Found 49627 objs (match: 18516) (db writes: 50832) (range:
> 72400921
> > ~ 72450921), (avg 18.3 mins/million) - [('is_checked', 49627),
> > ('is_image_blocked', 0), ('has_link', 1205), ('is_spam', 0)]
> > (42.03s) Found 49674 objs (match: 17244) (db writes: 51655) (range:
> 72450921
> > ~ 72500921), (avg 13.6 mins/million) - [('is_checked', 49674),
> > ('is_image_blocked', 0), ('has_link', 1971), ('is_spam', 10)]
> > (51.98s) Found 49659 objs (match: 16563) (db writes: 51180) (range:
> 72500921
> > ~ 72550921), (avg 16.9 mins/million) - [('is_checked', 49659),
> > ('is_image_blocked', 0), ('has_link', 1517), ('is_spam', 4)]
> > Could you let me know if those benchmarks are better/worse than using
> DSE?
> > I'd be interested to see the comparison!
> > Cal
> > On Wed, Jun 22, 2011 at 2:31 PM, Thomas Weholt 
> > wrote:
> >>
> >> Yes! I'm in.
> >>
> >> Out of curiosity: When inserting lots of data, how do you do it? Using
> >> the orm? Have you looked at http://pypi.python.org/pypi/dse/2.1.0 ? I
> >> wrote DSE to solve inserting/updating huge sets of data, but if
> >> there's a better way to do it that would be especially interesting to
> >> hear more about ( and sorry for the self promotion ).
> >>
> >> Regards,
> >> Thomas
> >>
> >> On Wed, Jun 22, 2011 at 3:15 PM, Cal Leeming [Simplicity Media Ltd]
> >>  wrote:
> >> > Hi all,
> >> > Some of you may have noticed, in the last few months I've done quite a
> >> > few
> >> > posts/snippets about handling large data sets in Django. At the end of
> >> > this
> >> > month (after what seems like a lifetime of trial and error), we're
> >> > finally
> >> > going to be releasing a new site which holds around 40mil+ rows of
> data,
> >> > grows by about 300-500k rows each day, handles 5GB of uploads per day,
> >> > and
> >> > can handle around 1024 requests per second on stress test on a
> >> > moderately
> >> > spec'd 

Re: Possible interest in a webcast/presentation about Django site with 40mil+ rows of data??

2011-06-22 Thread Thomas Weholt
On Wed, Jun 22, 2011 at 3:36 PM, Cal Leeming [Simplicity Media Ltd]
 wrote:
> Hey Thomas,
> Yeah we actually spoke a little while ago about DSE. In the end, we actually
> used a custom approach which analyses data in blocks of 50k rows, builds a
> list of rows which need changing to the same value, then applied them in
> bulk using update() + F().

Hmmm, what do you mean by "bulk using update() + F()? Something like
"update sometable set somefield1 = somevalue1, somefield2 = somevalue2
where id in (1,2,3 .)" ? Does "avg 13.8 mins/million" mean you
processed 13.8 million rows pr minute? What kind of hardware did you
use?

Thomas

> Here's our benchmark:
> (42.11s) Found 49426 objs (match: 16107) (db writes: 50847) (range: 72300921
> ~ 72350921), (avg 13.8 mins/million) - [('is_checked', 49426),
> ('is_image_blocked', 0), ('has_link', 1420), ('is_spam', 1)]
> (44.50s) Found 49481 objs (match: 16448) (db writes: 50764) (range: 72350921
> ~ 72400921), (avg 14.6 mins/million) - [('is_checked', 49481),
> ('is_image_blocked', 0), ('has_link', 1283), ('is_spam', 0)]
> (55.78s) Found 49627 objs (match: 18516) (db writes: 50832) (range: 72400921
> ~ 72450921), (avg 18.3 mins/million) - [('is_checked', 49627),
> ('is_image_blocked', 0), ('has_link', 1205), ('is_spam', 0)]
> (42.03s) Found 49674 objs (match: 17244) (db writes: 51655) (range: 72450921
> ~ 72500921), (avg 13.6 mins/million) - [('is_checked', 49674),
> ('is_image_blocked', 0), ('has_link', 1971), ('is_spam', 10)]
> (51.98s) Found 49659 objs (match: 16563) (db writes: 51180) (range: 72500921
> ~ 72550921), (avg 16.9 mins/million) - [('is_checked', 49659),
> ('is_image_blocked', 0), ('has_link', 1517), ('is_spam', 4)]
> Could you let me know if those benchmarks are better/worse than using DSE?
> I'd be interested to see the comparison!
> Cal
> On Wed, Jun 22, 2011 at 2:31 PM, Thomas Weholt 
> wrote:
>>
>> Yes! I'm in.
>>
>> Out of curiosity: When inserting lots of data, how do you do it? Using
>> the orm? Have you looked at http://pypi.python.org/pypi/dse/2.1.0 ? I
>> wrote DSE to solve inserting/updating huge sets of data, but if
>> there's a better way to do it that would be especially interesting to
>> hear more about ( and sorry for the self promotion ).
>>
>> Regards,
>> Thomas
>>
>> On Wed, Jun 22, 2011 at 3:15 PM, Cal Leeming [Simplicity Media Ltd]
>>  wrote:
>> > Hi all,
>> > Some of you may have noticed, in the last few months I've done quite a
>> > few
>> > posts/snippets about handling large data sets in Django. At the end of
>> > this
>> > month (after what seems like a lifetime of trial and error), we're
>> > finally
>> > going to be releasing a new site which holds around 40mil+ rows of data,
>> > grows by about 300-500k rows each day, handles 5GB of uploads per day,
>> > and
>> > can handle around 1024 requests per second on stress test on a
>> > moderately
>> > spec'd server.
>> > As the entire thing is written in Django (and a bunch of other open
>> > source
>> > products), I'd really like to give something back to the
>> > community. (stack
>> > incls Celery/RabbitMQ/Sphinx SE/PYQuery/Percona
>> > MySQL/NGINX/supervisord/debian etc)
>> > Therefore, I'd like to see if there would be any interest in webcast in
>> > which I would explain how we handle such large amounts of data, the
>> > trial
>> > and error processes we went through, some really neat tricks we've done
>> > to
>> > avoid bottlenecks, our own approach to smart content filtering, and some
>> > of
>> > the valuable lessons we have learned. The webcast would be completely
>> > free
>> > of charge, last a couple of hours (with a short break) and anyone can
>> > attend. I'd also offer up a Q session at the end.
>> > If you're interested, please reply on-list so others can see.
>> > Thanks
>> > Cal
>> >
>> > --
>> > You received this message because you are subscribed to the Google
>> > Groups
>> > "Django users" group.
>> > To post to this group, send email to django-users@googlegroups.com.
>> > To unsubscribe from this group, send email to
>> > django-users+unsubscr...@googlegroups.com.
>> > For more options, visit this group at
>> > http://groups.google.com/group/django-users?hl=en.
>> >
>>
>>
>>
>> --
>> Mvh/Best regards,
>> Thomas Weholt
>> http://www.weholt.org
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To post to this group, send email to django-users@googlegroups.com.
>> To unsubscribe from this group, send email to
>> django-users+unsubscr...@googlegroups.com.
>> For more options, visit this group at
>> http://groups.google.com/group/django-users?hl=en.
>>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> 

Re: Automatic internal link middleware

2011-06-22 Thread Cal Leeming [Simplicity Media Ltd]
On Wed, Jun 22, 2011 at 2:33 PM, Herman Schistad
wrote:

> On Wed, Jun 22, 2011 at 15:24, Cal Leeming [Simplicity Media Ltd]
>  wrote:
> > We have actually just implemented this on one of our other sites still in
> > development. The problem with keyword highlighting is you have to be
> careful
> > not to enter into infinite loops, by ensuring you only match keywords
> > outside of existing HTML tags. Normally I'd just say "figure it out for
> > yourself", but this particular task took me about 4-5 hours to figure
> out,
> > and was eventually solved by someone elses regex on google, so it's only
> > fair I share :)
> > Here is the code we have used (works 100% of the time so far) - this is
> > quickly modified cut and paste, so you may need to tinker with it to make
> it
> > work.
>
> Thanks Cal. Real nice of you to share. As Tim also mentioned, the
> solution is simple, but I figured there had to be some caveats with
> the regex.
> I'm really interested in your new project and would definitively watch
> your webcast (ref. your other topic)
>

No problem at all, if you find any bugs with it, do let me know :) I'll put
your name down for the webcast too.


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

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



Re: Possible interest in a webcast/presentation about Django site with 40mil+ rows of data??

2011-06-22 Thread Shawn Milochik

Cal,

That sounds awesome. I wish you could present it at DjangoCon US too. :o/

Shawn

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



Re: Possible interest in a webcast/presentation about Django site with 40mil+ rows of data??

2011-06-22 Thread Cal Leeming [Simplicity Media Ltd]
Hey Thomas,

Yeah we actually spoke a little while ago about DSE. In the end, we actually
used a custom approach which analyses data in blocks of 50k rows, builds a
list of rows which need changing to the same value, then applied them in
bulk using update() + F().

Here's our benchmark:

(42.11s) Found 49426 objs (match: 16107) (db writes: 50847) (range: 72300921
~ 72350921), (avg 13.8 mins/million) - [('is_checked', 49426),
('is_image_blocked', 0), ('has_link', 1420), ('is_spam', 1)]
(44.50s) Found 49481 objs (match: 16448) (db writes: 50764) (range: 72350921
~ 72400921), (avg 14.6 mins/million) - [('is_checked', 49481),
('is_image_blocked', 0), ('has_link', 1283), ('is_spam', 0)]
(55.78s) Found 49627 objs (match: 18516) (db writes: 50832) (range: 72400921
~ 72450921), (avg 18.3 mins/million) - [('is_checked', 49627),
('is_image_blocked', 0), ('has_link', 1205), ('is_spam', 0)]
(42.03s) Found 49674 objs (match: 17244) (db writes: 51655) (range: 72450921
~ 72500921), (avg 13.6 mins/million) - [('is_checked', 49674),
('is_image_blocked', 0), ('has_link', 1971), ('is_spam', 10)]
(51.98s) Found 49659 objs (match: 16563) (db writes: 51180) (range: 72500921
~ 72550921), (avg 16.9 mins/million) - [('is_checked', 49659),
('is_image_blocked', 0), ('has_link', 1517), ('is_spam', 4)]

Could you let me know if those benchmarks are better/worse than using DSE?
I'd be interested to see the comparison!

Cal

On Wed, Jun 22, 2011 at 2:31 PM, Thomas Weholt wrote:

> Yes! I'm in.
>
> Out of curiosity: When inserting lots of data, how do you do it? Using
> the orm? Have you looked at http://pypi.python.org/pypi/dse/2.1.0 ? I
> wrote DSE to solve inserting/updating huge sets of data, but if
> there's a better way to do it that would be especially interesting to
> hear more about ( and sorry for the self promotion ).
>
> Regards,
> Thomas
>
> On Wed, Jun 22, 2011 at 3:15 PM, Cal Leeming [Simplicity Media Ltd]
>  wrote:
> > Hi all,
> > Some of you may have noticed, in the last few months I've done quite a
> few
> > posts/snippets about handling large data sets in Django. At the end of
> this
> > month (after what seems like a lifetime of trial and error), we're
> finally
> > going to be releasing a new site which holds around 40mil+ rows of data,
> > grows by about 300-500k rows each day, handles 5GB of uploads per day,
> and
> > can handle around 1024 requests per second on stress test on a moderately
> > spec'd server.
> > As the entire thing is written in Django (and a bunch of other open
> source
> > products), I'd really like to give something back to the
> community. (stack
> > incls Celery/RabbitMQ/Sphinx SE/PYQuery/Percona
> > MySQL/NGINX/supervisord/debian etc)
> > Therefore, I'd like to see if there would be any interest in webcast in
> > which I would explain how we handle such large amounts of data, the trial
> > and error processes we went through, some really neat tricks we've done
> to
> > avoid bottlenecks, our own approach to smart content filtering, and some
> of
> > the valuable lessons we have learned. The webcast would be completely
> free
> > of charge, last a couple of hours (with a short break) and anyone can
> > attend. I'd also offer up a Q session at the end.
> > If you're interested, please reply on-list so others can see.
> > Thanks
> > Cal
> >
> > --
> > You received this message because you are subscribed to the Google Groups
> > "Django users" group.
> > To post to this group, send email to django-users@googlegroups.com.
> > To unsubscribe from this group, send email to
> > django-users+unsubscr...@googlegroups.com.
> > For more options, visit this group at
> > http://groups.google.com/group/django-users?hl=en.
> >
>
>
>
> --
> Mvh/Best regards,
> Thomas Weholt
> http://www.weholt.org
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>

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



Re: Automatic internal link middleware

2011-06-22 Thread Herman Schistad
On Wed, Jun 22, 2011 at 15:24, Cal Leeming [Simplicity Media Ltd]
 wrote:
> We have actually just implemented this on one of our other sites still in
> development. The problem with keyword highlighting is you have to be careful
> not to enter into infinite loops, by ensuring you only match keywords
> outside of existing HTML tags. Normally I'd just say "figure it out for
> yourself", but this particular task took me about 4-5 hours to figure out,
> and was eventually solved by someone elses regex on google, so it's only
> fair I share :)
> Here is the code we have used (works 100% of the time so far) - this is
> quickly modified cut and paste, so you may need to tinker with it to make it
> work.

Thanks Cal. Real nice of you to share. As Tim also mentioned, the
solution is simple, but I figured there had to be some caveats with
the regex.
I'm really interested in your new project and would definitively watch
your webcast (ref. your other topic)

Again, thanks. Have a nice day.

-- 
With Regards, Herman Schistad

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



templatetags and refresh

2011-06-22 Thread Wim Feijen
Hello,

At www.mkb-rotterdam.nl we use a template tag to display NewsItems in
different formats on the homepage.

However, when a new NewsItem is added, it does not appear at once.

Might this have to do with the fact that we use a template tag to get
the NewsItems out of the db?

Our query is:

newsitems = NewsItem.objects.filter(Q(expires_at__gt = datetime.now())
| Q(expires_at__isnull = True), effective_at__lte = datetime.now(),
is_active=True).order_by('-news_timestamp')

Or is datetime.now() fixed to the past?

What would be a proper way to solve this then? Maybe add a post-save
signal but how could we use this then to refresh the tag?

If something else is the matter, or just if you're interested: we host
our site using a virtual apache + mod_wsgi + nginx.

Thanks for your help!

Wim


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



Re: Possible interest in a webcast/presentation about Django site with 40mil+ rows of data??

2011-06-22 Thread Thomas Weholt
Yes! I'm in.

Out of curiosity: When inserting lots of data, how do you do it? Using
the orm? Have you looked at http://pypi.python.org/pypi/dse/2.1.0 ? I
wrote DSE to solve inserting/updating huge sets of data, but if
there's a better way to do it that would be especially interesting to
hear more about ( and sorry for the self promotion ).

Regards,
Thomas

On Wed, Jun 22, 2011 at 3:15 PM, Cal Leeming [Simplicity Media Ltd]
 wrote:
> Hi all,
> Some of you may have noticed, in the last few months I've done quite a few
> posts/snippets about handling large data sets in Django. At the end of this
> month (after what seems like a lifetime of trial and error), we're finally
> going to be releasing a new site which holds around 40mil+ rows of data,
> grows by about 300-500k rows each day, handles 5GB of uploads per day, and
> can handle around 1024 requests per second on stress test on a moderately
> spec'd server.
> As the entire thing is written in Django (and a bunch of other open source
> products), I'd really like to give something back to the community. (stack
> incls Celery/RabbitMQ/Sphinx SE/PYQuery/Percona
> MySQL/NGINX/supervisord/debian etc)
> Therefore, I'd like to see if there would be any interest in webcast in
> which I would explain how we handle such large amounts of data, the trial
> and error processes we went through, some really neat tricks we've done to
> avoid bottlenecks, our own approach to smart content filtering, and some of
> the valuable lessons we have learned. The webcast would be completely free
> of charge, last a couple of hours (with a short break) and anyone can
> attend. I'd also offer up a Q session at the end.
> If you're interested, please reply on-list so others can see.
> Thanks
> Cal
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>



-- 
Mvh/Best regards,
Thomas Weholt
http://www.weholt.org

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



Re: Automatic internal link middleware

2011-06-22 Thread Cal Leeming [Simplicity Media Ltd]
Hi Herman,

We have actually just implemented this on one of our other sites still in
development. The problem with keyword highlighting is you have to be careful
not to enter into infinite loops, by ensuring you only match keywords
outside of existing HTML tags. Normally I'd just say "figure it out for
yourself", but this particular task took me about 4-5 hours to figure out,
and was eventually solved by someone elses regex on google, so it's only
fair I share :)

Here is the code we have used (works 100% of the time so far) - this is
quickly modified cut and paste, so you may need to tinker with it to make it
work.

#TODO: Apply keywords
class Filtering:
def apply_keywords(self, message, keywords):
if message:
_pattern = r'(%s)(?!([^<]+)?>)' % ( "|".join(map(lambda x:
re.escape(x.get('word')), keywords)) )
_keyword_re = re.compile(_pattern, flags = re.IGNORECASE)
message = _keyword_re.sub("\\1", message)
return message

Example usage:
html_here = """
lazy
dog
lazy
dog

lazy
dog
"""
>>> f = Filtering()
>>> f.apply_keywords(html_here, [{'word':'lazy'}, {'word':'dog'},
{'word':'jumps'} ]);
'\nlazy\ndog\nlazy\ndog\n\nlazy\ndog\n'

Enjoy :)


On Wed, Jun 22, 2011 at 1:28 PM, Herman Schistad
wrote:

> Hi there fellow developers.
>
> I'm wondering if anyone has seen an app which does the following:
> * Finds keywords in the templates, which is defined by the user and
> then creates internal links to these.
>
> Use-case:
> 1. I create keyword: "Cupcakes" and give it the href/URL property:
> /info/cupcakes/ in adminpanel
> 2. I write a flatpage/template where I mention the word cupcakes
> 3. Middleware notices this word and renders a  href="/info/cupcakes/>cupcakes link automatically
>
> Kind of like Wikipedia, but the user does not need to define links
> themselves in markup etc.
> If this does not exist, I would guess it could be pretty popular as a
> SEO tool and I would be glad to discuss development with interested
> parties.
>
> --
> With regards, Herman Schistad
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>

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



Re: Possible interest in a webcast/presentation about Django site with 40mil+ rows of data??

2011-06-22 Thread Michał Sawicz
Dnia 2011-06-22, śro o godzinie 14:15 +0100, Cal Leeming [Simplicity
Media Ltd] pisze:
> If you're interested, please reply on-list so others can see. 

Sure, I'd attend.
-- 
Michał (Saviq) Sawicz 


signature.asc
Description: This is a digitally signed message part


Possible interest in a webcast/presentation about Django site with 40mil+ rows of data??

2011-06-22 Thread Cal Leeming [Simplicity Media Ltd]
Hi all,

Some of you may have noticed, in the last few months I've done quite a few
posts/snippets about handling large data sets in Django. At the end of this
month (after what seems like a lifetime of trial and error), we're finally
going to be releasing a new site which holds around 40mil+ rows of data,
grows by about 300-500k rows each day, handles 5GB of uploads per day, and
can handle around 1024 requests per second on stress test on a moderately
spec'd server.

As the entire thing is written in Django (and a bunch of other open source
products), I'd really like to give something back to the community. (stack
incls Celery/RabbitMQ/Sphinx SE/PYQuery/Percona
MySQL/NGINX/supervisord/debian etc)

Therefore, I'd like to see if there would be any interest in webcast in
which I would explain how we handle such large amounts of data, the trial
and error processes we went through, some really neat tricks we've done to
avoid bottlenecks, our own approach to smart content filtering, and some of
the valuable lessons we have learned. The webcast would be completely free
of charge, last a couple of hours (with a short break) and anyone can
attend. I'd also offer up a Q session at the end.

If you're interested, please reply on-list so others can see.

Thanks

Cal

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



Re: How does the {% trans %} tag choose translations?

2011-06-22 Thread Fabian Büchler
Thanks Bruno, that was helpful.

2011/6/22 bruno desthuilliers :
> Not a direct answer, but this might help you understanding what's
> going on:
>
> https://docs.djangoproject.com/en/1.3/topics/i18n/deployment/#how-django-discovers-translations
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to 
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/django-users?hl=en.
>
>

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



Re: Automatic internal link middleware

2011-06-22 Thread Tim Shaffer
Shouldn't be too hard to implement I don't think. Basically just loop 
through your list of keywords and replace them with a link. Something like 
this:

def make_keyword_links(content):
for keyword in Keyword.objects.all():
content = content.replace(keyword.text, keyword.link)
return content

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



Re: making instance of auth User results in: maximum recursion depth exceeded while calling a Python object

2011-06-22 Thread T'mas
Thank you very much, you helped me out.

I found how stupid I am :). I was calling login() django function from
view function called login().

Next time I will post my code. Thanks for advice

T.

On Jun 22, 1:05 pm, Karen Tracey  wrote:
> On Tue, Jun 21, 2011 at 12:34 PM, T'mas  wrote:
> > sorry. Problem is not User object but login from django.contrib.auth.
>
> > login(request,user)
>
> You've haven't included any of the traceback from the maximum recursion
> depth exceeded, nor any of your code, so all anyone can do to help is guess.
> I'd guess you've defined your own login function, inside of which you are
> trying to call the django.contrib.auth login that you presumably imported
> earlier in your code. But since you have subsequently defined your own
> login, that name is now bound to your new function, not djano.contrib.auth
> login. Your function's call to login calls itself, which calls itself, which
> calls itself, etc. until finally Python says enough.
>
> If that's not exactly what is happening then please try examining the
> traceback to see what's happening in the code: it's showing you exactly
> what's getting called from where, and the source of the infinite recursion
> will be evident in that traceback. If it is not, post at least a portion of
> the traceback to give people who might help something to work with.
>
> Karen
> --http://tracey.org/kmt/

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



Automatic internal link middleware

2011-06-22 Thread Herman Schistad
Hi there fellow developers.

I'm wondering if anyone has seen an app which does the following:
* Finds keywords in the templates, which is defined by the user and
then creates internal links to these.

Use-case:
1. I create keyword: "Cupcakes" and give it the href/URL property:
/info/cupcakes/ in adminpanel
2. I write a flatpage/template where I mention the word cupcakes
3. Middleware notices this word and renders a http://groups.google.com/group/django-users?hl=en.



Re: ANN: django-kolibri - a concept for Asynchronous Processors/Workflow management for django.

2011-06-22 Thread Thomas Weholt
On Wed, Jun 22, 2011 at 2:01 PM, Ethan Jucovy  wrote:
> On Tue, Jun 21, 2011 at 5:09 PM, Thomas Weholt 
> wrote:
>>
>> Proof of concept. Need comments. Released under a modified BSD-license.
>>
>> http://pypi.python.org/pypi/Kolibri/0.1.0a
>>
>> or better
>>
>> https://bitbucket.org/weholt/django-kolibri
>>
>> There's a blogpost with two screencasts at http://weholt.blogspot.com/ as
>> well.
>
> Looks very cool, I'm looking forward to trying it out.
>
>>
>> NB! If anybody can tell me why my my pypi-entry don't get formatted
>> like restructured text that would be swell. Thanks!
>
> Usually this happens when your long_description doesn't validate properly as
> ReST.  I use the collective.checkdocs package to validate and fix ReST
> syntax errors before uploading a release.  Use it like:
> $ pip install collective.checkdocs
> $ cd src/django-kolibri
> $ python setup.py checkdocs
> It will emit ReST validation errors and warnings, with line numbers.  Fix
> those and then re-register the package data (`python setup.py register`) and
> the ReST will render properly on the PyPI page.
> -Ethan

Thanks a bunch Ethan!! You made my day. :-)

Thomas

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

-- 
Mvh/Best regards,
Thomas Weholt
http://www.weholt.org

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



Re: ANN: django-kolibri - a concept for Asynchronous Processors/Workflow management for django.

2011-06-22 Thread Ethan Jucovy
On Tue, Jun 21, 2011 at 5:09 PM, Thomas Weholt wrote:

> Proof of concept. Need comments. Released under a modified BSD-license.
>
> http://pypi.python.org/pypi/Kolibri/0.1.0a
>
> or better
>
> https://bitbucket.org/weholt/django-kolibri
>
> There's a blogpost with two screencasts at http://weholt.blogspot.com/ as
> well.
>

Looks very cool, I'm looking forward to trying it out.


> NB! If anybody can tell me why my my pypi-entry don't get formatted
> like restructured text that would be swell. Thanks!
>

Usually this happens when your long_description doesn't validate properly as
ReST.  I use the collective.checkdocs package to validate and fix ReST
syntax errors before uploading a release.  Use it like:

$ pip install collective.checkdocs
$ cd src/django-kolibri
$ python setup.py checkdocs

It will emit ReST validation errors and warnings, with line numbers.  Fix
those and then re-register the package data (`python setup.py register`) and
the ReST will render properly on the PyPI page.

-Ethan

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



Re: syncdb error

2011-06-22 Thread Karen Tracey
On Tue, Jun 21, 2011 at 11:24 PM, T4 Phage  wrote:

> Hello!
>
> When I run syncdb it returns an error ending in
> "_mysql_exceptions.OperationalError: (1050, "Table 'people_person'
> already exists")."  I know that the table 'people_person' already
> exists because I used syncdb to make it earlier (and because I can see
> it in my database).
>
> Of course if I dump all the problem tables manually syncdb runs fine
> and creates everything anew.  Obviously this is problematic (every
> time I add a new app I have to reset the tables for all my old
> apps).
>
> I thought that syncdb didn't do anything to already existing tables,
> and that it only tried to create tables for apps that didn't already
> have tables.  Does anyone know what my problem might be?
>
>
>
Might be: https://code.djangoproject.com/ticket/9116

See also:
http://groups.google.com/group/django-users/browse_thread/thread/9b3830c369a97f1a/bdfcba336a19d7e9

I'd guess, since you are mentioning the exact same table name, you are
working from the same book as the person in that thread.

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

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



Re: making instance of auth User results in: maximum recursion depth exceeded while calling a Python object

2011-06-22 Thread Karen Tracey
On Tue, Jun 21, 2011 at 12:34 PM, T'mas  wrote:

> sorry. Problem is not User object but login from django.contrib.auth.
>
> login(request,user)
>
>
You've haven't included any of the traceback from the maximum recursion
depth exceeded, nor any of your code, so all anyone can do to help is guess.
I'd guess you've defined your own login function, inside of which you are
trying to call the django.contrib.auth login that you presumably imported
earlier in your code. But since you have subsequently defined your own
login, that name is now bound to your new function, not djano.contrib.auth
login. Your function's call to login calls itself, which calls itself, which
calls itself, etc. until finally Python says enough.

If that's not exactly what is happening then please try examining the
traceback to see what's happening in the code: it's showing you exactly
what's getting called from where, and the source of the infinite recursion
will be evident in that traceback. If it is not, post at least a portion of
the traceback to give people who might help something to work with.

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

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



Re: How does the {% trans %} tag choose translations?

2011-06-22 Thread bruno desthuilliers
Not a direct answer, but this might help you understanding what's
going on:

https://docs.djangoproject.com/en/1.3/topics/i18n/deployment/#how-django-discovers-translations

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



Connecting to signals sent by specific senders

2011-06-22 Thread solarg
hello all,

i'm trying to follow the official doc:
https://docs.djangoproject.com/en/1.3/topics/signals/

I wrote:

@receiver(post_save, sender=MyModel)
def my_callback(sender, **kwargs):
if 'created' in kwargs:
if kwargs['created']:
print "sender", sender
print "Request finished!"
if kwargs['instance']:
mymodel = kwargs['instance']
print "mymodel ", mymodel

post_save.connect(my_callback, dispatch_uid="my_unique_identifier")

i'm working thru the admin page. I want callback() called only once,
when i add an object MyModel
But logs on the server show the following:

sender 
Request finished!
mymodel  corpus: jpg methode: Methode object status: W cpu_time: None
mem_used: None created_on: 2011-06-21 19:14:05.246381
sender 
Request finished!
mymodel  corpus: jpg methode: Methode object status: W cpu_time: None
mem_used: None created_on: 2011-06-21 19:14:05.246381
sender 
Request finished!
mymodel  LogEntry object


So callback() is called 3 times, ignoring the receiver decorator.
Neither the test on 'created' variable doesn't limit calls.

What am i missing?

thanks in advance for help,


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



Anyone near Portsmouth NH? (Northshore MA/Manchester NH/Portland ME)

2011-06-22 Thread Stacie Andrews
I'm working on a few python/django projects on real-time, low-latency
systems. Interested in finding others into artificial intelligence,
natural language processing and news sentiment algorithms in the area.

- Stacie

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



Re: Django caching not working with SSL(https)

2011-06-22 Thread Anoop Thomas Mathew
Hi all,
I figured it out. The problem was with the google analytics cookies which
made each cookie different and vary on cookie reloaded cache each time.

This snippet helped.
http://djangosnippets.org/snippets/1772/

regards,
Anoop

atm
___
Life is short, Live it hard.




On 21 June 2011 15:55, Anoop Thomas Mathew  wrote:

> Hi all,
>
> A site which was caching through django caching backend db cache) it was
> working well. When we changed it to https instead of http, the system
> suddenly stopped caching. Is there any thought's regarding this?
> Anyone got the same issue?
>
> regards,
> Anoop
>
> atm
> ___
> Life is short, Live it hard.
>
>
>

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



Re: csrf protection and testing with tsung

2011-06-22 Thread Malcolm Box
On 22 June 2011 09:52, Ivan Uemlianin  wrote:
>
> Thanks very much for your help!  You were exactly right.  The
> following config works (simplified for exposition).

Glad that helped, and thank you for coming back with the working
settings for anyone else who runs into the same problem.

Malcolm

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



USE_L10N set to False in settings.py doesn't work (django 1.3)

2011-06-22 Thread jason
Hello all,

i set USE_L10N to False in my project's settings.py ( LANGUAGE_CODE =
'zh-CN', USE_I18N = True, USE_L10N = False), but it doesn't work in
the template tag {{ pub_date.date }}, e.g. it still trans the date
format to my current locale(zh-cn). i want to display the original
date format"2011-6-23", but it still goes to "六月 23, 2011".

ps, at present the django version i use is django 1.3, the app worked
fine in 1.2 (the app was wrote in 1.2 and i ungrade my django version
without changing anything).So how could the problem be?
allow my poor english :-(
thanks.

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



Re: updating a user form?

2011-06-22 Thread Herman Schistad
On Wed, Jun 22, 2011 at 10:14, raj  wrote:
> If I didn't have the url
> set up in this manner, how would I manage to extract the userprofile?

If you have the "AuthenticationMiddleware" activated you would use request.user
This returns a User object, which you then can use to further edit things.

E.g.
user = request.user
user.username = "Somethingnew"
user.save()

Or, as Kevin Renskers said, you would create a seperate model for the
userprofile if you wanted to extend it. Here you will need to get the
user profile with user.get_profile() and remember to set the
following: AUTH_PROFILE_MODULE = "myapp.mysiteprofile"

Then you could use the above example like this:
user = request.user
user.get_profile().homepage = "http://example.org;
user.save()

-- 
With regards, Herman Schistad

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



How does the {% trans %} tag choose translations?

2011-06-22 Thread Fabian Büchler
Hey everyone,

got a little problem with the trans tag:

In one of my apps, I've got a translation marker in a template saying
"All dates", which is translated in the apps PO file for German (de)
to "Alle Termine".
But on the frontend I see "Alle Daten", which comes from the German
translation file of django.contrib.admin.

(I've rebuilt my translation files and recompiled them just to be
perfectly sure that "Alle Daten" is not in there)

Is there any way to define which translation catalog (domain?) the
trans tag uses first?
If not, why does it prefer Django admin's translations over my own in
the templates of my application?

Thanks for any help!
Fabian

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



Re: csrf protection and testing with tsung

2011-06-22 Thread Ivan Uemlianin
Dear Malcom

Thanks very much for your help!  You were exactly right.  The
following config works (simplified for exposition).

Best wishes

Ivan




  
  





  





On Jun 21, 5:54 pm, Malcolm Box  wrote:
> On 21 June 2011 16:48, Ivan Uemlianin  wrote:
>
> > With tsung you record a site visit (called a session) --- log in, view
> > various pages, do a few things, log out --- and tsung will then hit
> > the site with lots of randomised versions of this session.
>
> > Many of the views are csrf protected, and the automated requests tsung
> > generates don't get through the protection.  For the moment I'm just
> > commenting out the csrf middleware in settings.py, but this is
> > obviously inconvenient.
>
> I think you'll need to do some work with dyn_variable to pull the csrf
> token out of the original form and re-inject it into the post you send
> back. As far as I understand it, all that the csrf protection is is an
> opaque value hidden in any form that needs to be present in the
> submitted version to be valid. That stops "loose" posts fromCSRF
> attacks working as they don't know the magic key.
>
> Malcolm

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



Re: Form wizard

2011-06-22 Thread Kevin Renskers
The documentation 
on https://docs.djangoproject.com/en/1.3/ref/contrib/formtools/form-wizard/ 
is pretty clear. The part where you're going in the wrong direction is the 
url config. Compare 
with 
https://docs.djangoproject.com/en/1.3/ref/contrib/formtools/form-wizard/#hooking-the-wizard-into-a-urlconf.

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



Re: Django EmailMultiAlternatives with Embadded Image in HTML

2011-06-22 Thread Kevin Renskers
If I google on "django html email inline image" I see multiple solutions. 
None of them worked? Seems unlikely to me...

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



Re: Is multiple inheritance with abstract model classes ok?

2011-06-22 Thread Kevin Renskers
Perfectly fine!

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



Re: WMD-editor: Where's wmd/urls.py?

2011-06-22 Thread Kevin Renskers
I think it's an error in the documentation. Since there are no views, it's 
probable that there are no urls as well.

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



Re: set language from user lang in DB?

2011-06-22 Thread Kevin Renskers
from django.utils import translation
translation.activate(language_code)

See 
also 
http://stackoverflow.com/questions/2336785/set-language-within-a-django-view

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



Re: how to display form data with original values after validation failure?

2011-06-22 Thread Kevin Renskers
If I understand this correctly, then you want something like this?

1) Show a form to edit something
2) User changes fields, submits the form
3) If the form was not valid, not only show the errors and the form with the 
entered values, but also the *old* values, pre-edit.

I think your best bet is to create custom valid_field() validation functions 
in the form class, which access the form instance to show the old values in 
the error message.

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



Re: updating a user form?

2011-06-22 Thread raj
This is an interesting way of doing it. I don't have it set up so that
every user has their own url that contains their db id. Django checks
to see if the user is authenticated or not. If I didn't have the url
set up in this manner, how would I manage to extract the userprofile?
I was seeing something called request.user, but I couldn't get this to
work.
I googled some more and I got a post talking about the ModelForm. This
allowed me to restrict the form fields for the user profile. The issue
is that each form field didn't have the default values set to those in
the database. (The form "value" parameter). I looked through the
ModelForm section of the djangobook, as well as the forms section, and
I couldn't come up with anything.

On Jun 22, 2:37 am, Herman Schistad  wrote:
> On Wed, Jun 22, 2011 at 08:28, raj  wrote:
> > I'm trying to create an update_profile form. This form will be able to
> > update extended user information that is not in the original form.
>
> > So, I have a form that allows you to create an account. There a lot of
> > other fields that aren't listed in this form. The rest of these fields
> > will be found when the user actually logs in. What I can't figure out
> > is how to make the class that allows them to update this information.
> > Like in the extended user class that I made, I have a save function
> > that creates a user and saves it. But I don't want to create another
> > user with this form. I simply want to update the current authenticated
> > user. I thought there would be an update_user type function in the
> > UserManager(), but there isn't. I tried googling and didn't come up
> > with much. Help Please?
>
> I don't quite understand what you mean...
>
> When you say load the url: /userprofile/1234/ at got your urls.py to
> get  from the URL.
> Then you could load that userprofile from the db with e.g.
>
> def a_nice_view(request, id):
> from django.auth.models import User
> userprofile = User.objects.get(pk=id)
> ## Then do updating on that profile here ##
> userprofile.username = "Somethingnew"
>
> It's the same way with a form/request, and you can get the userprofile
> with: request.user
>
> All this is pretty basic stuff, and as I've seen you ask a lot of
> these questions on django-users I would really advise you to read a
> introductory book or do some more tutorials before trying to make
> something advanced yourselves.
>
> --
> With regards, Herman Schistad

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



Re: updating a user form?

2011-06-22 Thread Kevin Renskers
I'd advise you to 
read 
https://docs.djangoproject.com/en/1.3/topics/auth/#storing-additional-information-about-users.
 
So, create a separate model for the profile, which can be edited by the user 
once he is logged in.

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



Re: csrf token driving me crazy

2011-06-22 Thread Kevin Renskers
The documentation about CSRF and AJAX was already 
linked: https://docs.djangoproject.com/en/dev/ref/contrib/csrf/#ajax

The note about backwards incompatibility can be found 
here: 
https://docs.djangoproject.com/en/1.3/releases/1.3/#csrf-validation-now-applies-to-ajax-requests

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



Re: MemoryError

2011-06-22 Thread Gagan (GPS)
I tried to work around the plotting code and the MemoryError seams to
have resolved itself. Apparently there was some problem with the data
handling.

On Jun 22, 2:50 pm, "Gagan (GPS)"  wrote:
> Hi,
>
> I am building a website that can access data from my server, plot it
> and present it in a pdf format. I am experiencing the following error
> and am unable to understand what to do. Kindly help.
>
> Traceback (most recent call last):
>   File "/usr/lib/python2.7/wsgiref/handlers.py", line 85, in run
>     self.result = application(self.environ, self.start_response)
>   File "/usr/lib/python2.7/dist-packages/django/contrib/staticfiles/
> handlers.py", line 68, in __call__
>     return self.application(environ, start_response)
>   File "/usr/lib/python2.7/dist-packages/django/core/handlers/
> wsgi.py", line 247, in __call__
>     response = self.get_response(request)
>   File "/usr/lib/python2.7/dist-packages/django/core/handlers/
> base.py", line 169, in get_response
>     response = self.handle_uncaught_exception(request, resolver,
> sys.exc_info())
>   File "/usr/lib/python2.7/dist-packages/django/core/handlers/
> base.py", line 203, in handle_uncaught_exception
>     return debug.technical_500_response(request, *exc_info)
>   File "/usr/lib/python2.7/dist-packages/django/views/debug.py", line
> 63, in technical_500_response
>     html = reporter.get_traceback_html()
>   File "/usr/lib/python2.7/dist-packages/django/views/debug.py", line
> 268, in get_traceback_html
>     return t.render(c)
>   File "/usr/lib/python2.7/dist-packages/django/template/base.py",
> line 124, in render
>     return self._render(context)
>   File "/usr/lib/python2.7/dist-packages/django/template/base.py",
> line 118, in _render
>     return self.nodelist.render(context)
>   File "/usr/lib/python2.7/dist-packages/django/template/base.py",
> line 747, in render
>     bits.append(self.render_node(node, context))
>   File "/usr/lib/python2.7/dist-packages/django/template/debug.py",
> line 73, in render_node
>     result = node.render(context)
>   File "/usr/lib/python2.7/dist-packages/django/template/
> defaulttags.py", line 313, in render
>     return self.nodelist_true.render(context)
>   File "/usr/lib/python2.7/dist-packages/django/template/base.py",
> line 747, in render
>     bits.append(self.render_node(node, context))
>   File "/usr/lib/python2.7/dist-packages/django/template/debug.py",
> line 73, in render_node
>     result = node.render(context)
>   File "/usr/lib/python2.7/dist-packages/django/template/
> defaulttags.py", line 78, in render
>     output = self.nodelist.render(context)
>   File "/usr/lib/python2.7/dist-packages/django/template/base.py",
> line 747, in render
>     bits.append(self.render_node(node, context))
>   File "/usr/lib/python2.7/dist-packages/django/template/debug.py",
> line 73, in render_node
>     result = node.render(context)
>   File "/usr/lib/python2.7/dist-packages/django/template/
> defaulttags.py", line 229, in render
>     nodelist.append(node.render(context))
>   File "/usr/lib/python2.7/dist-packages/django/template/
> defaulttags.py", line 313, in render
>     return self.nodelist_true.render(context)
>   File "/usr/lib/python2.7/dist-packages/django/template/base.py",
> line 747, in render
>     bits.append(self.render_node(node, context))
>   File "/usr/lib/python2.7/dist-packages/django/template/debug.py",
> line 73, in render_node
>     result = node.render(context)
>   File "/usr/lib/python2.7/dist-packages/django/template/
> defaulttags.py", line 238, in render
>     return nodelist.render(context)
>   File "/usr/lib/python2.7/dist-packages/django/template/base.py",
> line 750, in render
>     return mark_safe(''.join([force_unicode(b) for b in bits]))
> TemplateSyntaxError: Caught MemoryError while rendering:[22/Jun/2011
> 14:48:01] "GET /plot/plot/12.pdf HTTP/1.1" 500 59

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



Re: Upcoming Django conference in Asia Pacific

2011-06-22 Thread Kenneth Gonsalves
On Wed, 2011-06-22 at 14:08 +0800, Russell Keith-Magee wrote:
> > Do we have any upcoming Django conference in Asia Pacific region or
> any
> > Django conference at all here?
> 
> There is usually a Django presence (i.e., a core developer or two, a
> few talks, and many Django users) at PyCon.AU, PyCon.NZ and
> PyCon.APAC. 

and inpycon (although so far no core people)
-- 
regards
KG
http://lawgon.livejournal.com
Coimbatore LUG rox
http://ilugcbe.techstud.org/

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



MemoryError

2011-06-22 Thread Gagan (GPS)
Hi,

I am building a website that can access data from my server, plot it
and present it in a pdf format. I am experiencing the following error
and am unable to understand what to do. Kindly help.

Traceback (most recent call last):
  File "/usr/lib/python2.7/wsgiref/handlers.py", line 85, in run
self.result = application(self.environ, self.start_response)
  File "/usr/lib/python2.7/dist-packages/django/contrib/staticfiles/
handlers.py", line 68, in __call__
return self.application(environ, start_response)
  File "/usr/lib/python2.7/dist-packages/django/core/handlers/
wsgi.py", line 247, in __call__
response = self.get_response(request)
  File "/usr/lib/python2.7/dist-packages/django/core/handlers/
base.py", line 169, in get_response
response = self.handle_uncaught_exception(request, resolver,
sys.exc_info())
  File "/usr/lib/python2.7/dist-packages/django/core/handlers/
base.py", line 203, in handle_uncaught_exception
return debug.technical_500_response(request, *exc_info)
  File "/usr/lib/python2.7/dist-packages/django/views/debug.py", line
63, in technical_500_response
html = reporter.get_traceback_html()
  File "/usr/lib/python2.7/dist-packages/django/views/debug.py", line
268, in get_traceback_html
return t.render(c)
  File "/usr/lib/python2.7/dist-packages/django/template/base.py",
line 124, in render
return self._render(context)
  File "/usr/lib/python2.7/dist-packages/django/template/base.py",
line 118, in _render
return self.nodelist.render(context)
  File "/usr/lib/python2.7/dist-packages/django/template/base.py",
line 747, in render
bits.append(self.render_node(node, context))
  File "/usr/lib/python2.7/dist-packages/django/template/debug.py",
line 73, in render_node
result = node.render(context)
  File "/usr/lib/python2.7/dist-packages/django/template/
defaulttags.py", line 313, in render
return self.nodelist_true.render(context)
  File "/usr/lib/python2.7/dist-packages/django/template/base.py",
line 747, in render
bits.append(self.render_node(node, context))
  File "/usr/lib/python2.7/dist-packages/django/template/debug.py",
line 73, in render_node
result = node.render(context)
  File "/usr/lib/python2.7/dist-packages/django/template/
defaulttags.py", line 78, in render
output = self.nodelist.render(context)
  File "/usr/lib/python2.7/dist-packages/django/template/base.py",
line 747, in render
bits.append(self.render_node(node, context))
  File "/usr/lib/python2.7/dist-packages/django/template/debug.py",
line 73, in render_node
result = node.render(context)
  File "/usr/lib/python2.7/dist-packages/django/template/
defaulttags.py", line 229, in render
nodelist.append(node.render(context))
  File "/usr/lib/python2.7/dist-packages/django/template/
defaulttags.py", line 313, in render
return self.nodelist_true.render(context)
  File "/usr/lib/python2.7/dist-packages/django/template/base.py",
line 747, in render
bits.append(self.render_node(node, context))
  File "/usr/lib/python2.7/dist-packages/django/template/debug.py",
line 73, in render_node
result = node.render(context)
  File "/usr/lib/python2.7/dist-packages/django/template/
defaulttags.py", line 238, in render
return nodelist.render(context)
  File "/usr/lib/python2.7/dist-packages/django/template/base.py",
line 750, in render
return mark_safe(''.join([force_unicode(b) for b in bits]))
TemplateSyntaxError: Caught MemoryError while rendering:[22/Jun/2011
14:48:01] "GET /plot/plot/12.pdf HTTP/1.1" 500 59

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



Re: updating a user form?

2011-06-22 Thread Herman Schistad
On Wed, Jun 22, 2011 at 08:28, raj  wrote:
> I'm trying to create an update_profile form. This form will be able to
> update extended user information that is not in the original form.
>
> So, I have a form that allows you to create an account. There a lot of
> other fields that aren't listed in this form. The rest of these fields
> will be found when the user actually logs in. What I can't figure out
> is how to make the class that allows them to update this information.
> Like in the extended user class that I made, I have a save function
> that creates a user and saves it. But I don't want to create another
> user with this form. I simply want to update the current authenticated
> user. I thought there would be an update_user type function in the
> UserManager(), but there isn't. I tried googling and didn't come up
> with much. Help Please?

I don't quite understand what you mean...

When you say load the url: /userprofile/1234/ at got your urls.py to
get  from the URL.
Then you could load that userprofile from the db with e.g.

def a_nice_view(request, id):
from django.auth.models import User
userprofile = User.objects.get(pk=id)
## Then do updating on that profile here ##
userprofile.username = "Somethingnew"

It's the same way with a form/request, and you can get the userprofile
with: request.user

All this is pretty basic stuff, and as I've seen you ask a lot of
these questions on django-users I would really advise you to read a
introductory book or do some more tutorials before trying to make
something advanced yourselves.

-- 
With regards, Herman Schistad

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



updating a user form?

2011-06-22 Thread raj
I'm trying to create an update_profile form. This form will be able to
update extended user information that is not in the original form.

So, I have a form that allows you to create an account. There a lot of
other fields that aren't listed in this form. The rest of these fields
will be found when the user actually logs in. What I can't figure out
is how to make the class that allows them to update this information.
Like in the extended user class that I made, I have a save function
that creates a user and saves it. But I don't want to create another
user with this form. I simply want to update the current authenticated
user. I thought there would be an update_user type function in the
UserManager(), but there isn't. I tried googling and didn't come up
with much. Help Please?

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



Re: Upcoming Django conference in Asia Pacific

2011-06-22 Thread Russell Keith-Magee
On Wed, Jun 22, 2011 at 1:59 PM, Dealshelve Team  wrote:
> Hey guys,
>
> Do we have any upcoming Django conference in Asia Pacific region or any
> Django conference at all here?

There is usually a Django presence (i.e., a core developer or two, a
few talks, and many Django users) at PyCon.AU, PyCon.NZ and
PyCon.APAC.

However, at present, there are no concrete plans to hold a
DjangoCon.AU, DjangoCon.NZ or DjangoCon.APAC.

There have been many expressions of interest in attending such an
event; however, what is missing is a group of community members
willing to step up and organize the event. If such a group were to
emerge, the Django Software Foundation would do whatever it can to
support the organization process.

Yours,
Russ Magee %-)

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