-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
add latest berries and alter schema to allow empty properties from th… #1572
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
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1002,16 +1002,16 @@ def csv_record_to_objects(info): | |
| item = Item.objects.get(pk=int(info[1])) | ||
| yield Berry( | ||
| id=int(info[0]), | ||
| item_id=int(info[1]), | ||
| name=item.name[: item.name.index("-")], | ||
| berry_firmness_id=int(info[2]), | ||
| natural_gift_power=int(info[3]), | ||
| natural_gift_type_id=int(info[4]), | ||
| size=int(info[5]), | ||
| max_harvest=int(info[6]), | ||
| growth_time=int(info[7]), | ||
| soil_dryness=int(info[8]), | ||
| smoothness=int(info[9]), | ||
| item_id=int(info[1]) if info[1] and info[1].strip() else None, | ||
| name=item.name[: item.name.index("-")] if "-" in item.name else item.name, | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If possible I'd also strenghten the logic here, splitting on |
||
| berry_firmness_id=int(info[2]) if info[2] and info[2].strip() else None, | ||
| natural_gift_power=int(info[3]) if info[3] and info[3].strip() else None, | ||
| natural_gift_type_id=int(info[4]) if info[4] and info[4].strip() else None, | ||
| size=int(info[5]) if info[5] and info[5].strip() else None, | ||
| max_harvest=int(info[6]) if info[6] and info[6].strip() else None, | ||
| growth_time=int(info[7]) if info[7] and info[7].strip() else None, | ||
| soil_dryness=int(info[8]) if info[8] and info[8].strip() else None, | ||
| smoothness=int(info[9]) if info[9] and info[9].strip() else None, | ||
| ) | ||
|
|
||
| build_generic((Berry,), "berries.csv", csv_record_to_objects) | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,43 @@ | ||
| # Generated by Django 5.2.10 on 2026-06-25 15:20 | ||
|
|
||
| from django.db import migrations, models | ||
|
|
||
|
|
||
| class Migration(migrations.Migration): | ||
|
|
||
| dependencies = [ | ||
| ("pokemon_v2", "0028_pokemonevolution_evolved_form_and_more"), | ||
| ] | ||
|
|
||
| operations = [ | ||
| migrations.AlterField( | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do we really need these? Can they not just be values like
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Since Sword and Shield, the concept of crop cultivation has been removed, null values from my point of view seems more appropriate because if we use 0 it would say 'this berry has a natural gift of 0' for example. But this concept doesn't exist in SW, SV and after.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah, better to allow |
||
| model_name="berry", | ||
| name="growth_time", | ||
| field=models.IntegerField(blank=True, null=True), | ||
| ), | ||
| migrations.AlterField( | ||
| model_name="berry", | ||
| name="max_harvest", | ||
| field=models.IntegerField(blank=True, null=True), | ||
| ), | ||
| migrations.AlterField( | ||
| model_name="berry", | ||
| name="natural_gift_power", | ||
| field=models.IntegerField(blank=True, null=True), | ||
| ), | ||
| migrations.AlterField( | ||
| model_name="berry", | ||
| name="size", | ||
| field=models.IntegerField(blank=True, null=True), | ||
| ), | ||
| migrations.AlterField( | ||
| model_name="berry", | ||
| name="smoothness", | ||
| field=models.IntegerField(blank=True, null=True), | ||
| ), | ||
| migrations.AlterField( | ||
| model_name="berry", | ||
| name="soil_dryness", | ||
| field=models.IntegerField(blank=True, null=True), | ||
| ), | ||
| ] | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd also here not allow
nullvalues. A berry should alwasy be linked with an item.I don't want line such as
to be possible to appear.