question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Ignore import_id_fields in class Meta

See original GitHub issue

Errors Line number: 1 - "Column ‘id’ not found in dataset. Available columns are: [‘name’, ‘model’,‘content’]

class PageResource(resources.ModelResource):
    class Meta:
        model = Page
        import_id_fields = ('name',)

system: python 3.4.3, django 1.9

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:2
  • Comments:6

github_iconTop GitHub Comments

7reactions
jwzh222commented, Feb 8, 2017

hi @gbozee @haidaraM ,thanks to comments but it doesn’t solve the problem. it seems like the meta class option import_id_fields doesn’t work when you give it a new value. it still using the default one ‘id’.

3reactions
franz-seecommented, Feb 25, 2019

import_id_fields does NOT work for me either

And adding exclude = ('id',) did NOT work either.

Python Python 2.7.10 Django 1.11.20 django-import-export 1.2.0

Read more comments on GitHub >

github_iconTop Results From Across the Web

what does exclude in the meta class of django mean?
The exclude attribute tells Django what fields from the model not to include in the form. Quoting the Selecting fields to use section...
Read more >
ModelForm.Meta.exclude only excludes model fields, not form ...
If I have a ModelForm that inherits from another form, and I define exclude and/or fields, these only affect fields on the model....
Read more >
Getting started — django-import-export 3.0.1 documentation
A manager class with the get_by_natural_key function is required for importing foreign key relationships by the field model's natural key, and the model...
Read more >
Django ModelForm - Create form from Models - GeeksforGeeks
class PartialAuthorForm(ModelForm): class Meta: model = Author exclude = ['title']. Finally, to complete our MVT structure, create a view ...
Read more >
Problems with "Class Meta" and " __str__" - Google Groups
Hello, I do these models but the Django admin page doesn't read the "class Meta" and " __str__". This is the models.py document....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found