Skip to content

add m2m fields to proccess #22

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions scrapy_djangoitem/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,18 @@ def __new__(mcs, class_name, bases, attrs):

if cls.django_model:
cls._model_fields = []
cls._model_fields_m2m = []
cls._model_meta = cls.django_model._meta
for model_field in cls._model_meta.fields:
if not model_field.auto_created:
if model_field.name not in cls.fields:
cls.fields[model_field.name] = Field()
cls._model_fields.append(model_field.name)

for model_field_m2m in cls._model_meta.many_to_many:
if model_field_m2m.name not in cls.fields:
cls.fields[model_field_m2m.name] = Field()
cls._model_fields_m2m.append(model_field_m2m.name)
return cls


Expand Down