NameError: name 'FileAttachment' is not defined
Question: I have two different Django Apps, one of them is `fileUpload`. In File Upload
I added a Generic Relation as:

    
    
    from django.db import models
    from django.contrib.contenttypes import generic
    from django.contrib.contenttypes.models import ContentType
    
    class FileAttachment(models.Model):
        file = models.FileField(upload_to='fileuploads/%Y-%m-%d/')
        content_type = models.ForeignKey(ContentType)
        object_id = models.PositiveIntegerField()
        attachee = generic.GenericForeignKey()
    

In my other app named `XYZ` I added following reverse generic relation in
`models.py`

    
    
    attachment = generic.GenericRelation(FileAttachment)
    

Now, so if I run `manage.py syncdb` or any other manage command, I get error:
**NameError: FileAttachment**

IN installed Apps I have following stuff:

    
    
    INSTALLED_APPS = (
        'django.contrib.auth',
        'django.contrib.contenttypes',
        'django.contrib.sessions',
        'django.contrib.sites',
        'django.contrib.messages',
        'django.contrib.staticfiles',
        'django.contrib.admin',
        'django.contrib.markup',
        'django.contrib.humanize',
        'south',
        'taggit',
        'taggit_autocomplete_modified',
        'compressor',
        'bootstrapform',
        'fileupload',
        'XYZ'
    )
    

Both apps, `XYZ` and `fileupload` are on same root level.

I am using Django 1.5 with Python2.7


Answer: Did you import the FileAttachement in the XYZ models?

Try this in **XYZ/models.py** :

`from fileupload.models import FileAttachment`

