I posted this here before a few days ago but I couldn't get a
conclusive answer, so I thought I'd try again. I'm pretty much stuck
on this one and I'm getting a weird error that I don't really
understand.

When the reminders_list in the 'if' statement below gets assigned,
there doesn't seem to be a problem. But when I reference it at the
bottom of the code segment. I end up with the programming error at the
bottom of the page.

What I'm trying to do is basically - if a campaign has a group
associated with it, then i want to get all the reminders associated
with those groups.... I also have a table layout below ...

       for campaign in campaigns_list :

            # Get the details of the reminders to whom this campaign
will be
sent
            if campaign.groups.all() > 0 :

                # Each campaign has groups and each group has reminder
profiles
                reminders_list =
Reminders.objects.filter(campaigns__groups__id__in=[g.id for g in
campaign.groups.all()])

            else:

                # Campaigns have no groups - send to
all
                reminders_list =
Reminders.objects.filter(campaigns__pk=campaign.id)

            # Get the profile of the client who owns this
reminder
            profile = request.user.get_profile()

            # Only send a message if it has not been sent
before...
            if campaign.campaign_sent is False :

                shoutout_log("LOG: Campaign has not been sent \n")

                # Loop through every
reminders ...
                for r in reminders_list :

                        ..............

######################################################################################

# People who need to be reminded
class Reminders (models.Model):
     userProfile = models.ForeignKey(UserProfile)
     groups = models.ManyToManyField(Groups, blank=True, null=True)
     campaigns = models.ManyToManyField(Campaigns, blank=True,
null=True)

# Campaign that needs to be sent out to People
class Campaigns (models.Model):
     userProfile = models.ForeignKey(UserProfile)
     groups = models.ManyToManyField(Groups, blank=True, null=True)

# Groups of People
class Groups (models.Model):
     userProfile = models.ForeignKey(UserProfile)
     name = models.CharField( maxlength=100 )
     groups_hash = models.CharField( maxlength=16 )
     description = models.CharField( maxlength=100 )

#####################################################################################

ProgrammingError at /campaign/gn6hj9iuatcuzwld/
ERROR: syntax error at or near ")" at character 1288 SELECT
"tarait1_reminders"."id","tarait1_reminders"."userProfile_id","tarait1_reminders"."name","tarait1_reminders"."email","tarait1_reminders"."phone","tarait1_reminders"."entry_date","tarait1_reminders"."birth_date","tarait1_reminders"."address","tarait1_reminders"."notes","tarait1_reminders"."email_contact","tarait1_reminders"."sms_contact","tarait1_reminders"."newsletter_contact","tarait1_reminders"."reminder_hash","tarait1_reminders"."email_sent","tarait1_reminders"."newsletter_sent","tarait1_reminders"."sms_sent"
FROM "tarait1_reminders" LEFT OUTER JOIN "tarait1_reminders_campaigns"
AS
"m2m_tarait1_reminders__campaigns" ON "tarait1_reminders"."id" =
"m2m_tarait1_reminders__campaigns"."reminders_id" INNER JOIN
"tarait1_campaigns" AS
"tarait1_reminders__campaigns" ON
"m2m_tarait1_reminders__campaigns"."campaigns_id" =
"tarait1_reminders__campaigns"."id" LEFT OUTER JOIN
"tarait1_campaigns_groups" AS
"m2m_tarait1_reminders__campaigns__groups" ON
"tarait1_reminders__campaigns"."id" =
"m2m_tarait1_reminders__campaigns__groups"."campaigns_id" INNER JOIN
"tarait1_groups"
 AS "tarait1_reminders__campaigns__groups" ON
"m2m_tarait1_reminders__campaigns__groups"."groups_id" =
"tarait1_reminders__campaigns__groups"."id" WHERE
("tarait1_reminders__campaigns__groups"."id" IN ())


--~--~---------~--~----~------------~-------~--~----~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to