0001-use-new-Django-contenttypes.fields-10943.patch
welco/qualif/models.py | ||
---|---|---|
15 | 15 |
# along with this program. If not, see <http://www.gnu.org/licenses/>. |
16 | 16 | |
17 | 17 |
from django.contrib.contenttypes.models import ContentType |
18 |
from django.contrib.contenttypes import generic
|
|
18 |
from django.contrib.contenttypes.fields import GenericForeignKey
|
|
19 | 19 |
from django.core.urlresolvers import reverse |
20 | 20 |
from django.db import models |
21 | 21 |
from django.utils.translation import ugettext_lazy as _ |
... | ... | |
26 | 26 |
class Association(models.Model): |
27 | 27 |
source_type = models.ForeignKey(ContentType) |
28 | 28 |
source_pk = models.PositiveIntegerField() |
29 |
source = generic.GenericForeignKey('source_type', 'source_pk')
|
|
29 |
source = GenericForeignKey('source_type', 'source_pk') |
|
30 | 30 |
comments = models.TextField(blank=True, verbose_name=_('Comments')) |
31 | 31 |
formdef_reference = models.CharField(max_length=250, null=True) |
32 | 32 |
formdata_id = models.CharField(max_length=250, null=True) |
welco/sources/counter/models.py | ||
---|---|---|
14 | 14 |
# You should have received a copy of the GNU Affero General Public License |
15 | 15 |
# along with this program. If not, see <http://www.gnu.org/licenses/>. |
16 | 16 | |
17 |
from django.contrib.contenttypes import generic
|
|
17 |
from django.contrib.contenttypes.fields import GenericRelation
|
|
18 | 18 |
from django.db import models |
19 | 19 |
from django.utils.translation import ugettext_lazy as _ |
20 | 20 | |
... | ... | |
28 | 28 |
# common to all source types: |
29 | 29 |
status = models.CharField(_('Status'), blank=True, max_length=50) |
30 | 30 |
contact_id = models.CharField(max_length=50, null=True) |
31 |
associations = generic.GenericRelation(Association,
|
|
31 |
associations = GenericRelation(Association, |
|
32 | 32 |
content_type_field='source_type', object_id_field='source_pk') |
33 | 33 | |
34 | 34 |
creation_timestamp = models.DateTimeField(auto_now_add=True) |
welco/sources/mail/models.py | ||
---|---|---|
17 | 17 |
import re |
18 | 18 |
import subprocess |
19 | 19 | |
20 |
from django.contrib.contenttypes import generic
|
|
20 |
from django.contrib.contenttypes.fields import GenericRelation
|
|
21 | 21 |
from django.contrib.contenttypes.models import ContentType |
22 | 22 |
from django.core.urlresolvers import reverse |
23 | 23 |
from django.db import models |
... | ... | |
45 | 45 |
# common to all source types: |
46 | 46 |
status = models.CharField(_('Status'), blank=True, max_length=50) |
47 | 47 |
contact_id = models.CharField(max_length=50, null=True) |
48 |
associations = generic.GenericRelation(Association,
|
|
48 |
associations = GenericRelation(Association, |
|
49 | 49 |
content_type_field='source_type', object_id_field='source_pk') |
50 | 50 | |
51 | 51 |
creation_timestamp = models.DateTimeField(auto_now_add=True) |
welco/sources/phone/models.py | ||
---|---|---|
14 | 14 |
# You should have received a copy of the GNU Affero General Public License |
15 | 15 |
# along with this program. If not, see <http://www.gnu.org/licenses/>. |
16 | 16 | |
17 |
from django.contrib.contenttypes import generic
|
|
17 |
from django.contrib.contenttypes.fields import GenericRelation
|
|
18 | 18 |
from django.core.urlresolvers import reverse |
19 | 19 |
from django.db import models |
20 | 20 |
from django.utils.translation import ugettext_lazy as _ |
... | ... | |
35 | 35 |
# common to all source types: |
36 | 36 |
status = models.CharField(_('Status'), blank=True, max_length=50) |
37 | 37 |
contact_id = models.CharField(max_length=50, null=True) |
38 |
associations = generic.GenericRelation(Association,
|
|
38 |
associations = GenericRelation(Association, |
|
39 | 39 |
content_type_field='source_type', object_id_field='source_pk') |
40 | 40 | |
41 | 41 |
creation_timestamp = models.DateTimeField(auto_now_add=True) |
42 |
- |