Delete/Update Many-to-Many tables
Wait... I'm confused by your code. You're doing a select? I think you copy/pasted wrong.

This is really not appropriate for github, please ask on stackoverflow.
 sorry for the mistake in updateEntries method, my intention was to delete all entries in Job table and everything that associate with it using this code 

```
query = models.Job.delete().where(models.Job.timestamp < datetime.date.today()-datetime.timedelta(days=2))  
query.execute()
```

 but generate 

```
peewee.IntegrityError: (1451, 'Cannot delete or update a parent row: a foreign key constraint fails (career.category_job_through, CONSTRAINT category_job_through_ibfk_2 FOREIGN KEY (job_id) REFERENCES job (id))')
```

what can i do?
 You need to first delete the rows from the through table that reference the job you're deleting.

@coleifer great job, kindly help... i'm having challenge deleting and updating many to many tables, below is the model and code

```
class Job(Model):
    """docstring for Jobs"""
    url = CharField(max_length=200, unique=True)
    title = TextField()
    description = TextField()
    sponsor = CharField(max_length=100)
    location = CharField(max_length=100)
    uuid = CharField(max_length=150)
    timestamp = DateTimeField(default=datetime.datetime.now)

    class Meta:
        database = DATABASE
        order_by = ('-timestamp',)

class Category(Model):
    """docstring for JobCategory"""
    category = CharField(max_length=100, unique=True)
    cat_slug = TextField()
    jobs = ManyToManyField(Job, related_name='categories')

    class Meta:
        database = DATABASE

JobsCategory = Category.jobs.get_through_model()
```

here is the method to delete queries, actually it work but it only delete a row, how can i delete multiple rows 

```
    def updateEntries(self):
        try:
            query = models.Job.select().where(models.Job.timestamp < datetime.date.today()-datetime.timedelta(days=2)):
            return jobs.execute()  # Returns the number of rows deleted. delete_instance()

        except models.DoesNotExist:
            pass

```

Using the method below will raise error

```
query = models.Job.delete().where(models.Job.timestamp < datetime.date.today()-datetime.timedelta(days=2))
return query.execute()

Error: 
peewee.IntegrityError: (1451, 'Cannot delete or update a parent row: a foreign key constraint fails (`career`.`category_job_through`, CONSTRAINT `category_job_through_ibfk_2` FOREIGN KEY (`job_id`) REFERENCES `job` (`id`))')
```
