Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7597549
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T22:11:01+00:00 2026-05-30T22:11:01+00:00

I’ve been trying to get a new Django app to work, where I call

  • 0

I’ve been trying to get a new Django app to work, where I call another Model using a ForeignKey. All seems to be going well on my local machine and it shows up as expected.

However, when I try this on my production server, it’s just not working. I’ve been messing around with this for too long now, and I feel it’s time for the big guns and ask the question here 😉

This is the situation:

1) customerModel

from django.db import models
from mysite.product.models import Product
from mysite.province.models import provinceModel
from mysite.district.models import districtModel

class customerModel(models.Model):
    productId = models.ForeignKey(Product)
    name = models.CharField(max_length=30)
    province = models.ForeignKey(provinceModel)
    district = models.ForeignKey(districtModel)

    def __str__(self):
        return self.name

2) provinceModel

from django.db import models

class provinceModel(models.Model):
    name = models.CharField(max_length=30)

    def __str__(self):
        return self.name

As said, it all works fine on local. On production, I’m trying the same and it gives me this error:

Error: One or more models did not validate:
customer.customerModel: 'province' has a relation with model <class 'mysite.province.models.provinceModel'>, 
which has either not been installed or is abstract.

I’m guessing it’s abstract… Since it’s definitely installed (in settings.py).

To make things right, I decided to toy around. I noticed even when removing all code there and just trying to edit the app using the django admin feature, it won’t show up in admin either.

I’m pretty sure these two problems are related, and I am hoping someone came across sth similar or just knows what I’m supposed to do here. I start to get the feeling there’s an internal conflict somewhere, Django is not telling me about. Since some models can be added to ForeignKeys, like the district one, but new models just won’t work. I tried adding another new one too.

And yes, I did read the other related posts about app’s not showing up. They’re registered in settings.py under INSTALLED_APPS. Any help is much appreciated!

3) settings.py

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.admindocs',
    'mysite.product',
    'mysite.intervention',
    'mysite.customer',
    'mysite.province',
    'mysite.part',
    'mysite.district',
)

4) directory structure

mysite
    -> customer
        -> customerModel
    -> district
        -> districtModel
    -> intervention
        -> districtModel
    -> part
        -> partModel
    -> product
        -> productModel
    -> province
        -> provinceModel
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T22:11:02+00:00Added an answer on May 30, 2026 at 10:11 pm
    from django.db import models
    
    # Notice you don't need these imports with string notation
    
    class customerModel(models.Model):
        productId = models.ForeignKey('product.Product')
        name = models.CharField(max_length=30)
        province = models.ForeignKey('province.provinceModel')
        district = models.ForeignKey('district.districtModel')
    
        def __unicode__(self):    # use __unicode__ !!!
            return self.name
    

    Try that. I answered you on IRC but you logged off right as i posted the answer. If you’re going to spam your SO problem all over the net, wait for an answer. I almost didn’t chase you here.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I'm using v2.0 of ClassTextile.php, with the following call: $testimonial_text = $textile->TextileRestricted($_POST['testimonial']); ... and
We're building an app, our first using Rails 3, and we're having to build
I am using Paperclip to handle profile photo uploads in my app. They upload
I have a jquery bug and I've been looking for hours now, I can't
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I am trying to understand how to use SyndicationItem to display feed which is
Basically, what I'm trying to create is a page of div tags, each has
I am reading a book about Javascript and jQuery and using one of the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.