Hi, i do not know how its going to achieve but in my case.
For each payment entry i will add delete button and will disable the
default django admin interface.
Create a separate GroupProfile class
class GroupProfile(models.Model):
name = models.CharField(_('name'), max_length=80, unique=True)
group = models.ManyToManyField(Group, verbose_name=_('group'),
blank=True)
city = models.ForeignKey(city)
user = models.ManyToManyField(User)
class Meta:
verbose_name = _('group')
verbose_name_plural = _('groups')
def __unicode__(self):
return self.name
Create a group for instance do_delete and assign the permission to
delete the entry.
Now create an entry for GroupProfile for instance do_delete_group and
assign the user and do_delete to this group.
in payment view you can write this code
tc = GroupProfile.objects.all().filter(user=use)
gd= {}
for obj in tc:
n = obj.group.all()
for o in n:
gd[o.name]=o.name
value = gd.values()
render the value to the template and check if the value exist then
show the delete button otherwise do not delete.
Thanks
On May 10, 7:15 am, Margie <[email protected]> wrote:
> I thought that might be the case. Is that true of the deletes done by
> a formset save as well? IE, when a formset.save() is done, in some
> cases my delete will be called, and in some cases not?
>
> Margie
>
> On May 9, 4:57 pm, James Bennett <[email protected]> wrote:
>
> > On Sat, May 9, 2009 at 7:49 PM, George Song <[email protected]> wrote:
> > > I think if you want to know definitively if your `delete()` method is
> > > being called or not, your debug statement should go in that method. I
> > > wouldn't be surprised if Django is sending pre and post delete signals
> > > even during bulk deletion.
>
> > It's kind of tricky, really, because there's not any guarantee one way
> > or another -- QuerySet.delete() *may* call delete() methods of
> > individual objects, or it may not. IIRC it mostly comes down to how
> > much of the deletion can be done in a bulk SQL DELETE statement, and
> > how much (due to, e.g., relationships involved) requires fetching the
> > individual objects and deleting them one at a time.
>
> > --
> > "Bureaucrat Conrad, you are technically correct -- the best kind of
> > correct."
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---