Git Product home page Git Product logo

bookmypg's Introduction

Book My PG - A PG recommendation application

An app which searches nearby pg and recommend it to the College going students

Technology Used

Django, tailwind, javaScript, Python and more...

Read more about Django here - link

Using virtual environment

Installing every packages in the virtual environment so that it doesn't effect any other project in the system using cmd - pipenv shell to activate the environment and pipenv instead of pip

Know more about virtual Environment - link

Dividing whole project into different small apps

To make our developement a little bit easy we are making different apps for different features Here we have apps like :

  • Booking
  • Conversations
  • Rooms
  • Users
  • Reviews
  • Lists

Making the database

Making database tables for every apps and then populating it with some data. In django we call it as defining models ( which can be done coding in python language )

Admin panel

Admin panel is available for the superuser to create, read, update and delete the data.

** Bonus point - If a function called inside the class it is called METHOD else if outside the class it's function **

seeding in django

  • using django seed to create fake data

for eg: seeding of facilities in database

from django.core.management.base import BaseCommand
from rooms.models import Facility


class Command(BaseCommand):
   help = 'This command creates facilities'

   def handle(self, *args, **options):

       facilities = [
           "private entrance",
           "parking",
           "elevator",
           "gym",
       ]
       # Amenity.objects.create()
       for a in facilities:
           Facility.objects.create(name=a)
       self.stdout.write(self.style.SUCCESS(f"{len(facilities)} facilities created!"))

Paginator is awesome

  • from django.core.paginator import Paginator

way to use them :

    def all_rooms(request):
        page = request.GET.get("page")
        room_list = models.Room.objects.all()
        paginator = Paginator(room_list, 10, orphans=5)
        rooms = paginator.get_page(page)
        # print(vars(rooms))
        return render(
            request,
            "rooms/home.html",
            {
                "page": rooms,
            },
        )

Here Orphan will help in moving remaining pages to the previous page ( how coool is that ), in this case it will move 5 or less items to previous page

Exception handeling

    try:
        rooms = paginator.page(int(page))
        return render(
            request,
            "rooms/home.html",
            {
                "page": rooms,
            },
        )
    except EmptyPage:
        rooms = paginator.page(1)
        return redirect("/")

Using django forms

bookmypg's People

Contributors

jiteshjitsun avatar sk-108 avatar

Stargazers

 avatar

Watchers

 avatar

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.