Skip to content

Commit

Permalink
added model link documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
Afonso Caldas committed Jan 18, 2016
1 parent a59290d commit 05330b9
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,18 @@ def generate_key(self):
self.save()
```

To make a class operation instead of one applicable to a specific instance then add the ``@classmethod`` decorator to the function.
To make a class operation instead of one applicable only to a specific instance then add the ``@classmethod`` decorator to the function.

## Model Links

A link can be added to a model to provide a direct access from the admin interface to a location of interest related to the model. It is defined by decorating a function that returns an URL with the ``@appier.link`` decorator. This decorator accepts a name describing the link and a tuple of parameters like in the ``@appier.operation`` decorator. By adding the ``@classmethod`` decorator the link will be related to the model class:

```python
@classmethod
@appier.operation(name = "Export CSV")
def export_csv_url(cls):
return appier.get_app().url_for("list.csv")
```



0 comments on commit 05330b9

Please sign in to comment.