Skip to content

Commit

Permalink
no readonly fields
Browse files Browse the repository at this point in the history
  • Loading branch information
ramibch committed Jan 4, 2024
1 parent 4141aab commit 8df11fa
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
1 change: 0 additions & 1 deletion core/admin/countries.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,3 @@
class CountryAdmin(admin.ModelAdmin):
list_display = ("name", "code", "gdp", "currency", "wikipedia_url")
list_filter = ("currency",)
readonly_fields = list_display
6 changes: 3 additions & 3 deletions core/models/countries.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@ def __str__(self):
return self.code + " " + self.name

@classmethod
def scrap_from_wikipedia(cls, delete_objs=False):
if delete_objs:
cls.objects.all().delete()
def scrap_from_wikipedia(cls):
if cls.objects.count() > 0:
print("## Info: Not possible to scrap, since there the objects in the db")
return

host = "https://en.wikipedia.org"
url = host + "/wiki/List_of_countries_by_GDP_(nominal)_per_capita"
r = requests.get(url)
Expand Down

0 comments on commit 8df11fa

Please sign in to comment.