This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <body> | |
| <div class='container'> | |
| <div class='row'> | |
| <div class='col-lg-6 col-md-6'> | |
| <!-- CODE FOR YOUR FIRST GRAPH --> | |
| </div> | |
| <div class='col-lg-6 col-md-6'> | |
| <!-- CODE FOR YOUR SECOND GRAPH --> | |
| </div> | |
| <div class='col-lg-6 col-md-6'> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from django.db.models.signals import post_save | |
| from django.dispatch import receiver | |
| from .models import ChatNotification, UserProfileModel | |
| import json | |
| from channels.layers import get_channel_layer | |
| from asgiref.sync import async_to_sync | |
| # CREATE SIGNAL LIKE THIS | |
| @receiver(post_save, sender=ChatNotification) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // NEWS ITEM | |
| import React, { Component } from "react"; | |
| export class NewsItem extends Component { | |
| render() { | |
| return ( | |
| <> | |
| <div className="card" style= {{width: "18rem"}}> | |
| <img src={!this.props.image?"https://akm-img-a-in.tosshub.com/indiatoday/images/story/202204/iPhone_14_Pro_max-647x363.jpeg?5zk05vsPW3tbAye_G9NazeYco6b4sbfe":this.props.image} className="card-img-top" alt="..." /> | |
| <div className="card-body"> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import React, {useState} from 'react' | |
| export default function Text() { | |
| const [text, setText] = useState('Enter Text Here') | |
| const handleUpClick = () =>{ | |
| console.log('CLICKED'); | |
| let newText = text.toUpperCase(); | |
| setText(newText) | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| [ | |
| { | |
| "id": "1", | |
| "name": "Haryana", | |
| "parent_id": "0" | |
| }, | |
| { | |
| "id": "2", | |
| "name": "Uttar Pradesh", | |
| "parent_id": "0" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # serializers.py | |
| from rest_framework import serializers | |
| from .models import Post, PostImage | |
| class PostImageSerializer(serializers.ModelSerializer): | |
| class Meta: | |
| model = PostImage | |
| fields = ['image'] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from rest_framework import serializers | |
| from .models import PastEvent, PostImage | |
| class PostEventSerializer(serializers.ModelSerializer): | |
| class Meta: | |
| model = PastEvent | |
| fields = ('id', 'title') | |
| # your image serializer | |
| class PostImageSerializer(serializers.ModelSerializer): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # if this is the models | |
| class upload(models.Model): | |
| image = models.ImageField(upload_to='media') | |
| # then create forms.py file under your app directory | |
| # and we will create form for our model so import modelForm | |
| # under your forms.py | |
| from django.forms import modelForm | |
| from your_app.models import your_model |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <html lang="en"> | |
| <head> | |
| <meta charset="UTF-8"> | |
| <meta http-equiv="X-UA-Compatible" content="IE=edge"> | |
| <meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
| <title>Document</title> | |
| </head> | |
| <body> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <html lang="en"> | |
| <head> | |
| <meta charset="UTF-8"> | |
| <meta http-equiv="X-UA-Compatible" content="IE=edge"> | |
| <meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
| <title>Infinite Scroll</title> | |
| <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.0/css/bootstrap.min.css" | |
| integrity="sha384-9aIt2nRpC12Uk9gS9baDl411NQApFmC26EwAOH8WgZl5MYYxFfc+NcPb1dKGj7Sk" crossorigin="anonymous"> |
NewerOlder