This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import json | |
from django.conf import settings | |
from django.contrib.postgres.fields import ( | |
JSONField as DjangoJSONField, | |
ArrayField as DjangoArrayField, | |
) | |
from django.db.models import Field | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class MyIndex(SearchIndex): | |
text = EdgeNgramField(document=True, use_template=True) | |
# >edge... instead of indexes.CharField | |
# found here: http://stackoverflow.com/questions/4391631/how-do-i-do-a-partial-field-match-using-haystack |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from django.test import TestCase | |
from django_webtest import WebTest | |
__author__ = 'Francois CONSTANT' | |
class SimpleTest(TestCase): | |
""" | |
Based on django TestCase | |
adapted for unit tests and functional tests not involving forms / users logged-in etc. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT people_user.* | |
FROM people_user | |
LEFT OUTER JOIN ( | |
SELECT MIN(user_id) as MinId, email | |
FROM people_user | |
GROUP BY email | |
) as KeepRows ON | |
people_user.user_id = KeepRows.MinId | |
WHERE | |
KeepRows.MinId IS NULL; |