Code Monkey home page Code Monkey logo

marketplace's People

Contributors

msagastya avatar pradyumnakrishna avatar uditagrawal08 avatar

Stargazers

 avatar

Watchers

 avatar

marketplace's Issues

Product showcase view

Create a view that showcases products present in database.
The view should be created on home app and query the database for the products.
Add pagination to the products, so that only 10-20 products can be listed on a page.

We will use the product card to show the products that will done after completing issue #9.

Update index.html template

Update index.html template to beautify the web app UI. Feel free to use bootstrap or any other css framework to build the UI.

Product Model

Once we are done with creation of home app #1. We have to create a Product Model.
Django uses models as a representation of SQL Schema or we can say the table object.
We have to create a Model for Project, that will contain the following item.

  1. id: uuid (auto)
  2. name: string
  3. price: float
  4. description: string (not required)
  5. created_at: datetime (auto)
  6. updated_at: datetime (auto)
  7. product_image: image (not required)

We have to create this model inside the models.py file of the home app and generate the migrations.

References

  1. https://docs.djangoproject.com/en/4.2/topics/db/models/
  2. https://www.w3schools.com/django/django_models.php
  3. https://www.geeksforgeeks.org/django-models/

Add product specific page

There is no product page available on the website. Make the product card clickable that leads it to a new page that list all the details about product, and buying options.

The general template could be like a Amazon product page.

Minor UI improvements

Anyone experienced with bootstrap can improve the UI and fix minor bugs in products grid etc.

Add image upload functionality

Currently Image upload functionality is not available to CC-BHU. Look for a method to host static files and add image upload functionality.

Create a seller app and Seller model

Create a new seller app just like #1 and add a Seller model that will contain details related to seller.

Here are the attributes of Seller:
name: Name of the seller (required)
phone: Phone no of the seller (required)
email: Email of the seller (required)
location: Address of the seller (not required)

Creation of Home App

We can split a django application into multiple apps like home, buyer, and seller. Let's create a Home app first that contains our homepage, which opens when we visit our / endpoint.

  1. Open the terminal and navigate to the root directory of your Django project.

  2. Run the following command to create a new Django app called "home":

    python manage.py startapp home
    

    You will found a new folder home is created.

  3. Add the home app to the INSTALLED_APPS list in the settings.py file of your Django project. That will be marketplace.home.

  4. Create a html template index.html inside the templates folder of home app directory that will contain your home page.

  5. Open the views.py file in the home app directory and define a view function to handle the creation of a new product listing. For example:

    from django.shortcuts import render
    
    def root(request):
        return render(request, 'index.html')
  6. Create a new file called urls.py in the home app directory and define the necessary URL patterns for the home app. For example:

    from django.urls import path
    from .views import root
    
    app_name = 'home'
    
    urlpatterns = [
        path('', root, name='home'),
    ]
  7. Update urls.py of project directory to add these urls.

    urlpatterns = [
        path("admin/", admin.site.urls),
        path("", include("home.urls", namespace="home")),
    ]

That's it for the creation of new app home.

Create a product card

Create a product card that will show a product details on the home page. The card will contains few details like product name, type, price and image.
We will need to setup a storage for image as well, so we will look into the details of image later on.

For now create a product template under template and that will be included later on into the index.html or any other template using jinja2 formatting.

References

https://stackoverflow.com/questions/10985950/how-do-you-insert-a-template-into-another-template
https://devsheet.com/include-template-django/
https://docs.djangoproject.com/en/4.2/ref/templates/builtins/

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.