Skip to main content
simplereferencefield is an Archeteyps reference field implementation
that stores the references directly on the object without indexing it in
the reference_catalog.

Create a document that references news.

>>> self.loginAsPortalOwner()
>>> self.portal.invokeFactory('Document', 'doc1')
'doc1'
>>> doc = self.portal['doc1']
>>> doc.setRelatedItems(self.portal.news)
>>> doc.reindexObject()
>>> doc.getRelatedItems()
[<ATFolder at /plone/news>]

The document has a relationship.
>>> doc.getRelationships()
['relatesTo']

Change relatedItems in the document's schema to be a
SimpleReferenceField.

>>> from Products.ATContentTypes.content.document import ATDocument
>>> from upfront.simplereferencefield import SimpleReferenceField
>>> ATDocument.schema['relatedItems'] = SimpleReferenceField(
... 'relatedItems', relationship='relatesTo', multiValued=1)
>>> ATDocument.schema['relatedItems'].type
'simplereference'

Create a document that references news.

>>> self.portal.invokeFactory('Document', 'doc2')
'doc2'
>>> doc = self.portal['doc2']
>>> doc.setRelatedItems(self.portal.news)
>>> doc.reindexObject()
>>> doc.getRelatedItems()
[<ATFolder at /plone/news>]

The document has no relationships.

>>> doc.getRelationships()
[]

If we reference doc1 from doc2, doc1 will have doc2 set as back
reference.

>>> self.portal.doc2.setRelatedItems(self.portal.doc1)
>>> self.portal.doc2.getRelatedItems()
[<ATDocument at /plone/doc1>]
>>> self.portal.doc1.getRelatedItems()
[<ATDocument at /plone/doc2>]

Back references are set by default but can be disabled.

>>> ATDocument.schema['relatedItems'] = SimpleReferenceField(
... 'relatedItems', relationship='relatesTo', multiValued=1,
... set_backreference=False)
>>> self.portal.invokeFactory('Document', 'doc3')
'doc3'
>>> self.portal.doc3.setRelatedItems(self.portal.doc1)
>>> self.portal.doc3.getRelatedItems()
[<ATDocument at /plone/doc1>]
>>> self.portal.doc1.getRelatedItems()
[<ATDocument at /plone/doc2>]

Changelog
=========

0.5.1
-----

* Make a new release with only a source distribution. Egg distribution
does not install properly with buildout.

0.5
---

* Initial release

Metadata

Release files for upfront.simplereferencefield 0.5.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for upfront.simplereferencefield 0.5.1
File Size Uploaded Provenance
upfront.simplereferencefield-0.5.1.tar.gz 4.4 kB Without provenance Details

Release files / upfront.simplereferencefield-0.5.1.tar.gz

Download URL upfront.simplereferencefield-0.5.1.tar.gz
Size 4.4 kB
Tags Source
SHA-256 checksum
How to use checksums
139b7518355553a32a706c9699eb79a722d7d3ca096f5947559bb93b3bae3b60
BLAKE2b-256 checksum
How to use checksums
3738bd80b99c40acedc26a5fe786f0badd96195bf491d157eb25ce34cb663d1b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Security for upfront.simplereferencefield 0.5.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.5.1 This release

1 release file No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page