Re: Inconsistent behavior when deleting related records for a model instance

2011-08-25 Thread Chad Lyon
That is exactly what I want.

Thanks

On Aug 18, 5:38 pm, Anssi Kääriäinen  wrote:
> On Aug 18, 11:55 pm,ChadLyon wrote:
>
>
>
>
>
>
>
>
>
> > I have a problem with the way django deletes related objects. I have
> > overridden the delete() method for my app so that I may do some
> > "specialness" when something is deleted (if you must know I log the
> > full deleted record to another mysql db). I have done this abstractly
> > for all models in my app.
>
> > The issue is when deleting related records for a model instance django
> > eventually calls the following method on django.db.models.Model:
>
> > def delete(self, using=None):
> >         using = using or router.db_for_write(self.__class__,
> > instance=self)
> >         assert self._get_pk_val() is not None, "%s object can't be
> > deleted because its %s attribute is set to None." %
> > (self._meta.object_name, self._meta.pk.attname)
>
> >         # Find all the objects than need to be deleted.
> >         seen_objs = CollectedObjects()
> >         self._collect_sub_objects(seen_objs)
>
> >         # Actually delete the objects.
> >         delete_objects(seen_objs, using)
>
> > There is a problem with this method in that it calls
> > delete_objects(...) which descends into all children and deletes them
> > by constructing SQL (FWIU) to perform the delete. This circumvents the
> > delete(self, using=None) method on the Child objects. Meaning if I
> > have overridden delete() then my overridden routine doesn't get called
> > for my Children only for the Parent. This seems to be inconsistent
> > behavior. Don't you think delete() should be called on all seen_objs?
>
> I think the post_delete signal is what you want. The model.delete() is
> meant for single object deletion. Bulk delete doesn't call it. This is
> documented 
> athttps://docs.djangoproject.com/en/dev/topics/db/models/#overriding-mo
> I know that can be a little confusing, but there is a good reason for
> this. If you are deleting thousands of objects, you really, really
> don't want to delete them one at a time.

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



Re: What is Django?

2011-08-25 Thread Justin Holmes
I've put some language down to get us started:

https://docs.google.com/document/d/15iJXXKs989cIIvhToa7ttYgToPSyzJN9KL9CCkxka1o/edit?pli=1=en_US



On Wed, Aug 24, 2011 at 6:31 AM, Cal Leeming [Simplicity Media Ltd]
 wrote:
>
>
> On Wed, Aug 24, 2011 at 11:04 AM, Tom Evans 
> wrote:I'll
>>
>> On Tue, Aug 23, 2011 at 6:34 PM, Cal Leeming [Simplicity Media Ltd]
>>  wrote:
>> >
>> > +1 on this idea :)
>>
>> I don't think Russell is looking for votes on whether to do it, he's
>> looking for someone to actually do it :)
>
> Lol, yeah I guessed that already. *adds into todo list*
>
>>
>> Cheers
>>
>> Tom
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django developers" group.
>> To post to this group, send email to django-developers@googlegroups.com.
>> To unsubscribe from this group, send email to
>> django-developers+unsubscr...@googlegroups.com.
>> For more options, visit this group at
>> http://groups.google.com/group/django-developers?hl=en.
>>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django developers" group.
> To post to this group, send email to django-developers@googlegroups.com.
> To unsubscribe from this group, send email to
> django-developers+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-developers?hl=en.
>



-- 
Justin Holmes

Head Instructor, SlashRoot Collective
SlashRoot: Coffee House and Tech Dojo
60 Main Street
New Paltz, NY 12561
845.633.8330

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



Re: What is Django?

2011-08-25 Thread Justin Holmes
Sorry, here's the appropriate link:

https://docs.google.com/document/pub?id=15iJXXKs989cIIvhToa7ttYgToPSyzJN9KL9CCkxka1o

On Thu, Aug 25, 2011 at 2:50 PM, Justin Holmes  wrote:
> I've put some language down to get us started:
>
> https://docs.google.com/document/d/15iJXXKs989cIIvhToa7ttYgToPSyzJN9KL9CCkxka1o/edit?pli=1=en_US
>
>
>
> On Wed, Aug 24, 2011 at 6:31 AM, Cal Leeming [Simplicity Media Ltd]
>  wrote:
>>
>>
>> On Wed, Aug 24, 2011 at 11:04 AM, Tom Evans 
>> wrote:I'll
>>>
>>> On Tue, Aug 23, 2011 at 6:34 PM, Cal Leeming [Simplicity Media Ltd]
>>>  wrote:
>>> >
>>> > +1 on this idea :)
>>>
>>> I don't think Russell is looking for votes on whether to do it, he's
>>> looking for someone to actually do it :)
>>
>> Lol, yeah I guessed that already. *adds into todo list*
>>
>>>
>>> Cheers
>>>
>>> Tom
>>>
>>> --
>>> You received this message because you are subscribed to the Google Groups
>>> "Django developers" group.
>>> To post to this group, send email to django-developers@googlegroups.com.
>>> To unsubscribe from this group, send email to
>>> django-developers+unsubscr...@googlegroups.com.
>>> For more options, visit this group at
>>> http://groups.google.com/group/django-developers?hl=en.
>>>
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django developers" group.
>> To post to this group, send email to django-developers@googlegroups.com.
>> To unsubscribe from this group, send email to
>> django-developers+unsubscr...@googlegroups.com.
>> For more options, visit this group at
>> http://groups.google.com/group/django-developers?hl=en.
>>
>
>
>
> --
> Justin Holmes
>
> Head Instructor, SlashRoot Collective
> SlashRoot: Coffee House and Tech Dojo
> 60 Main Street
> New Paltz, NY 12561
> 845.633.8330
>



-- 
Justin Holmes

Head Instructor, SlashRoot Collective
SlashRoot: Coffee House and Tech Dojo
60 Main Street
New Paltz, NY 12561
845.633.8330

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



Re: What is Django?

2011-08-25 Thread Mikhail Korobov
Hi all,

One thing I always like about django is how the community is peaceful and 
how the django itself is peaceful and engineer-minded, not marketing-minded: 
I can't imagine whydjangoisbetterthanx.com website bashing zend, rails, 
pyramid and flask, for example. That's why the idea of putting something 
like "Django has a number of distinct, measurable advantages over similar 
web frameworks." to the djangoproject.org front page doesn't seems too 
attractive for me. 

There are many big and well-known sites built with django and I think 
mentioning these sites and providing testimonials from people working on 
these sites can be better advertisement. I respect the sites listed on 
djangoproject.org page very much but the selection is 
quite opinionated towards newspaper web sites, maybe disqus, mozilla addons, 
opera portal, yandex projects, meebo, etc. (not sure about the exact 
list) can build more trust in framework for newcomers. These are not typical 
django websites but I think they will impress people more. 

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



Re: What is Django?

2011-08-25 Thread Amirouche Boubekki
2011/8/25 Mikhail Korobov 

> Hi all,


Hi Mikhail,


> One thing I always like about django is how the community is peaceful and
> how the django itself is peaceful and engineer-minded,
>

then


> not marketing-minded:
>

granted. It's the case of many FOSS projects.


> There are many big and well-known sites built with django and I think
> mentioning these sites and providing testimonials from people working on
> these sites can be better advertisement.
>

Yes and no. Advertising on big websites & applications powered by django
would be a plus but it can be misleading. I think anybody could agree that
this same applications could have been done in PHP or Flask with the same
success (see Facebook ?).
Engineers and people that take decisions in general want to know if it gets
things done, but also how does it compare to other solutions.
Comparing on features would be more engineer-minded that «How do you feel
about Django». Engineering is not about feelings, it's a complex choice that
weights pros & cons which can be technical but also social and commercial...


In javascript world is common to compare frameworks based on speed, size, we
could extend this to common problems regarding website building like cache
management, authentication, authorization, L10N, I18N, db support,
professional support, community support and the like... and even do code to
code comparison if it makes sens.

Taking the time to draw an «état de l'art» of things get done today even if,
Django doesn't succeed in every aspect can only benefit Django project and
the community.

Regards,

Amirouche

PS: I will be happy to help to draw a comparison with Flask if we setup a
list of what to compare :)

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



Re: What is Django?

2011-08-25 Thread Julien Phalip
On 26 August 2011 07:55, Amirouche Boubekki wrote:

> 2011/8/25 Mikhail Korobov 
>
>
>> There are many big and well-known sites built with django and I think
>> mentioning these sites and providing testimonials from people working on
>> these sites can be better advertisement.
>>
>
> Yes and no. Advertising on big websites & applications powered by django
> would be a plus but it can be misleading. I think anybody could agree that
> this same applications could have been done in PHP or Flask with the same
> success (see Facebook ?).
>

While there are successful and large websites out there built with any
technology under the sun, I believe it is important to show that you *can*
use Django to build such sites. Nobody will trust that you are webscale™ until
you can show some concrete evidence of it :-)

Seeing that there are successful and large websites built with Django
certainly isn't enough to convince someone but it isn't just a plus either.
It is rather the *bare minimum* one needs to be reassured that they're not
wasting their time learning this new framework.


> Engineers and people that take decisions in general want to know if it gets
> things done, but also how does it compare to other solutions.
> Comparing on features would be more engineer-minded that «How do you feel
> about Django». Engineering is not about feelings, it's a complex choice that
> weights pros & cons which can be technical but also social and commercial...
>
>
> In javascript world is common to compare frameworks based on speed, size,
> we could extend this to common problems regarding website building like
> cache management, authentication, authorization, L10N, I18N, db support,
> professional support, community support and the like... and even do code to
> code comparison if it makes sens.
>

Comparisons are important but I'd rather encourage third parties to write
them up. Comparisons can really only be trusted from people who have
extended experience in all the compared frameworks and who do not appear
biased towards one or another. One should always be cautious with
websites/frameworks/products/whatever boasting that they are so much more
awesome than the others :-)

Julien

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



Re: What is Django?

2011-08-25 Thread Justin Holmes
Mikhail, et. al.,

I also love the vibe of the django community.  I did not mean, when
writing that line, to put down other communities; I was glad when I
found Django to be greeted by language that did not put down other
frameworks or their philosophies.   Nevertheless, I think that the
language in question is an empirically testable and true statement.
The inverse is also true: Some frameworks, for some use cases, have
distinct and measurable advantages over Django.

I'm not defending the language as it's written - by all means let's
change it.  However, I do think that it's worth mentioning, somehow,
that Django excels in certain areas and that those areas are largely
the result of sensible underlying philosophies.  I think that this
point answers a front-running question in the mind of project managers
who are considering framework adoption.






On Thu, Aug 25, 2011 at 6:30 PM, Julien Phalip  wrote:
> On 26 August 2011 07:55, Amirouche Boubekki 
> wrote:
>>
>> 2011/8/25 Mikhail Korobov 
>>
>>>
>>> There are many big and well-known sites built with django and I think
>>> mentioning these sites and providing testimonials from people working on
>>> these sites can be better advertisement.
>>
>> Yes and no. Advertising on big websites & applications powered by django
>> would be a plus but it can be misleading. I think anybody could agree that
>> this same applications could have been done in PHP or Flask with the same
>> success (see Facebook ?).
>
> While there are successful and large websites out there built with any
> technology under the sun, I believe it is important to show that you *can*
> use Django to build such sites. Nobody will trust that you are
> webscale™ until you can show some concrete evidence of it :-)
> Seeing that there are successful and large websites built with Django
> certainly isn't enough to convince someone but it isn't just a plus either.
> It is rather the *bare minimum* one needs to be reassured that they're not
> wasting their time learning this new framework.
>
>>
>> Engineers and people that take decisions in general want to know if it
>> gets things done, but also how does it compare to other solutions.
>> Comparing on features would be more engineer-minded that «How do you feel
>> about Django». Engineering is not about feelings, it's a complex choice that
>> weights pros & cons which can be technical but also social and commercial...
>>
>> In javascript world is common to compare frameworks based on speed, size,
>> we could extend this to common problems regarding website building like
>> cache management, authentication, authorization, L10N, I18N, db support,
>> professional support, community support and the like... and even do code to
>> code comparison if it makes sens.
>
> Comparisons are important but I'd rather encourage third parties to write
> them up. Comparisons can really only be trusted from people who have
> extended experience in all the compared frameworks and who do not appear
> biased towards one or another. One should always be cautious with
> websites/frameworks/products/whatever boasting that they are so much more
> awesome than the others :-)
> Julien
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django developers" group.
> To post to this group, send email to django-developers@googlegroups.com.
> To unsubscribe from this group, send email to
> django-developers+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-developers?hl=en.
>



-- 
Justin Holmes

Head Instructor, SlashRoot Collective
SlashRoot: Coffee House and Tech Dojo
60 Main Street
New Paltz, NY 12561
845.633.8330

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



Re: What is Django?

2011-08-25 Thread kenneth gonsalves
On Thu, 2011-08-25 at 14:51 -0400, Justin Holmes wrote:
> Sorry, here's the appropriate link:
> 
> https://docs.google.com/document/pub?id=15iJXXKs989cIIvhToa7ttYgToPSyzJN9KL9CCkxka1o
> 
> 

why not the wike?
-- 
regards
Kenneth Gonsalves

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