Re: if statement in django

2014-04-05 Thread Anthony Smith
thanks now but getting the following error File "/home/tony/Documents/stockapp/stock/models.py" in save 128. self.total_price = self.calc_total_price() File "/home/tony/Documents/stockapp/stock/models.py" in calc_total_price 124. amount_price = (self.estimated_total_weight * self.sale

Re: if statement in django

2014-04-05 Thread Jay Lozier
On 04/05/2014 11:08 PM, Anthony Smith wrote: Hi I have a small project and I have been unable to get the following statement to work. Any help would great.User inputs can either self_sale_head which is a $ value,if a $ value is not add a self.estimated_weight_hd is used to get the

Sudden appearance of DatabaseWrapper Exception

2014-04-05 Thread Fraser Graham
I have been running an Django 1.5.1 app under Apache for some time without issue. Today, without any changes to the server I started seeing 500 Errors caused by an Exception in DatabaseWrapper relating to threading, I have no threading behavior in my code so this confuses me. The error affects a

if statement in django

2014-04-05 Thread Anthony Smith
Hi I have a small project and I have been unable to get the following statement to work. Any help would great.User inputs can either self_sale_head which is a $ value,if a $ value is not add a self.estimated_weight_hd is used to get the total weight, the code below should return a estimated

Saving forms with ManyToMany relationships

2014-04-05 Thread Jason S
Hi, I've seen quite a few examples showing various ways to create a form using manytomany relationships and save the data, but i'm still missing a key piece of the puzzle. I've created a form and it "works", meaning the form creates a new Item object and associates the user. However i'm not sure

Django admin.stackedinline

2014-04-05 Thread Anderson
Hi there Does anyone know how I show the data in admin.Stackedinline but the user can add but not change. I am trying has_change_permission as false but it's not showing the old data it just allow me to add a new data. I would like to see the list of data but not edit. There is in admin.ModelAd

Re: New to Django - How to add inline object to the parent object via shell command or scripts

2014-04-05 Thread Daniel Roseman
On Saturday, 5 April 2014 09:21:38 UTC+1, H. Pham wrote: > > I am trying to learn how to use Django. > Then you should read the tutorial. > I created 2 very simple models: > > models.py > > class Course(models.Model): > name = models.CharField(max_length=100) > instructor = models.Cha

Add poll to the django tutorial polls

2014-04-05 Thread Christo bale
I would like to make it possible to add a poll on the index.html, so one don't need the admin. I added a forms.py. Right now when I click enter after typing the new poll, the sites goes blank and I need to refresh it. And no polls have been added. I am pretty new to django, so I hope that you c

New to Django - How to add inline object to the parent object via shell command or scripts

2014-04-05 Thread phamqh
I am trying to learn how to use Django. I created 2 very simple models: models.py class Course(models.Model): name = models.CharField(max_length=100) instructor = models.CharField(max_length=100) student = models.ForeignKey('Student', null=True, blank=True) def __str__(self):

How to add inline object to parent object using django shell command or scripts

2014-04-05 Thread H. Pham
I am very new to Django. I have followed the tutorial and instruction in document and create a couple models: Student and Course. Student has Course as "RelatedObjectsDescriptor" Course has Student as ForeignKey *Course is *TabularInline object of Student. I was able to create Student object a