Thursday, June 30, 2011

Re: ImportError: No module named site

On Jun 29, 7:32 pm, Kyle Latham <kly.lat...@gmail.com> wrote:
(snip)
> I have no idea what is going wrong, but here is all my code thus far
> (I'm following the tutorial to create my own app that will display
> various material measurements)
>
> -----------------------------------------------
> models.py
> -----------------------------------------------
> from django.db import models
>
> # Create your models here.
> class adhesive(models.Model):
>     measurement_id = models.CharField(max_length = 200)
>     material_id = models.CharField(max_length = 200)
>     program_name = models.CharField(max_length = 200)
>     date = models.DateField()
>     measurement_method = models.CharField(max_length = 30)
>     frequency_low = models.IntegerField()
>     frequency_high = models.IntegerField()
>
> class ceramic(models.Model):
>     measurement_id = models.CharField(max_length = 200)
>     material_id = models.CharField(max_length = 200)
>     program_name = models.CharField(max_length = 200)
>     date = models.DateField()
>     measurement_method = models.CharField(max_length = 30)
>     frequency_low = models.IntegerField()
>     frequency_high = models.IntegerField()
>
> class composite(models.Model):
>     measurement_id = models.CharField(max_length = 200)
>     material_id = models.CharField(max_length = 200)
>     program_name = models.CharField(max_length = 200)
>     date = models.DateField()
>     measurement_method = models.CharField(max_length = 30)
>     frequency_low = models.IntegerField()
>     frequency_high = models.IntegerField()
>

Totally unrelated to your question, but: why on earth are you creating
3 distincs models with the exact same fields ??? You just need one
single model, and add a "material_type" field (eventually passing in a
choices list of "Composite", "Ceramic" and "Adhesive").

Also and while we're at it, the naming convention in Python is to use
MixedCase for class names. Better to follow the established
conventions....

--
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 django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

No comments:

Post a Comment