mirror of
https://github.com/zulip/zulip.git
synced 2025-10-28 18:43:52 +00:00
models: Extract zerver.models.realms.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
committed by
Tim Abbott
parent
7001a0dfc0
commit
cd96193768
@@ -35,7 +35,7 @@ organization in Zulip). The following files are involved in the process:
|
||||
|
||||
**Backend**
|
||||
|
||||
- `zerver/models/__init__.py`: Defines the database model.
|
||||
- `zerver/models/realms.py`: Defines the database model.
|
||||
- `zerver/views/realm.py`: The view function that implements the API endpoint
|
||||
for editing realm objects.
|
||||
- `zerver/actions/realm_settings.py`: Contains code for updating and interacting with the database.
|
||||
@@ -73,7 +73,7 @@ organization in Zulip). The following files are involved in the process:
|
||||
### Adding a field to the database
|
||||
|
||||
**Update the model:** The server accesses the underlying database in
|
||||
`zerver/models/__init__.py`. Add a new field in the appropriate class.
|
||||
`zerver/models/realms.py`. Add a new field in the appropriate class.
|
||||
|
||||
**Create and run the migration:** To create and apply a migration, run the
|
||||
following commands:
|
||||
@@ -185,10 +185,10 @@ task of requiring messages to have a topic, you can [view this commit](https://g
|
||||
|
||||
First, update the database and model to store the new setting. Add a new
|
||||
boolean field, `mandatory_topics`, to the Realm model in
|
||||
`zerver/models/__init__.py`.
|
||||
`zerver/models/realms.py`.
|
||||
|
||||
```diff
|
||||
# zerver/models/__init__.py
|
||||
# zerver/models/realms.py
|
||||
|
||||
class Realm(models.Model):
|
||||
# ...
|
||||
@@ -205,7 +205,7 @@ is the field's type. Add the new field to the `property_types`
|
||||
dictionary.
|
||||
|
||||
```diff
|
||||
# zerver/models/__init__.py
|
||||
# zerver/models/realms.py
|
||||
|
||||
class Realm(models.Model)
|
||||
# ...
|
||||
|
||||
Reference in New Issue
Block a user