دنبال کننده ها

۱۳۹۶ مرداد ۱۱, چهارشنبه

python - Django: couple of objects with unique methods, accessable by ForeignKey

[ad_1]



Imagine, we have couple (let's say, ten) object. Every object represnt web site (for example), and have method get_value for scrap some data from this site. This method is unique for every object. Fields of objects are same. These objects is static and not require edit in runtime.



Then, in models we need ForeignKey to this objects:



class Data(models.Model):
data_source = models.ForeignKey(?????)


What a best and pythonic way to represent this data structure?




[ad_2]

لینک منبع