Upating docs
This commit is contained in:
@@ -13,10 +13,8 @@ INSTALLED_APPS = (
|
||||
...
|
||||
'dbview',
|
||||
)
|
||||
|
||||
```
|
||||
|
||||
|
||||
2. In your models.py create classes which extend dbview.models.DbView
|
||||
like this:
|
||||
|
||||
@@ -30,7 +28,6 @@ class ModelA(models.Model):
|
||||
fielda = models.CharField()
|
||||
fieldc = models.IntegerField()
|
||||
|
||||
|
||||
class MyView(DbView):
|
||||
fieldA = models.OneToOneField(ModelA, primary_key=True,
|
||||
db_column='fielda__id')
|
||||
@@ -48,10 +45,12 @@ class MyView(DbView):
|
||||
order_by('fielda__id') .\
|
||||
values('fielda__id', 'fieldb')
|
||||
return str(qs.query)
|
||||
|
||||
```
|
||||
|
||||
|
||||
3. Then create a migration point for your view generation, edit that migration
|
||||
and modify it, add: `from dbview.helpers import CreateView` and replace the line
|
||||
the call to `migrations.CreateModel` with `CreateView`.
|
||||
|
||||
|
||||
4. Migrate your database and start using your database views.
|
||||
|
||||
Reference in New Issue
Block a user