Skip to content

Instantly share code, notes, and snippets.

View hubert10's full-sized avatar

Hubert Kanyamahanga hubert10

View GitHub Profile
@hubert10
hubert10 / models.py
Created November 4, 2016 12:43 — forked from jacobian/models.py
An example of using many-to-many "through" to augment m2m relationships. See http://www.quora.com/How-do-you-query-with-a-condition-on-a-ManyToMany-model-in-Django for context.
from django.db import models
class Person(models.Model):
name = models.CharField(max_length=200)
groups = models.ManyToManyField('Group', through='GroupMember', related_name='people')
class Meta:
ordering = ['name']
def __unicode__(self):
# -*- coding: utf-8 -*-
"""
Search features for :
* :mod:`elasticsearch.elasticsearch`
* :mod:`haystack:haystack`
* :mod:`elasticstack:elasticstack`
:creationdate: 05/11/15 15:05
:moduleauthor: François GUÉRIN <fguerin@ville-tourcoing.fr>