Skip to content

Django features or non-features that might affect refactoring #3

@bhaugen

Description

@bhaugen

Can Abstract Base Classes include Foreign Keys?

@escanda writes:

The issue I think with ABC classes is you can't use them in relationships if I am not mistaken. Thus you can't create a base schema to extend, we'd need to push up the foreign keys to all forks.

That would be a problem. But it looks like, starting with version 1.9, we can do it:
https://docs.djangoproject.com/en/1.9/ref/models/fields/#foreignkey

I haven't tried this, so can't swear it will work, or that it will not have unexpected side effects (that is, bugs).

__init__.py

This tells you how much I know about Python and Django (although this is a python feature): I was not aware that adding a bunch of import statements to __init__.py would make the contents of a bunch of models.py files importable without needing to call out each of the models files in tests and (I assume) views. (That's a nice feature.)

Can we override particular files without forking a whole repo?

For example, if we wanted to substitute our EconomicResourceType, could we substitute just our types.py file, instead of forking the whole https://github.com/django-rea/nrp repo?

I don't know the answer, but doubt it. Which means that separating e.g. models.py into smaller files might not help with the issues of a common core that everybody can use vs each group's special features.

Any other Django or Python features or non-features that would help us or get in our way?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions