Giter Club home page Giter Club logo

csi-workshop's Introduction

Grab-it!

A small luck-based game built during CSI-RAIT's Web Development Workshop using Django Web Framework

Quiz Links

1 - Basics 2 - Web Architecture 3 - Web Technologies

Quick Access

Front-end

HTML BASE EXTEND TEMPLATE

{% extends 'base.html' %}
{% load static %}
{% block content %}
 <!-- HTML CONTENT GOES HERE -->


{% endblock %}

BASE VIEWS

def name(request):
    response = {}
    return render_to_response('name.html', {'response': response})

Column HTML

<div id="box-items" class="container">
        <div class="row">
            {% for item in response.items %}
            <div class="col-sm-3">
                <div class="card">
                    <img class="card-img-top" src="media/{{item.img}}" alt="Card image cap">
                    <div class="card-body">
                        <h5 class="card-title">{{item.title}}</h5>
                        <p class="card-text">{{item.description}}</p>
                        <a site="{% url 'grab' item_id=item.uuid %}" data-toggle="modal" data-target="#exampleModalCenter" class="grab btn btn-danger text-white">Grab this!</a>
                    </div>  
                </div>
            </div>
            {% endfor %}
        </div>
    </div>

Style References

FINAL STYLES 
body{
    background-color:#e9ecef;
}

#thor-image{
    height: 300px;
}

#thor-proud{
    height: 350px;
}
#thor-image{
    height: 300px;
}
.subtitle{
    font-size:2em;
}

#box-items{
    padding:20px;
}

.card{
    margin:10px;
}

Flex Box

d-flex justify-content-center align-items-center

Jumbotron Class

jumbotron jumbotron-fluid

Back-end

Item Model

class Item(models.Model):
    uuid = models.UUIDField(default=uuid.uuid4, editable=False, unique=True)
    title = models.CharField(max_length=30, blank=False)
    description = models.CharField(max_length=255)
    img = models.ImageField(upload_to='images/')
    is_worthy = models.BooleanField(default=None, blank=True, null=True)

    def __str__(self):
        return self.title

Admin Item Model

@admin.register(Item)
class Item(admin.ModelAdmin):
    fields = ('title', 'description', 'img', 'is_worthy')
    list_display = ('title', 'description', 'is_worthy')

Modal Code

    <div class="modal fade" id="exampleModalCenter" tabindex="-1" role="dialog" aria-labelledby="exampleModalCenterTitle" aria-hidden="true">
            <div class="modal-dialog modal-dialog-centered" role="document">
              <div class="modal-content">
                
                <div class="modal-body">
                        <div class="text-center">
                                <div class="spinner-border" role="status">
                                  <span class="sr-only">Loading...</span>
                                </div>
                                <h3><span class="text-danger">Thor </span>is calculating your worth... </h3>
                              </div>
                </div>
              </div>
            </div>
          </div>

csi-workshop's People

Contributors

jatinparab avatar

Watchers

 avatar  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.