Re: Server error caused by too many database look-ups

2012-05-04 Thread Jonas Ghyllebert
The site is in debug mode. The problem however is that we build the 
application step-by-step, because we need data from our client for the next 
steps. 
That's why we already deployed the site on Google App Engine.

As of the syntax errors you mention, we don't get any errors while testing 
the app. But we'll look into it.

I'll give database caching a try for my original problem.

On Thursday, May 3, 2012 8:53:20 AM UTC+2, koenb wrote:
>
> You should use DEBUG=True in your development settings, so you get a 
> proper traceback of what is going on. 
>
> As far as I can see, you do have syntax errors in your models.py file (eg 
> line 266). You should fix them first.
>
> As a side note, your unicode methods are not all correct, some of them are 
> returning bytestrings (this may bite you once you start using non-ascii 
> data).
>
> Koen
>
> Op woensdag 2 mei 2012 21:37:30 UTC+2 schreef Jonas Ghyllebert het 
> volgende:
>>
>> Hi everybody,
>>
>> I've got a problem while accessing a model in the Django Adminpanel.
>> I uploaded the models file, i hope this makes it easier for you to 
>> understand my problem.
>>
>> When I try to add or view a *Region *in the adminpanel, the server 
>> usually gives me an 500 server error.
>> This is what i get to see:
>>  
>> Error: Server ErrorThe server encountered an error and could not 
>> complete your request.
>>
>> If the problem persists, please 
>> report your 
>> problem and mention this error message and the query that caused it.
>>
>> Now, in the uploaded file you may (or not) have seen that I want to have 
>> 25 fields from Zip.
>>
>> My guess is that Django connects to the database for every listbox it is 
>> generating.
>> Is there a way to cache the 2000+ zips?
>> Or, am I seeing it wrong? What should I do then?
>>
>> Greetings
>>
>>
>>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/yTBIKZ75THYJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Server error caused by too many database look-ups

2012-05-03 Thread koenb
You should use DEBUG=True in your development settings, so you get a proper 
traceback of what is going on. 

As far as I can see, you do have syntax errors in your models.py file (eg 
line 266). You should fix them first.

As a side note, your unicode methods are not all correct, some of them are 
returning bytestrings (this may bite you once you start using non-ascii 
data).

Koen

Op woensdag 2 mei 2012 21:37:30 UTC+2 schreef Jonas Ghyllebert het volgende:
>
> Hi everybody,
>
> I've got a problem while accessing a model in the Django Adminpanel.
> I uploaded the models file, i hope this makes it easier for you to 
> understand my problem.
>
> When I try to add or view a *Region *in the adminpanel, the server 
> usually gives me an 500 server error.
> This is what i get to see:
>  
> Error: Server ErrorThe server encountered an error and could not complete 
> your request.
>
> If the problem persists, please 
> report your 
> problem and mention this error message and the query that caused it.
>
> Now, in the uploaded file you may (or not) have seen that I want to have 
> 25 fields from Zip.
>
> My guess is that Django connects to the database for every listbox it is 
> generating.
> Is there a way to cache the 2000+ zips?
> Or, am I seeing it wrong? What should I do then?
>
> Greetings
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/-6OzpusVZSMJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Server error caused by too many database look-ups

2012-05-02 Thread Jonas Ghyllebert
Hi everybody,

I've got a problem while accessing a model in the Django Adminpanel.
I uploaded the models file, i hope this makes it easier for you to 
understand my problem.

When I try to add or view a *Region *in the adminpanel, the server usually 
gives me an 500 server error.
This is what i get to see:
 
Error: Server ErrorThe server encountered an error and could not complete 
your request.

If the problem persists, please 
report your 
problem and mention this error message and the query that caused it.

Now, in the uploaded file you may (or not) have seen that I want to have 25 
fields from Zip.

My guess is that Django connects to the database for every listbox it is 
generating.
Is there a way to cache the 2000+ zips?
Or, am I seeing it wrong? What should I do then?

Greetings


-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/uvmzpHMtx0gJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

from django.db import models
from django.contrib import admin

### Zip
class Province(models.Model):
province_name = models.CharField(max_length=145)

class Meta:
verbose_name =  "provincie"

def __unicode__(self):
return self.province_name 

class Zip(models.Model):
zip_code = models.IntegerField()
zip_name = models.CharField(max_length=75)
zip_lang = models.CharField(max_length=2)
province = models.ForeignKey(Province)

class Meta:
ordering = ["zip_name"]
verbose_name = "postcode"

def __unicode__(self):
return self.zip_name + ' (' + unicode(self.zip_code) +')'

### Contact
class Contact_type(models.Model):
contact_type = models.CharField(max_length=50)
class Meta:
verbose_name = "contact type"
verbose_name_plural = "contact types"

def __unicode__(self):
return self.contact_type


### Collaborator
class Collaborator_function(models.Model):
collaborator_function_name = models.CharField(max_length=100)

class Meta:
verbose_name = "medewerker functie"
verbose_name_plural = "medewerker functies"

def __unicode__(self):
return self.collaborator_function_name

class Collaborator_type(models.Model):
Collaborator_type_name = models.CharField(max_length=100)
def __unicode__(self):
return self.Collaborator_type_name

class Meta:
verbose_name = "medewerker type"
verbose_name_plural = "medewerker types"

class Collaborator(models.Model):
collaborator_first_name = models.CharField(max_length=45)
collaborator_last_name = models.CharField(max_length=45)
collaborator_birth_year = models.DateField()
collaborator_start_year = models.DateField()
collaborator_end_year = models.DateField(blank=True,null=True)
collaborator_function = models.ForeignKey(Collaborator_function)
collaborator_type = models.ForeignKey(Collaborator_type)
collaborator_legal = models.CharField(max_length=100,blank=True,null=True)
collaborator_vat = models.CharField(max_length=100,blank=True,null=True)
collaborator_zoho_id= models.IntegerField(blank=True,null=True)
collaborator_maximmo_id = models.IntegerField(blank=True,null=True)
collaborator_biv_number = models.IntegerField(blank=True,null=True)
collaborator_drupal_id = models.IntegerField(blank=True,null=True)

def __unicode__(self):
return self.collaborator_first_name + ' ' + self.collaborator_last_name

class Meta:
verbose_name = "medewerker"
verbose_name_plural = "medewerkers"

class Contact_per_collaborator(models.Model):
collaborator = models.ForeignKey(Collaborator)
contact_link = models.CharField(max_length=150)
contact_type = models.ForeignKey(Contact_type)
def __unicode__(self):
return self.contact_link

class Meta:
verbose_name = "contact"

class commission_collaborator_percentage(models.Model):
collaborator = models.ForeignKey(Collaborator)
commission_collaborator_percentage = models.IntegerField()
commission_collaborator_start_date = models.DateField()
commission_collaborator_end_date = models.DateField()

class Meta:
verbose_name = "Medewerker commissie (percentage)"
verbose_name_plural = "Medewerker commissies (percentage)"

### Office
class Office(models.Model):
office_name = models.CharField(max_length=100)
office_legal = models.CharField(max_length=100)
office_address_street = models.CharField(max_length=100)
office_address_number = models.CharField(max_length=25)