At the add stage, my num_in_admin =12 ( from Photo class) show up in
admin, but when I " save and continue editing" I am left with only one
blank inline photo object. Can't see what the problem is. Here is the
code. Any help and I would be grateful.
from django.core import meta
#done
status_choices = (
('Active','Active'),
('Retired','Retired' ),
)
#done
offer_choices = (
('Sale','For Sale'),
('Rental','For Rent' ),
)
#done
property_type_choices = (
('House','House'),
('Land','Land' ),
('Land/Building','Land/Building' ),
('Apartment','Apartment' ),
('Office','Office' ),
('Retail Outlet','Retail Outlet' ),
('Other','Other' ),
)
#done
feature_this_choices = (
('feature','Featured'),
('normal','Not Featured' ),
)
#done
setting_choices = (
('All','All'),
('Waterfront','Waterfront' ),
)
#done
zoning_choices = (
('Residential/Commercial','Residential/Commercial'),
('Residential','Residential'),
('Commercial','Commercial'),
)
class Propertie(meta.Model):
name = meta.CharField(maxlength=200,unique=True)
description = meta.TextField()
#added late
url = meta.CharField(maxlength=200,blank=True)
offer = meta.CharField(maxlength=6,choices=offer_choices)
property_type =
meta.CharField(maxlength=13,choices=property_type_choices)
feature_this =
meta.CharField(maxlength=7,choices=feature_this_choices)
setting = meta.CharField(maxlength=10,choices=setting_choices)
cost = meta.CharField(maxlength=200)
keywords = meta.TextField()
photo_main= meta.ImageField(upload_to ="properties_photos")
photo_feat= meta.ImageField(upload_to ="properties_photos")
status = meta.CharField(maxlength=7,choices=status_choices)
address = meta.CharField(maxlength=500)
city = meta.CharField(maxlength=200,blank=True)
parish = meta.CharField(maxlength=200)
land_area = meta.CharField(maxlength=200)
building_floor_area = meta.CharField(maxlength=200)
zoning = meta.CharField(maxlength=22,choices=zoning_choices)
bedrooms = meta.CharField(maxlength=200)
bathrooms = meta.CharField(maxlength=200)
building_design = meta.CharField(maxlength=200)
# five story
building_type = meta.CharField(maxlength=200)
# Apartment
roofing_material = meta.CharField(maxlength=200)
furnishings = meta.CharField(maxlength=500)
misc = meta.CharField(maxlength=500,blank=True)
date_added = meta.DateField()
def __repr__(self):
return self.name
def _post_save(self):
from django.core.db import db
prop_id = self.id
prop_url = "www.alphareal.com/properties/properties/"
cursor = db.cursor()
cursor.execute('update properties_properties set url= %s where
id=%s',(prop_url,prop_id))
class META:
admin = meta.Admin(
fields = (
(None, {'fields':
('name','description','url','keywords','property_type','offer','feature_this','setting','status','cost','date_added',)}),
('Main Photos', {'fields': ('photo_main','photo_feat',)}),
('Details', {'fields':
('address','city','parish','land_area','building_floor_area','zoning','bedrooms','bathrooms','building_design','building_type','roofing_material','furnishings','misc',)}),
),
)
class Photo(meta.Model):
photo= meta.ImageField(upload_to ="properties_photos",core=True)
photo_thumb = meta.ImageField(upload_to
="properties_photos",core=True)
propertie =
meta.ForeignKey(Propertie,edit_inline=meta.TABULAR,num_in_admin=12,max_num_in_admin=12)
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/django-users
-~----------~----~----~----~------~----~------~--~---