pombreda / djapian

Automatically exported from code.google.com/p/djapian
Other
0 stars 0 forks source link

Djapian Assumes object ID will always be an integer #58

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1.  Create a model to be indexed that has a non-integer primary key.  Such as:

import uuid

class Business(models.Model):
    uid = models.CharField(max_length=36, primary_key=True)
    name = models.CharField(max_length=50)

business = Business(uid=str(uuid.uuid4())
business.save()

Assuming I have set up an indexer like this:

class BusinessIndex(djapian.Indexer):
    fields = [('name')]

djapian.add_index(Business, BusinessIndeser, attach_as="indexer")

When I do the business.save() I get an error stating "invalid literal for int() 
with base 10"

What is the expected output? What do you see instead?
No error! Any type of index should be allowed

What version of the product are you using? On what operating system?
2.2.1

Please provide any additional information below.
For my purposes, I was able to edit around like 43 of models.py (in the Change 
model)

#    object_id = models.PositiveIntegerField()
    object_id = models.CharField(max_length=36)

I realize this is probably not ideal either.

Original issue reported on code.google.com by Joe.Kue...@gmail.com on 14 May 2009 at 6:22

GoogleCodeExporter commented 9 years ago
Yes, I think the solution is to use CharField to store objects pks but may be 
this
greater character limit.

Original comment by daevaorn on 14 May 2009 at 7:41

GoogleCodeExporter commented 9 years ago
Fixed in rev 231

Original comment by daevaorn on 22 May 2009 at 8:03