An easy and professional way to publish real estate objects on your Plone website
Real estate broker
The real estate broker product turns plone into a real estate broker website. Show your commercial and residential real estate with the two real estate content types. Allow visitors to search the database with the provided forms. Email updates for registered visitors. Google map support. Easy mass-addition of images. PDF export.
Documentation should be correct and up to date. To assure that, the documentation is used to test the software. So both the software and the documentation are assured to be correct. That is why you will see code examples throughout this document.
First a small bit of setup: adding an admin user and a registered visitor.
>>> self.loginAsPortalOwner() >>> self.portal.portal_membership.addMember('admin', 'secret', ... ['Manager'], ) >>> self.portal.portal_membership.addMember('visitor', 'secret', ... ['Reader'], )
Installing real estate broker
Add collective.realestatebroker to the eggs and zcml of your buildout. If you want a development buildout, use the buildout.cfg in https://github.com/collective/collective.realestatebroker
If you have old 1.0 content you can migrate that by uncommenting two lines in the buildout, as indicated there with a comment.
Inside plone, log in with an administrator account and install real estate broker through the quickinstaller (in the plone control panel: “add/remove products”).
>>> self.login('admin') >>> qi = self.portal.portal_quickinstaller >>> qi.installProduct('collective.realestatebroker')
RealEstateBroker makes use of the Maps product to integrate Google Maps. Check that this product is also available in the site after RealEstateBroker has been installed.
>>> self.portal.portal_quickinstaller.isProductInstalled('Maps') True
PloneFlashUpload is used for easy mass-uploading of images.
>>> self.portal.portal_quickinstaller.isProductInstalled('PloneFlashUpload') True
Behind the scenes, the reportlab library is used to export PDF.
Commercial and residential real estate content types
There are two content types, residential and commercial. They differ in a few fields.
>>> self.portal.invokeFactory('Residential', id='home1') 'home1' >>> self.portal.invokeFactory('Commercial', id='office1') 'office1'
Migration support for the old 1.0 version to 2.0
If you installed using the migration buildout, a reinstall of realestatebroker will perform a migration. The migration does the following:
- Replace old REHome/REBusiness objects with Residential/Commercial objects.
- REHome/REBusiness have CMFPhotoAlbums with CMFPhotos in them, these photos are moved directly into the (folderish) Residential/Commercial object as regular Images.
- Migrate old workflow states OR old status field to new workflow states.
- Copy over all the fields if still present in the new content types.
It is probably best to create a new site in 3.0 and to selectively move things over. You cannot do a direct 2.0 to 3.0 plone migration anyway. It works to make a .zexp export of the old houses and offices and to import them in a 3.0 site, assuming you have the migration buildout installed: that buildout includes hacked-up versions of the old RealEstateBroker product, CMFPhoto and CMFPhotoAlbum that lets you load the old objects.
Almost surely, realestatebroker will need to be adapted to local circumstances. In the Netherlands, an airco is not common, but in the south of the USA it might be something you want to keep track of.
archetypes.schemaextender is a great tool for cleanly adapting the schema. See realestatebroker’s documentation section on plone.org for a how-to.
Also, the PDF export will need work like adding a header/footer. And choosing a different font. Here also: see the plone.org documentation.
Real Estate Workflow
Real Estate Broker comes with a special workflow named ‘realestate_workflow’ which is mapped to both the Residential and Commmercial content type.
>>> home1 = self.portal.home1 >>> wftool = self.portal.portal_workflow >>> self.failUnless('realestate_workflow' in wftool.objectIds()) >>> wftool.getChainForPortalType('Commercial') ('realestate_workflow',) >>> wftool.getChainForPortalType('Residential') ('realestate_workflow',)
The initial state of real estate content should be offline, which means anonymous can’t view it and only owner, editor and manager can edit it. From this state we can publish the content, which will bring it to the ‘new’ state.
>>> wftool.getInfoFor(home1, 'review_state') 'offline' >>> wftool.doActionFor(home1, 'publish', wf_id='realestate_workflow') >>> wftool.getInfoFor(home1, 'review_state') 'new'
After two weeks, new items will become regular items so that new items can be displayed more prominently in the listing. Similarly, sold items will remain visible for two weeks (which is important for getting the “this realestate broker really sells quite some houses” impression).
RealEstateBroker installs under portal_properties a property sheet with default attributes.
>>> pptool = self.portal.portal_properties >>> self.failUnless('realestatebroker_properties' in pptool.objectIds())
Don’t show Resdiential or Commecial objects in the navigation tree.
>>> navtree_props = pptool.navtree_properties >>> types_not_to_list = navtree_props.getProperty('metaTypesNotToList') >>> self.failUnless('Residential' in types_not_to_list) >>> self.failUnless('Commercial' in types_not_to_list)
For the city field we make use of a vocabulary that reads it’s values from a propertysheet.
>>> from collective.realestatebroker.content.vocabularies import CityVocabularyFactory >>> vocab = CityVocabularyFactory(self.portal) >>> [item.value for item in vocab] [u'New York', u'London', u'Amsterdam', u'Paris', u'Tokyo', u'Alberschwende']
For the house type field we make use of a vocabulary that reads it’s values from a propertysheet.
>>> from collective.realestatebroker.content.vocabularies import HouseTypeVocabularyFactory >>> vocab = HouseTypeVocabularyFactory(self.portal) >>> [item.value for item in vocab] [u'Apartment', u'Villa', u'Mansion']
For the rooms field we make use of a vocabulary that reads it’s values from a propertysheet.
>>> from collective.realestatebroker.content.vocabularies import RoomsVocabularyFactory >>> vocab = RoomsVocabularyFactory(self.portal) >>> [item.value for item in vocab] [u'1', u'2', u'3', u'4', u'5', u'6', u'7', u'8']
Test if the index have been created in the portal_catalog tool.
>>> indexes = self.portal.portal_catalog.indexes() >>> for idx in ('getPrice', 'getCity', 'is_floorplan'): ... self.failUnless(idx in indexes)
Google maps support
Realestatebroker uses the ‘Maps’ product for google map support. Our contenttypes can be used by Maps:
>>> from collective.realestatebroker.interfaces import IRealEstateContent >>> from collective.realestatebroker.interfaces import IResidential >>> IRealEstateContent.providedBy(home1) True >>> IResidential.providedBy(home1) True >>> from Products.Maps.interfaces import IMapView
>>> view = home1.restrictedTraverse('@@maps_googlemaps_enabled_view') >>> view.enabled False
We’re showing it on the “edit” form and the “map” tab:
>>> class Dummy: ... url = 'dummy' ... def getURL(self): ... return self.url >>> view.request = Dummy() >>> view.enabled # still no. False >>> view.request.url = 'something/edit' >>> view.enabled True >>> view.request.url = 'something/map' >>> view.enabled True
To install collective.realestatebroker into the global Python environment (or a workingenv), using a traditional Zope 2 instance, you can do this:
Install the dependency ReportLab, e.g.: bin/easy_install --find-links=http://ftp.schooltool.org/schooltool/eggs Reportlab Find out how to install setuptools (and EasyInstall) here: http://peak.telecommunity.com/DevCenter/EasyInstall
When you’re reading this you have probably already run easy_install collective.realestatebroker. If that failed earlier because of a missing ReportLab dependency, try it again now.
Create a file called collective.realestatebroker-configure.zcml in the /path/to/instance/etc/package-includes directory. The file should only contain this:<include package="collective.realestatebroker" />
Alternatively, if you are using zc.buildout and the plone.recipe.zope2instance recipe to manage your project, you can do this:
Tell buildout that it can find the ReportLab dependency on ftp.schooltool.org, e.g.:[buildout] ... find-links = http://dist.plone.org http://download.zope.org/ppix/ http://download.zope.org/distribution/ http://effbot.org/downloads http://ftp.schooltool.org/schooltool/eggs/
Add collective.realestatebroker to the list of eggs to install, e.g.:[buildout] ... eggs = ... collective.realestatebroker
Tell the plone.recipe.zope2instance recipe to install a ZCML slug:[instance] recipe = plone.recipe.zope2instance ... zcml = collective.realestatebroker
Re-run buildout, e.g. with:$ ./bin/buildout
You can skip the ZCML slug if you are going to explicitly include the package from another package’s configure.zcml file.
History of collective.realestatebroker
- Moved to https://github.com/collective/collective.realestatebroker
- Reintroduce version specific pin of Products.contentmigration==1.0b4 because with other versions there are test failures. [maurits]
- No longer require specific versions of archetypes.schemaextender (1.0b1) and Products.contentmigration (1.0b4), but let those be minimum versions. [maurits]
- Use unicode_vocabulary instead of SimpleVocabulary in all vocabularies to catch UnicodeEncodeErrors like in http://plone.org/products/realestatebroker/issues/6 [maurits]
- Copied code from Products.PloneFlashUpload 1.2rc so the upload on the album management works again. (At least with Flash 10 on Linux). [maurits]
- Added French translations thanks to Benjamin Klups. [jladage]
- Allow access to the AlbumView.first_image; an Unauthorized error is triggered when using this in for example a collection portlet. [maurits]
- Fixed bug in floorplan filter: the photo management page also filtered them, making them impossible to edit. [reinout]
- Filtering out floorplans from all the photo lists. [reinout]
- Some html fixes by jladage?
- Fixed keyerror when floorplans aren’t attached to floors. The keyerror itself is caught now and the cause has also been removed. [reinout]
- Added ReportLab and Products.Maps as dependencies in setup.py. [maurits]
- Unchanged from rc4.
2.0.3 rc4 (2008-07-02)
- Creating our own img tags from catalog brains instead of doing a .getObject() to use archetypes tag() method which wakes up the object. [reinout]
2.0.3 rc3 (2008-06-25)
- Fixed strange attributeerror on plone 3.1.2. Moving to that plone version fixes a kss bug in the album view. [reinout]
2.0.3 rc2 (2008-06-25)
- Added optional max_height attribute to insert_image() to allow protection for overly large portrait image on the pdf’s homepage. [reinout]
- Added css class to table cells that contain an image in the res/comm listings so that the image can be aligned vertically if desired. [reinout]
- Added caching of rendered pdf in an annotation. Saves a lot of cpu time. [reinout]
2.0.3 rc1 (released)
- Moved rent_buy to the financial schemata for the edit view so that all financial fields are on the same screen. [fredvd]
- Added a field for indicating if the price is a fixed price or is still negotiable. Not used (yet) in the collective.realestatebroker package view templates, but can be exposed in your own template overrides [fredvd]
2.0.2 (released 2008-04-21)
- no changes, make a final release for references [fredvd]
2.0.1 rc4 (released 2008-03-06)
- Add new rented state and accompanying transition so that rented houses have a proper listing [fred]
2.0.1 rc3 (released 2008-02-29)
- View order fixed (state first, creation date second). [joris]
- Fixed test to reflect change done in rc2. [reinout]
- add house_type to the portal_catalog index (getHouse_type) [fred]
- added discreet color on formHelp [mirella]
2.0.1 rc2 (released 2008-02-04)
2.0.1 rc (released 2008-02-04)
- Fixed bug in display of houses/offices: the main thumbnail picture now points at /album instead of /photo. /photo could result in an orgy of redirects. [reinout]
2.0.1 beta3 (released 2008-01-25)
- Google maps’ js is only enabled if the url ends on ‘/map’ now, so the other tabs don’t have to load it. [reinout]
- Changed sort_order in the realestate view, so that ‘new’ real estate objects are always on top of the list. These are the most interesting for visitors checking your real_estate. [fred]
- Removed size limit on the construction year field. This allows you to add ‘2007-2008’ as a construction year, for instance. [reinout]
2.0.1 beta2 (released 2008-01-17)
- Added manager-only textual search form to the listing templates. [reinout]
2.0.1 beta (released 2008-01-15)
- Capitalized the ‘view’ action so that the translation is picked up. [reinout]
- Dutch translation fix (“opslag”). [reinout]
- Removed an unused viewletmanager configuration and enabled the titlemanager for every skin.
- Added two extra safe_unicode() calls to the pdf generator to prevent decode errors.
- Released on 2008-01-11, no changes from the rc6.
- README updated. [reinout]
- Old temporary image size name renamed to something more appropriate. [fredvd]
- Disabling special kk_von handling as the values of the field are the same again as in the old database. Sorry for the noise. [reinout]
- Fix for faulty images (width==0, so you get a division by zero error) [reinout]
- rent_buy vocabulary is handled by the propertysheet again.
- Optionally disabled filtering of empty fields. [reinout]
- Translation improvement for boolean fields. [reinout]
- Small pdf page margin changes. [reinout]
- Rent/buy is now a fixed vocabulary (needed for a userfriendly default value). [reinout]
- Added try/except for corrupt images (read: unaccessible images that redirect to a login page). [Reinout]
- Translated the schemata names and the workflow names (in a separate old-style Product: reb_i18n) [Reinout van Rees]
- Added rent/buy field to Residential, too.