mirror of
https://github.com/quantum5/peeringdb-mirror.git
synced 2025-04-25 02:31:57 -04:00
Fix null handling
This commit is contained in:
parent
c5f413b109
commit
8cd146f3c7
20
README.md
Normal file
20
README.md
Normal file
|
@ -0,0 +1,20 @@
|
|||
# PeeringDB Mirror
|
||||
|
||||
This repository implements a simple, Django-based PeeringDB mirroring service
|
||||
based on `django-peeringdb` and `peeringdb-py`.
|
||||
|
||||
Currently, this doesn't have full PeeringDB API compatibility, but there is a
|
||||
sufficiently strong foundation to make that dream easily achievable through a
|
||||
bit of Django metaprogramming. PRs welcome!
|
||||
|
||||
## Installation
|
||||
|
||||
1. Clone this repository: `git clone https://github.com/quantum5/peeringdb-mirror.git`;
|
||||
2. Create a virtualenv: `python3 -m venv venv`;
|
||||
3. Install dependencies: `pip install -r requirements.txt`;
|
||||
4. Configure Django: `cp peeringdb_mirror/settings/{template,local}.py` and edit
|
||||
`peeringdb_mirror/settings/local.py`. You should change `SECRET_KEY` and
|
||||
update `DATABASES`. See the linked Django documentation for details;
|
||||
5. Migrate database: `python manage.py migrate`;
|
||||
6. Run the WSGI app `peeringdb_mirror.wsgi:application` with your favourite
|
||||
WSGI-capable application server.
|
|
@ -13,7 +13,7 @@ class Backend(OldBackend):
|
|||
for field in obj._meta.get_fields():
|
||||
if isinstance(field, DateTimeField):
|
||||
value = getattr(obj, field.name)
|
||||
if timezone.is_naive(value):
|
||||
if value and timezone.is_naive(value):
|
||||
setattr(obj, field.name, timezone.make_aware(value, utc))
|
||||
|
||||
super().clean(obj)
|
||||
|
|
Loading…
Reference in a new issue