2016-07-20 3 views
0

私はGrofers.comのデータベース設計を掘り下げて、grofersが販売店のリストを管理し、バイヤーに利用可能にする方法を理解しようとしています。どのような私が見つけたことはある特定のデータセットのデザインプラクティス?

商人は自分の店

基本的な詳細

Name, Email,Phone,Store Category 

金融Detaiリットルの一覧を表示させるには

Name of legal entity,PAN number,Registered office address,City 

ストアの詳細

Store Name,Location(google map),Store Address,Store Contact Number,Store Timings ( _ to _ and store off Sunday) **// how to model such store timing** 

製品

製品の名前、お手持ちのアイテム、カテゴリーの価格、説明

カテゴリー

名(食料品、ベーカリー&お菓子、食品、肉、スポーツ&フィットネスなど)

私は私が私の練習のためのDjangoでそれを設計しようとしましたが、私は店のカテゴリを表示することができる方法と混同していますデザイン

class Store(models.Model): 
    name_of_user = models.CharField() 
    email = models.EmailField() 
    phone_number_of_user = models.PositiveIntegerField() 
    name_of_legal_entity = models.CharField() 
    pan_number = models.PositiveIntegerField() 
    registered_office_address = models.CharField() 
    store_name = models.CharField() 
    location = models.CharField() 
    store_address = models.CharField() 
    store_contact_number = models.CharField() 
    # store_timings = models.CharField() 


class Product(models.Model): 
    category = models.ForeignKey(Category) 
    name_of_product = models.CharField() 
    items_in_stock = models.PositiveIntegerField() 
    price = models.DecimalField() 
    description = models.TextField() 
    image = models.ImageField() 

class Category(models.Model): 
    store_category = MultiSelectField(choices=MY_CHOICES) # grocery, meats, sports, foods, bags 

プロセスが

Choose a preferred store from the ones that deliver to you 
Checkout the cart with everything you need 
This app will then pick up the items from the shop and deliver to you 

を流し、以下を思い付くし、 gorfers.comのような製品関係や、場所や店舗のタイミングにも影響します。

答えて

1

これは達成しようとしていることですか?

class Store(models.Model): 
    name_of_user = models.CharField() 
    email = models.EmailField() 
    phone_number_of_user = models.PositiveIntegerField() 
    name_of_legal_entity = models.CharField() 
    pan_number = models.PositiveIntegerField() 
    registered_office_address = models.CharField() 
    store_name = models.CharField() 
    # For location - using latitude and longitude 
    store_long = models.DecimalField(max_digits=12, decimal_places=8, null=True) 
    store_lat = models.DecimalField(max_digits=12, decimal_places=8, null=True) 
    # End location 
    store_address = models.CharField() 
    store_contact_number = models.CharField() 
    store_start_time = models.DateTimeField() # start of when a store is closed 
    store_end_time = models.DateTimeField() # ending of when a store is closed 


class Category(models.Model):  
    GROCERY = 0 
    MEATS = 1 
    SPORTS = 2 
    FOODS = 3 
    BAGS = 4 

    STORE_CATEGORIES= (
     (GROCERY, _('Grocery')), 
     (MEATS, _('Meats')), 
     (SPORTS, _('Sports')), 
     (FOODS, _('Foods')), 
     (BAGS, _('Bags')), 
    ) 
    store_category = models.IntegerField(
     choices=STORE_CATEGORIES, default=GROCERY) 
+0

1人のユーザーが異なるカテゴリの複数のストアを持つことができ、1つのカテゴリは複数の商品を持つことができます。たとえば、2店舗あり、1店舗は食料品店などのスポーツです。食料品店は複数の商品を持つことができ、スポーツカテゴリに基づく店舗は複数の商品を持つことができます。 – Tushant

+0

@Tushantのようにはい。私はモデルをそのようにしたい。私はqestionを更新しました。 – milan

関連する問題