-
-
Notifications
You must be signed in to change notification settings - Fork 485
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
ValidationError exception on UUID #299
Comments
actually, after changing str to return name, in simple history admin page, under object column, I get "None" not the value of name |
after adding print(self.pk) and print(self.id) inside str function, I get the content value of the field description printed for self.pk and self.id |
I did not mention that I have modified_on and modified_by fields for simplicity, and I added those fields to excluded_fields however, once I removed the excluded_fields from HistoricalRecords I got it to work fine with no problems. |
I'm not sure I can speak directly to the issues you're seeing, but I would suggest you limit your string representations to fields on the model itself, to avoid extra DB queries. Since String representations should be limited to fields on the table associated with the model that we can expect will be already present in memory at the time So two comments here I guess, but they're really not related to simple_history, as the way you're customizing If the requirement is that the admin display information about both the model with My second comment is on whether you actually want |
Marco, thanks for raising valid points. a user may create a case called "Documents about John Smith" however, since the user already entered in the case, about a person "John Smith" the case name has redundancy. it would be better to name the case "Documents" and then the display name of case is "Documents about John Smith" for the second part, I tried to make it as much flexible as possible, however, there are rare cases where we need M2M in about fields, and most importantly, it would be hard to switch from M2M to FK (for performance reasons) if users already used multiple entries in the m2m field. we can always switch from FK to M2M in future if we need it. for using multiple DB queries in |
@bedros did you ever find a fix for this? |
ManyToManyField is not supported; there are numerous issues about it here, like #399. |
Assuming that the issue is resolved now that support for M2M fields has been added. Please reopen if it's still not resolved. |
my model is as follows
id = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False)
name = models.CharField(max_length=255)
description = models.CharField(max_length=2047, blank=True, null=True)
case_number = models.CharField(max_length=255, blank=True, null=True)
about_person = models.ManyToManyField('Person', blank=True, related_name="about_person_case")
history = HistoricalRecords()
when I click on history in admin I get error page with following
["Content of description field' is not a valid UUID."]
why it takes content of description as the UUID?
my str is not simple,
def __str__(self): return str(self.name + " about " + self.about_person)
if I change str to
def __str__(self): return str(self.name)
problem goes away, but I need str to return name and about person
The text was updated successfully, but these errors were encountered: