Eldwin Eldwin
Eldwin Eldwin

Reputation: 1094

.py file is not compiled on django

I'm using django 1.6.1. I got one file name "payment.py" on models folder and it's not compiled to .pyc file. Even if I changed the file name to "payment_room.py", it still won't be compiled

The other model files have been compiled already and worked pretty well.

Because of that, django won't create the table on my database if I run syncdb command. I run validate command using manage.py, but it didn't return any error.

N.B. It's still on debug & development mode. The web hasn't been deployed to apache server yet.

from django.db import models
from ghb_manager.models.reservation import Reservation

class Payment (models.Model):
    class Meta:
        app_label = 'ghb_manager'

    PAYMENT_METHOD_CHOICES = (
    ('CA', 'Cash'),
    ('CR', 'Credit'),
    ('TR', 'Transfer')
    )

    payment_id = models.CharField(max_length=14, primary_key=True)
    reservation_id = models.ForeignKey(Reservation)
    ammount_tendered = models.DecimalField(max_digits=19, decimal_places=2)
    payment_method = models.CharField(max_length=20, choices=PAYMENT_METHOD_CHOICES)
    payment_date = models.DateField()

    def __unicode__(self):
        return self.payment_id

Upvotes: 2

Views: 942

Answers (1)

Anurag
Anurag

Reputation: 3114

Please check your init.py in your models directory. You have to import all the models you create in models directory, like:

# __init__.py
from payment import Payment

Django looks into app.models for app's models.

Upvotes: 2

Related Questions