Hello, Running Django's dev server on mysql 4.1.20 and trying to make use of the get_for_model method from the ContentTypes package to get the content type of a model (using the examples laid out in the GenericForeignKey documentation http://www.djangoproject.com/documentation/models/generic_relations/ )
Here's the example code from the documentation: # However, excluding GenericRelations means your lookups have to be a bit more # explicit. >>> from django.contrib.contenttypes.models import ContentType >>> ctype = ContentType.objects.get_for_model(quartz) >>> TaggedItem.objects.filter(content_type__pk=ctype.id, >>> object_id=quartz.id) [<TaggedItem: clearish>, <TaggedItem: shiny>] When I run this line: ctype = ContentType.objects.get_for_model(quartz) I get this SQL built: SELECT `django_content_type`.`id`,`django_content_type`.`name`,`django_content_type`.`app_label`,`django_content_type`.`model` FROM `django_content_type` WHERE (`django_content_type`.`model` = quartz AND `django_content_type`.`app_label` = myapp) MySQL doesn't like having no ticks around the two values 'quartz' and 'myapp' in this case. (My app is actually named "database" right now, which is a mysql reserved word as well.) In the example docs quartz is actually an instance of a model, but in mine I'm doing something like this: from site.myapp.models import MyModel ctype = ContentType.objects.get_for_model(MyModel) Which would generate sql similar to above, but "quartz" would be replaced with "mymodel". I suspect I shouldn't be using it this way, but seeing SQL like that being run also concerned me. Any ideas? Jay --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---