Full WebDev Cheatsheet
Full WebDev Cheatsheet
2. App Structure:
- models.py: Database models
- views.py: Logic/Controllers
- templates/: HTML templates
- static/: CSS, JS, images
3. Models:
from django.db import models
class MyModel(models.Model):
name = models.CharField(max_length=100)
created = models.DateTimeField(auto_now_add=True)
4. Forms:
- HTML form or Django form (forms.Form / forms.ModelForm)
5. Template Tags:
- {% for x in list %} ... {% endfor %}
- {% if condition %} ... {% endif %}
- {% include "file.html" %}
- {% url 'route_name' arg %}
2. Forms:
- <form action="" method="post">
<input type="text" name="user">
<input type="submit">
</form>
3. Tables:
- <table><tr><td></td></tr></table>
Django, HTML, CSS Cheatsheet with Explanations
4. Multimedia:
- <video src="movie.mp4" controls></video>
- <audio src="sound.mp3" controls></audio>
2. Animations:
@keyframes example {
from {opacity: 0;}
to {opacity: 1;}
}
.fade-in { animation: example 2s; }
4. Variables:
:root { --main-color: blue; }
color: var(--main-color);
JavaScript Cheatsheet
1. Basics:
- Variables: let, const, var
- Functions: function greet() {}, () => {}
- Data types: String, Number, Boolean, Object, Array
2. DOM Manipulation:
- document.getElementById('id')
- document.querySelector('.class')
- element.innerText / innerHTML
3. Events:
- element.addEventListener('click', function)
4. Control Structures:
- if, else, for, while, switch
5. Fetch API:
fetch('/api').then(res => res.json()).then(data => ...);
Bootstrap Cheatsheet
1. Getting Started:
- Link CDN: <link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css">
Django, HTML, CSS Cheatsheet with Explanations
2. Layout:
- Container: <div class="container">
- Grid: <div class="row"><div class="col-md-6">
3. Components:
- Buttons: <button class="btn btn-primary">
- Cards: <div class="card"><div class="card-body">
- Navbar: <nav class="navbar navbar-expand-lg navbar-light bg-light">
4. Utilities:
- Padding/Margin: p-3, m-2
- Text: text-center, text-danger
- Display: d-flex, d-none