#web-development

2 messages · Page 150 of 1

scenic pendant
native tide
#

Unexpected closing tag "body". It may happen when the tag has already been closed by another tag.
this is the error I am gettin even when I am closing all the tags

#

what should I do?

umbral shale
#

Hello!
i try to build a web scraper for a friend for me with Scrapy and i don't know where my error is...
The Scraper do catch the prices from items on the steam market.

The printed array is empty by run the programm...

My Code:

import requests
from bs4 import BeautifulSoup

url = "https://steamcommunity.com/market/listings/252490/Blackout Vest"

response = requests.get(url)

html = BeautifulSoup(response.text, "html.parser")

buyPrice = html.find_all("span", class_="market_commodity_orders_header_promote")

allBuyPrices = list()

for price in buyPrice:
allBuyPrices.append(price.text)

print(allBuyPrices)

Have anyone a idea?

Thank you a lot!

Buy and sell Rust items on the Steam Community Market for Steam Wallet funds.

inland oak
#

is anybody knowing solution perhaps, where do I do wrong?

#

I surely succeded with customer-list though being outputed to wiki

#

something is wrong with my customer-detail due to more difficult path perhaps

undone flicker
#

notice big "A" in findAll function

native tide
#

idk webscraping or the return type of smth like that but i dont think you can do it like that.
What I suggested was smth like that:

  if(driver.find_element_by_xpath('//*[@id="error"]'):
      print("Found an element")
  else:
      print("Nothing found")

idk if you tried it yet but if not pls try it and see if that atleast gives you "Nothing found" and if so try instead of "by_xpath" "by_id". mby that gets you some results

inland oak
#

nevermind, I managed DRF to work

stone citrus
#

Hey, I'm trying to create a django model to store data about web pages e.g. their titles, urls and meta data. I'm storing each page's source HTML externally in S3 and recording the key for each page as such:

class Page(models.Model):
  url = models.URLField(unique=True)
  title = models.CharField(max_length=255)
  html_s3_key = models.TextField()
  meta_description = models.TextField() # Extracted from the page HTML
  ...

However, since the meta data is derived from the page HTML I'm thinking this would break normalization. Is this a good use-case for a one-to-one key? For example:

  class Page(models.Model):#
    url = models.URLField(unique=True)
    title = models.CharField(max_length=255)
    html_id = models.OneToOneField('Html', on_delete=models.CASCADE)

  class Html(models.Model):
    html_s3_key = models.TextField()
    meta_description = models.TextField()
    ...
wanton ridge
#

Did you use link too put css file in html?

tacit anvil
#

i fixed it

#

thanks tho

wanton ridge
#

Oh ok,np

frozen abyss
#

Could anyone kindly help me out in #help-rice ? I'm looking to make #hastags linkable in my Django Twitter clone. Thanks!

nimble dawn
#

How to add small animations and transitions effect in website?

frozen abyss
rocky basin
#

Hey I was learning React and trying to make a basic math game....it seems to be working fine but whenever I submit the form it just changes the numbers for a split second and works as its supposed to but then goes back to the default (1+1) thing...
[HMR] Waiting for update signal from WDS... this is the message that the console shows

#



function App(){
  
  const [num1,setNum1]=useState(1);
  const [num2,setNum2]=useState(1);
  const [score,setScore]=useState(0)

  const checkit =()=>{
    if (parseInt(document.querySelector('#answer').value)===num1+num2){
      setNum1(Math.ceil(Math.random()*10));
      setNum2(Math.ceil(Math.random()*10));
      setScore(score+1)
      console.log(num1,num2)
      
    }
    else if(parseInt(document.querySelector('#answer').value)!==num1+num2){
      setScore(score-1)
      console.log("wrong")
    }
    
    return false
  };
  if (score<10){
  return(
    <div>
      <div className='Game'>
    <h1>{num1}+{num2}</h1>
          <form onSubmit={checkit}>
          <input type="text" name="answer " id="answer"/>
          <input type="submit"/>
          </form>
        <h2>{score}</h2>
      </div>
    </div>
    
  );}
  else{
    return(
      <div>
        <h1>YOU WON</h1>
      </div>
    );
  }
}
export default App;```
minor pumice
#

any good tutorial for django, react and websockets??

inland oak
#

Official one

#

Tutorial to get started is included there

native tide
#

anyone have fix?

frozen abyss
native tide
#
<!DOCTYPE html>
<html>
  <head>
    <link href="styles/main.css" rel="stylesheet" type="text/css"/>
    <title>COVALENT</title>
  </head>
  <body>
  </body>
</html>
body {
    background-color: #000000;
}

it's not linking to the css file. what could be wrong?

terse vapor
#

<link rel="stylesheet" type="text/css" href="{{ url_for('static', filename='main.css') }}">

#

this is how i link to my css file inside static folders

#

and it works fine

native tide
#

thanks it worked

#

i spent whole day searching for it.

terse vapor
#

its because the way u try to access the css file is a bit different

#

so i went back and check mine

native tide
#

i am newbie

terse vapor
#

same

#

that access css file also spend a lot of my time doing research

native tide
#

we can't name it something else instead of static?

terse vapor
#

not sure

#

u can try

native tide
#

it gives error werkzeug.routing.BuildError: Could not build url for endpoint 'styles' with values ['filename']. Did you mean 'static' instead?

charred imp
#

Guys, what is the best front end frameworks in the actual days?

nimble dawn
#

Depends on the theme of the website

#

But I like more round letter

#

Like in google

terse vapor
native tide
#

it works if i name the folder static

#

nevermind

nimble dawn
#

You are indian?

native tide
#

yep

terse vapor
#

In flask, how do I statics the total patient instead of total new patient from sqlalchemy?

nimble dawn
#

Don't know

#

I have just started with css

terse vapor
#

lol

nimble dawn
#

Already done

native tide
#

ok

terse vapor
#

I just copy paste the template from internet

#

👍

native tide
#

lol

nimble dawn
#

I was thinking to learn web developing and make basic or high level websites

#

And earn some money

terse vapor
#

im making a clinic website

#

gg

nimble dawn
#

How to make animations

#

Like when we move cursor over the text it bounces up something like that

signal bronze
#
    html { 
        background-image: linear-gradient(to  bottom right, orange, blue);
    }``` how can i stop this from happening (im very bad at css)
distant trout
#

do i need redux with nextjs?

#

i know people use redux with create-react-app

#

but was curious about nextjs

charred imp
opaque rivet
# native tide anyone have fix?

the error tells you exactly what's wrong. You're trying to input a string exceeding 50 characters into a field of your model (where you have max_length set to 50)

opaque rivet
#

but it is recommended to use redux, yes 🙂

native tide
#

I did change it

#

all above 50

#

but still no luck

opaque rivet
#

did you makemigrations & migrate?

distant trout
opaque rivet
wooden ruin
#

are there any alternatives to storing JWT in the web browser? i'm going for a login auth system which works so far, and every time a user logs in, it's for a certain amount of time before the JWT expires

nimble dawn
#

I am thinking to make a covid website

#

How to make covid counter

#

Real time counter

#

Well it will take months to make

#

As I am new to it and I have my school work also

native tide
#

however there is a problem

#

when I makemigrations or migrate it will ask where django_heroku is but I already installed it

#

its weird 🥲

terse vapor
nimble dawn
#

Api?

terse vapor
terse vapor
nimble dawn
#

10

terse vapor
#

nice

nimble dawn
#

Just came

#

My exams are not cancelled

terse vapor
#

haha

#

same

nimble dawn
#

Nice

terse vapor
#

u can use api to access the data, or using json

nimble dawn
#

Ok I will study about it

#

But currently I have to do my sst work :(

terse vapor
#

import COVID19Py covid19 = COVID19Py.COVID19() covid19 = COVID19Py.COVID19(data_source="csbs") latest = covid19.getLatest() print(latest)

storm lintel
#

what is the best beginner framework for webdev in python

#

?

terse vapor
#

I use flask

storm lintel
#

ok

#

thanks

#

yea I am learning flask

terse vapor
#

what kind of web u want to design

storm lintel
#

i mean it must look good

terse vapor
#

well u need some css for that

storm lintel
#

ok

potent panther
#

Is it worth learning django guys?

#

In 2021

#

?

terse vapor
#

you can learn any languages

distant trout
#

why wouldnt it be? lemon_thinking

toxic echo
#

quick question.. i'm unsure of how to apply migrations after writing my models
I have created an app with python manage.py startapp AppName and created some models inside AppName/models.py
but whenever i do python.py makemigrations or migrate it says there are no changes🥲

obtuse kite
#

than do

#

make sure directory is correct

obtuse kite
#

if you are using shell you have to specify by

#

Modelname.object.save()

#

and if it's just vsc hit control +s

toxic echo
obtuse kite
toxic echo
#

sure, what do you need exactly?

obtuse kite
#

The model you want to render in your database

#

that specific class

toxic echo
obtuse kite
#

first of all try to use crtl + s and than use both migration commands with order that makemigrations come first and than migrate

#

this might work

nimble dawn
#

How to download html and css in vs code

#

Or they are inbuilt

vivid canopy
#

the are inbuit if i know

nimble dawn
#

Ok

toxic echo
#

just save the file?

obtuse kite
toxic echo
#

i can just try vsc..

#

the file is saved already

obtuse kite
obtuse kite
vivid canopy
#

wich problem u try solve?

#

which

toxic echo
#

what am i doing wrong then

nimble dawn
#

What are you trying to makw

#

Make

vivid canopy
#

try python3 haha my help

#

mb

toxic echo
#

i'm trying to apply migrations for models i just created

nimble dawn
#

Ok

obtuse kite
#

really

nimble dawn
#

What are migrations

obtuse kite
vivid canopy
#

hahaha really

obtuse kite
#

I am not sure if it is but it highlights test.py

toxic echo
vivid canopy
#

yes it's cam

#

be

toxic echo
#

it's because i have my pointer there

obtuse kite
#

oh

#

let me try to debug it

vivid canopy
#

who know flask better?

obtuse kite
#

@toxic echo when you run python manage.py makemigrations does it make a file in pychache directory?

toxic echo
#

it doesnt change anything but i had some files there already

obtuse kite
#

this is a possible solution

#

delete all migration files

#

except for init.py

#

and than run migration commands

#

within your app directory there is a folder called migrations within that folder there is another folder called pychace in pychache folder delete all files but init.py py and than run migration commands

toxic echo
#

there isnt any pycache there

#

only init.py

#

which is empty

obtuse kite
#

which version you are using

toxic echo
#

does this answer your question

obtuse kite
#

yeah it does

#

I want to see your migrations folder within your app directory

#

and tell me if your app is registered in settings directory or not

toxic echo
#

that might be the problem😅

obtuse kite
#

bruh

#

lmao

toxic echo
#

feels so bad🥲

obtuse kite
#

It's not your fault even finest developer make tiny mistakes

#

do you know how to register your app if not I can help you

toxic echo
#

i don't, searching for it rn lol

obtuse kite
#

it's easy

#

create a new element in that list such as

#

'yourappname.apps. '

#

after .apps. you have to copy paste this thing from your apps.py

#

the highlighted one

#

my app name was social app so it would be

#

'socialapp.apps.SocialappConfig'

toxic echo
#

let me try
i think it is 'WikiumaApp.apps.WikiumaAppConfig'

obtuse kite
#

yep

#

than save

#

I'll not mind if you dm me later if problem doesn't solve

toxic echo
#

oh now i see errors

#

but that's fine cause now i can debug myself

#

thanks a lot😁

obtuse kite
#

can I add you as friend

toxic echo
#

sure

obtuse kite
#

so we can help each other as a friend when we need cause I am still a begginer

native tide
#

Ight so my problem is this that im trying to make a website with flask i have already pip installed flask and other thing but when I run my code I get an error saying "can't find 'main' module in '[File desination]' "

vivid canopy
#

Who want to speak?

obtuse kite
#

I never used flask framework

naive crater
#

!paste use this

lavish prismBOT
#

Pasting large amounts of code

If your code is too long to fit in a codeblock in discord, you can paste your code here:
https://paste.pydis.com/

After pasting your code, save it by clicking the floppy disk icon in the top right, or by typing ctrl + S. After doing that, the URL should change. Copy the URL and post it here so others can see it.

obtuse kite
#

here you go

vivid canopy
#

ali u learn django?

#

A

native tide
#

sure

from website import create_app

app = create_app()

if __name__ = '__main__':
    app.run(debug=False, )

I also have another python file that has this line of code

from flask import Flask


def create_app():
    app = Flask(__name__)
    app.config['SCERET_KEY'] = 'BAKI HANMA'

    return app
#

@naive crater

vivid canopy
#

i can help with flask

naive crater
vivid canopy
#

make

naive crater
#

oh wait

vivid canopy
#

True

naive crater
#

dude

vivid canopy
#

not False

naive crater
#

you have the wrong equal sign

vivid canopy
#

and scobe

naive crater
#

it's if __name__ == '__main__':

vivid canopy
#

yeap

#

make True

native tide
#

🤦‍♂️

#

ty

vivid canopy
#

solve?

native tide
#

nope

naive crater
#

yeah thought so

#

remove that line altogether

native tide
#

i get the same error 🤔

vivid canopy
#

same mistake

naive crater
#

and see what happens

native tide
#

ight

#

same error

vivid canopy
#

waor

naive crater
#

show ur code again

vivid canopy
#

wait

naive crater
native tide
#

wait a min

vivid canopy
#

if name == 'main':

native tide
#
from website import create_app

app = create_app()

app.run(debug=False)
vivid canopy
#

app.run(debug=True)

#

True

native tide
#

same error though

naive crater
vivid canopy
#

no don't delate

#

returnm

#

back

naive crater
#

try making the app in the same file

native tide
#

They are

naive crater
#

so app = Flask(__name__)

#

in the same file as app.run

native tide
#

yes

naive crater
#

wait they were already in the same file?

#

I'm a bit confused by your setup

vivid canopy
#

from website import create_app

app = create_app()

if name == 'main':
app.run(debug=True)

native tide
#

Would you like me to send a screen shot?

naive crater
native tide
vivid canopy
#

man

#

underscore

native tide
#

did i not send the right thing?

vivid canopy
#

use my

#

code

naive crater
#

you need the underscores

vivid canopy
#

which i sanded

#

it's will help

#

u

naive crater
#

it should be if __name__ == '__main__'

vivid canopy
#

yeap

naive crater
#

but that's not where it's coming from

vivid canopy
#

wait

#

i show

naive crater
#

do you have a file called python.exe in your scripts folder?

#

and if so can I see its contents

native tide
#

sure let me check

vivid canopy
#

use

native tide
#

sorry this is my first time so how should i open the file?

naive crater
#

hold up did you not make that file?

native tide
#

which file?

naive crater
#

python.exe

vivid canopy
#

PANJ go to the voice

native tide
#

Yea i think it came in when I used pip install

vivid canopy
#

i wiil help

naive crater
native tide
naive crater
#

which file are you running?

native tide
#

and there is also stuff in init.py

#

__

vivid canopy
#

@native tide can u go ti the voice?

sleek crest
vivid canopy
#

yea

native tide
#

sure

naive crater
native tide
native tide
vivid canopy
#

i add you

native tide
#

k

naive crater
#

I've got to go, but try isolating main.py and running it in something like IDLE (after putting it in a separate folder with your other python file)

echo radish
#

Guys is it possible to build a website using python and add a game on it?

formal axle
#

what are models for in django, the docs dont rlly explain it

echo radish
#

What are the tools that I'm going to need for that? PES_Hug

quick cargo
#

Alot of client side

#

web based games are gonna be either JS or more recently WASM

#

in the end it would likely be more of a static page with Python doing api stuff

native tide
#

Need assistance with a web app I’m building . It’s kind of a lot. I think.

#

I’m using Flask to build it out

formal gull
#

is there any sort of django equivalent to get a value of a form field? using this in flask worked just fine x = request.form["fpnum"]

terse vapor
tough tartan
#

what is wrong with:

<link rel="shortcut icon" href="Downloads/favicon.ico" type="image/x-icon">
```?
viscid valley
#

I'm guessing it's having trouble resolving the favicon?

tough tartan
nimble dawn
#
<!DOCTYPE html>
<html>
    <link rel="stylesheet" href="style.css">
    <head class="head">hello world </head>
    <body class="b"> 
        
        
        This is my first website using css                     
           


    </body>
 </html>
#
.head {
    color:aqua;
}
.b {
    font-size:2em;
    color:black;
    background-color: rgb rgb(14, 94, 14) , rgb(62, 204, 62), rgb(35, 248, 16);

}
#

idk why it is not working

#

the font size is changing

#

not the colors

rancid heart
#

Hello

nimble dawn
#

hi

rancid heart
#

anyone here that can help me with a django problem?

nimble dawn
#

well i dont even know what it is

rancid heart
#

oh fuck me nvm, I found the problem

nimble dawn
#

now only bg color is changing

#

wt hell

rancid heart
nimble dawn
#

done

rancid heart
#

so like background-color: rgb(100,100,100)

nimble dawn
#

solved it

tawdry ore
#

Hey guys, new to Django, wondering how much time took you to be able building a website from scratch?

vestal hound
#

that depends on how complex a website

haughty shadow
#

Hi guys i am getting a error in deployement of my django app in heroku server.
If somebody could help please dm me.

tawdry ore
vestal hound
haughty shadow
vestal hound
#

the log?

haughty shadow
#

Yeah i did 3 times

vestal hound
#

...and what does it tell you?

haughty shadow
#

it has failed to push the logs

#

some of the refs

nimble dawn
#

i am not able to set bg image

vestal hound
nimble dawn
#

not showing any errors

haughty shadow
#

requested runtime in 3.9.4

#

So should i change my python version???

vestal hound
#

the first step to solving a problem

#

is understanding what the problem is

haughty shadow
vestal hound
haughty shadow
#

Ok fine should i use 3.8.6?

vestal hound
#

then it makes me feel like you're not really understanding the problem...

#

because

#

if you did

haughty shadow
#

No actually i have 3.8.6 installed

vestal hound
#

why do you think this is relevant?

#

please help me understand that

haughty shadow
#

Hmm

#

With this i get to anouther question that how to change between versions??

vestal hound
haughty shadow
vestal hound
#

my question is

#

you have 3.8.6 installed

#

okay, fine.

#

but

#

that's on your local environment

#

you are deploying to Heroku

#

so why does your local version matter?

#

you're not deploying your Python installation itself

#

only your Python code

#

correct?

haughty shadow
#

Hmm right

nimble dawn
#

wt hell

vestal hound
nimble dawn
#

those words are hurting me

vestal hound
#

therefore

#

you are asking the wrong question

#

you should be asking

#

how do I tell Heroku which version I want it to use?

#

think about that.

haughty shadow
vestal hound
#

it's important

#

to think about the questions you're asking

#

whether they make sense.

#

so you can solve your own problems

nimble dawn
#

i am not able to set bg image

haughty shadow
#

So should i change my reqirements.txt??

nimble dawn
#

and it is not showing any errors also pls help

haughty shadow
#

i mean runtime.txr

#

.txt

native tide
#

can anyone tell me how to parse this type of content <html>\\n <head></head> \\n <body> \\n <p><img 10-14\\nto=\"\" 10-3=\"\" added.\\nhin=\"\" alt='\\\"The' and=\"\" as=\"\" constant=\"\" dissociation=\"\" follows:\\n=\"1.0\" hc1-5.6x=\"\" hcl=\"\" is=\"\" m\\nassum\\\"=\"\" of=\"\" reaction=\"\" src='\\\"//d2vlcm61l7u1fs.cloudfront.net/media%2Fbb5%2Fbb5b5285-b37b-44ad-ae44-5feb873a4ec7%2FphpTaH4Ws.png\\\"' style='\\\"height:453px;width:567px;\\\"' this,=\"\" water=\"\" x=\"\"/></p> \\n <p><img (1.32x10=\"\" alt='\\\"Solve' as=\"\" calculate=\"\" follows:\\nph-logh]\\n-log=\"\" for=\"\" h7.6x10-=\"\" m)\\n\\\"=\"\" m+(5.6x10-*)=\"\" m\\n1.32\u00e3\u201410-7=\"\" m\\nnow=\"\" m\\ntotal=\"\" ph=\"\" src='\\\"//d2vlcm61l7u1fs.cloudfront.net/media%2F022%2F0226e5b7-47fc-4d27-907a-57c0a3759188%2FphpmIT4cp.png\\\"' style='\\\"height:510px;width:392px;\\\"' the=\"\" x.\\nx-7.6x10=\"\"/></p> \\n </body>\\n</html>

viscid valley
#

When using Scrapy pipelines, all items are sent to all pipelines? There's no way to determine what items goto what pipelines?

vestal hound
viscid valley
#

I really fail to grasp this concept.

vestal hound
#

and my gut feel is no (you can), but I haven't worked with Scrapy

#

sorry

vestal hound
#

BeautifulSoup

viscid valley
#

Looking under the hood, this seems to be the cast. I just don't understand why.

native tide
vestal hound
viscid valley
vestal hound
native tide
#

I want to parse this type of content on html string

haughty shadow
native tide
nimble dawn
#

see

vestal hound
nimble dawn
#

this is how it is coming

vestal hound
#

show CSS

nimble dawn
#
.head {
    color:blue;
    font-style:oblique;
    
}
#b {
   
    background-image:src("https://wallpapercave.com/wp/wp3850825.jpg");
    
    
}
vestal hound
vestal hound
#

unless there's some other stuff I'm missing

nimble dawn
#
<!DOCTYPE html>
<html>
    <link rel="stylesheet" href="style.css">
    <h1 class="head">HELLO WORLD </h1>
    <body id="b"> 
        
        
        
                   
    </body>
 </html>
native tide
nimble dawn
vestal hound
#

hm

#

your body is empty

#

put some stuff in your body

#

it should work

vestal hound
nimble dawn
#

i did

vestal hound
nimble dawn
#
<!DOCTYPE html>
<html>
    <link rel="stylesheet" href="style.css">
    <h1 class="head">HELLO WORLD </h1>
    <body id="b"> 
        
        
        This is my first website using css    
                   
           


    </body>
 </html>
#

see

#

even after this

#
.head {
    color:blue;
    font-style:oblique;
    
}
#b {
    font-size:2em;
    color:black;
    background-image:src("https://wallpapercave.com/wp/wp3850825.jpg");
    
    
}
native tide
#

<html>\\n <head></head> \\n <body> \\n <p><img 10-14\\nto=\"\" 10-3=\"\" added.\\nhin=\"\" alt='\\\"The' and=\"\" as=\"\" constant=\"\" dissociation=\"\" follows:\\n=\"1.0\" hc1-5.6x=\"\" hcl=\"\" is=\"\" m\\nassum\\\"=\"\" of=\"\" reaction=\"\" src='\\\"//d2vlcm61l7u1fs.cloudfront.net/media%2Fbb5%2Fbb5b5285-b37b-44ad-ae44-5feb873a4ec7%2FphpTaH4Ws.png\\\"' style='\\\"height:453px;width:567px;\\\"' this,=\"\" water=\"\" x=\"\"/></p> \\n <p><img (1.32x10=\"\" alt='\\\"Solve' as=\"\" calculate=\"\" follows:\\nph-logh]\\n-log=\"\" for=\"\" h7.6x10-=\"\" m)\\n\\\"=\"\" m+(5.6x10-*)=\"\" m\\n1.32\u00e3\u201410-7=\"\" m\\nnow=\"\" m\\ntotal=\"\" ph=\"\" src='\\\"//d2vlcm61l7u1fs.cloudfront.net/media%2F022%2F0226e5b7-47fc-4d27-907a-57c0a3759188%2FphpmIT4cp.png\\\"' style='\\\"height:510px;width:392px;\\\"' the=\"\" x.\\nx-7.6x10=\"\"/></p> \\n </body>\\n</html into this <html> <head></head> <body> <p><img alt="The dissociation reaction and constant of water is as follows:= 1.0 x 10-14To this, HCl is added.Hin HC1-5.6x 10-3 MAssum" src="https://d2vlcm61l7u1fs.cloudfront.net/media%2Fbb5%2Fbb5b5285-b37b-44ad-ae44-5feb873a4ec7%2FphpTaH4Ws.png" style="height:453px;width:567px;"></p> <p><img alt="Solve for x.x-7.6x10 MTotal H7.6x10- M+(5.6x10-*) M1.32×10-7 MNow calculate the pH as follows:pH-logH]-log (1.32x10 M)" src="https://d2vlcm61l7u1fs.cloudfront.net/media%2F022%2F0226e5b7-47fc-4d27-907a-57c0a3759188%2FphpmIT4cp.png" style="height:510px;width:392px;"></p> </body></html>

vestal hound
#

okay

#

let me think about this for a moment

native tide
#

👍

vestal hound
vestal hound
#

there are going to be significant problems

#

because word order is lost

nimble dawn
#

thanks

#

it worked

native tide
vestal hound
#

like you can tell that the words are alphabetically ordered

vestal hound
native tide
vestal hound
#

in the result

#

th text goes

#

"The dissociation reaction and constant"

#

but in the first one the order is "and", "as", "constant", "dissociation", "follows"

#

a to z

#

right?

#

the order of the original is lost

native tide
#

ya

#

Actually, this is pretty hard for me

#

you know

vestal hound
#

uh-huh

#

why do you even need to do this?

native tide
vestal hound
native tide
#

are you here?

#

@vestal hound

vestal hound
native tide
#

can you help me pls?

haughty shadow
nimble dawn
#

how can we make coverter in website

#

like perform calculations

#

leave it

stone dome
#

why is it that when i give:

return redirect("accounts/login")

it searches for the current url + "accounts/login"
but when i do:

return redirect("login")

it searches for login for the base url + login from the urls.py of the apps folder in django?

glad patrol
#

hi i need help
i have a small page which shows data from database
also it has print button
when i click on button nothing happen
i need to print the page
can someone help me

#

in .net

#

SCRIPT16389: SCRIPT16389: Unspecified error. rptHRDScholarshipsProvinceWise.aspx (518,20)
at this line
var printWindow = window.open('', panel, 'height=400,width=800');

nimble dawn
#

how to make scroll function

#

like it scrolls through images

twilit needle
#

thanks, i did it

formal gull
#

#help-mango if anyone has a second to just answer a question 🙂

vital mural
#

Hi, everyone!

I am behaving strangely from an html page. Only inside the Iphone does it behave this way, zooming in when opening the content. Does anyone know if this could be a css problem?

nimble dawn
#

Did you set the appropriate size

stable coral
#

I'm not sure if this is the right place to ask, but here's what I'm wondering. For one of my classes we use a website that has physics questions, however while the questions are the same for everyone, certain values change. My guess is that for each question, the system has a problem specific formula that it uses to grade the problems and determine the correct answer (I don't think that the people who made this website sat down and manually calculated every option). Theoretically, if you had access to the whole website would these formulas be visible? Would it be stored in the backend with password stuff?

#

My understanding of web stuff is VERY limited so tell me if I'm completely wrong

terse vapor
#

maybe it could be done in javascript, like var = input_1 + input_2 then return var

opaque rivet
opaque rivet
# stone dome why is it that when i give: ```python return redirect("accounts/login") ``` it s...

from the docs:
The arguments could be:

A model: the model’s get_absolute_url() function will be called.
A view name, possibly with arguments: reverse() will be used to reverse-resolve the name.
An absolute or relative URL, which will be used as-is for the redirect location.

https://docs.djangoproject.com/en/3.2/topics/http/shortcuts/

It will redirect to the URL that the login view serves.

stable coral
stable coral
#

not that I would ever cheat in that manner

#

morals + risk

#

ok

charred berry
#

are there any free smtp server which don't ask us to provide all the company info and personal info during siignup?

stone dome
#

According to the docs if I provide a path name then it should search my urls.py for the path but it searches in the wrong urls.py

#

What am I doing wrong?

opaque rivet
stone dome
opaque rivet
stone dome
#

Yeah

opaque rivet
#

so why don't you just redirect to the name of the path?

stone dome
#

I tried that and like I said it searched for the name of the path in the urls.py of the app_name folder inside the root directory instead of the urls.py in the accounts folder of the same root directory

#

Sorry I’m on mobile rn or I could’ve showed u the error

#

Basically it said it went through all my paths in the urls.py of the app_name folder and couldn’t find the path with path_name

nimble dawn
#

i want make image smaller in css how to do it

#

width and height are not working

stone dome
#

Wait nvm I think I found the error

#

Ty @opaque rivet

opaque rivet
prime quartz
#

where can i learn creating a website wide login authentication in flask

terse vapor
#

youtube

native tide
#

I don't know if this is the correct place ot ask, but how do I host a html page with aiohttp? Whenever I run it and have it serve the HTML, it just shows the actual html.

terse vapor
#

?

prime quartz
# terse vapor youtube

I checked and couldnt understand it, they showed authenticate to one page, or authentication for each page individually

native tide
#

The code I have is ```py
import asyncio # Parallel loops
from aiohttp import web # Running servers n stuff

Open up all the html pages to serve

f = open("html/mainpage.html")
mainpage = f.read()

async def handleMainsite(request):
text = mainpage
return web.Response(text=text)

app = web.Application()
app.add_routes(
[
web.get('/', handleMainsite)
]
)

web.run_app(app, host='0.0.0.0', port=8081)

prime quartz
#

im not sure how that works

prime quartz
#

as i wasnt sure what does what

#

nvm i got something

#

ty

native tide
#

Soo, my CSS just run away from me, how can i put the Admin CSS from django again?

nimble dawn
#

Hi

terse vapor
#

u can add a urlfor in html to find the css file

nimble dawn
#

How to change position of text and images

#

I know the tags but don't know how to use them

#

Even after seeing multiple examples

#

The only thing I am lacking is with width,height,size, alignment

terse vapor
#

isnt that all u need? lol

native tide
#

How can i put this?

quick cargo
#

are you by any chance running django in production mode?

dense slate
#

Anyone know why I'm getting TypeError: on_delete must be callable. if my model has no on_delete in it?
game_played = models.ForeignKey(Game, "Game Played", help_text="Game Played", null=True, blank=False, default="")

#

If I add it, then it says there are multiple values conflicting for on_delete.

pliant jewel
#

Hey anyone know how to set up the file structure for a flask app? I currently have everything in one big file (i know its not optimal), and I want to separate it into separate files. I know where to put my routes and models, but I have no clue where to put the config and imports... does it go in __init__.py or ?? And also which file do i define as FLASK_APP after i seperate them?
hmu with an @ :D tyty in advance

hardy mirage
#

Hello fellas,

First of all this question is about django.

I have two event type defined as model. Admins can create one of that event whatever they want.

I need to do this;

When created an event with one of that event types, i want to add the event to a table in database. I am stuck with this. May be i am thinking wrong i don't know.

Thanks for any help or any comment

formal gull
#

im getting spammed with this Not Found: /manifest.json [23/Apr/2021 17:32:22] "GET /manifest.json HTTP/1.1" 404 2307 using django and react. any ideas on what i would need to look for to fix this?

native tide
formal gull
manic frost
formal gull
#

oh okay. i dont know how or why it even started doing this. i dont have any sensitive information was just trying to figure out how to get it to stop spamming 🙂

#

ill ask in there though if thats the best place

formal gull
#

i assume its not pointing to the manifest.json properly some how?

native tide
#

Can anybody please help with deploying a flask app to heroku?

potent trellis
#

Stupid question (I just don't know how to phrase it in Google): Can someone point me to the right resources if I would like to create a Django app that would have interactive element like when I program with JavaScript. For example,

function example() {
    $("id").innerText = "test";
} 

Or changing states or animation

stone dome
inland oak
wooden flower
modest swallow
#

anyone proficient with flask?

random pine
#

@native tide send ur code asap

#

and ping me when u sent

nimble dawn
#

How to position any content in css

#

Custom positions

charred berry
#

Can we test the facebook login api on other than the test users

nimble dawn
#

Like we have to write coordinates?

pseudo quartz
nimble dawn
#

Yeah

#

But it can set it right left center

pseudo quartz
#

text-alight: <position>;

nimble dawn
#

What is the position value

pseudo quartz
#

just like that

#

or left, right...

#

maybe you need to use div

nimble dawn
#

Ik that

#

But I don't want to set it too center or right or left

#

I want it to be customised

random pine
#

u can customize like this

#

and note it those are oppsoite in css if u make top 100% it will go bottom

#

like that

#

it is opposite in css

nimble dawn
#

Ok

#

Thanks

jade python
#

@modest swallow if you want to learn flask you could watch the video series by Tech With Tim

elder nebula
#

Have anyone done week view calendars in Django?

#

If there isn't one, maybe I have to create one myself using python datetime and calendar, but if there is that would be huge help.

native tide
#

hey guys i need some help ..so this is the view file as you can see i successfully stored the image url in the link variable

#

so how can i add the url of the image inside this html img src

#

so that the image can show in this page?

vestal hound
opaque rivet
nimble dawn
native tide
nimble dawn
#

Ohk

#

Nice

#

How are you thinking to write the details of the product

#

Specifications

native tide
# nimble dawn Specifications

using bs4 and html requests i can just find the div and class name of the description they are in(in the amazon website) so that i can print out the description of the prdct

nimble dawn
#

Ok

#

Your website ui is really very good

native tide
#

yeah i made it with the help of beddimcode youtube channel

dull wigeon
#

is there something like @login_required() to check if a user isnt logged in in django

inland oak
# dull wigeon is there something like @login_required() to check if a user isnt logged in in d...

there is always option to write own decorator, if you will not find how to do it properly
this one I wrote to check for super user rights for admin actions

@superuser_only
def make_saved(__, request, queryset):
    "admin action: save farhub table as json"
    save_serializer('json/farhub.json', 'json', queryset)
def is_superuser(request):
    "check if user has superuser rights"
    if json.dumps(request.user.is_superuser).lower() == 'true':
        return True
    return False

I guess you can check whatever request has, may be you have there user too
I wrote it a little bit horrible in term of checking for true, be sure to make it better)

worn mauve
#

Hi everyone—I'm new to django, long-time JS/Rails developer.

Is there a standard way of accessing a model instance from a Form subclass?

class RatePlanForm(OrgFormMixin, forms.ModelForm):
    cancelation_policies = forms.ModelMultipleChoiceField(
        # TODO Scope this to the current org
        queryset=Policies.all(),
        required=False,
        widget=forms.widgets.CheckboxSelectMultiple()
    )
class OrgFormMixin(object):
    def __init__(self, *args, **kwargs):
        self.request = kwargs.pop('request')
        self.org = kwargs.pop('org')

I want to scope Policies to something like org.policies, but not sure how to go about it

native tide
#

@nimble dawn

#

jjjjjjjjj

lavish prismBOT
#

:incoming_envelope: :ok_hand: applied mute to @native tide until 2021-04-24 13:26 (9 minutes and 59 seconds) (reason: duplicates rule: sent 4 duplicated messages in 10s).

worn mauve
# worn mauve Hi everyone—I'm new to django, long-time JS/Rails developer. Is there a standar...

It seems like I can do this by overriding the __init__on the form subclass and doing something like:

class RatePlanForm(OrgFormMixin, forms.ModelForm):
    def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)

        self.fields['cancelation_policies'] = forms.ModelMultipleChoiceField(
            queryset=self.org.policies.all(),
            required=False,
            widget=forms.widgets.CheckboxSelectMultiple()
        )
nimble dawn
jade lark
nimble dawn
native tide
#

you can download from git hub for free

#

modify it and you got yourself a webpage

#

responsive one

native tide
nimble dawn
#

Yeah but the result is also very good

native tide
#

so what r u working on ?

nimble dawn
#

I am creating a mobile website

#

It will show a phone with all its specifications

#

Phone at the center and around it squares will be there showing the features

#

First I was thinking to make card effects but it was very advanced for me and I didn't understand

#

Gradient background

native tide
native tide
nimble dawn
#

Yeah

#

But I haven't done anything yet😓

#

Except placing phone and meeting background colour

native tide
nimble dawn
#

You mean to update details from different websites?

#

I have learned basic python

#

After learning average web developing I will learn python

#

What is django used for?

native tide
nimble dawn
#

Ok

#

For what are you building this website

native tide
native tide
nimble dawn
#

Ok

native tide
#

if all goes well ...i will graduate

nimble dawn
#

You will

native tide
#

yeah maybe ...

#

the teachers are saying my project is so simple

#

and nothing interesting in there

#

all they care abt is work done in php

modest swallow
#

hey y'all

#

flask? pretty cool if you ask me

#

who's knowledgeable regarding it

nimble dawn
#
<!DOCTYPE html>
<html> 
    <h1 class="name">Realme 8 Pro</h1>
    <link rel="stylesheet" href="style.css">
    <body class="body">
        <div class="logo">
            <img src="https://www.starshopping.in/image/cache/catalog/r-228x228.png">
        </div>
        <div class="phone">
            <img src="https://cdn-files.kimovil.com/phone_front/0005/86/thumb_485898_phone_front_big.png">
        </div>
        <div class="camera">
            <h4>Camera</h4>
            
        </div>
    </body>
 </html>
#
.body {
    background: linear-gradient(to right, #9c279c, #8ecdff);
    
}
 .logo {
     margin-top: 1%;
     margin-bottom: auto;
     position: static;
 }


.phone {
    display: block;
  margin-left: 45%;
  margin-right: 50%;
  margin-top: 1%;
  
}

.name {
    text-align: center;
    font-family: sans-serif;
    color: #ffffff;
    margin-top: 20%;
    font-size: 5rem;
} 

.camera {
    width: 300px;
    border: 15px black;
    padding: 50px;
    margin: 20px;
    background-color:black;
}
#

the only thing it is doing is displaying logo phone image and model name

#

idk why it is not showing the box

#

no error is coming

frozen abyss
nimble dawn
#

.camera one

frozen abyss
#

Try 15px solid black;

nimble dawn
#

now it is coming

#

i didnt put the class name

past cipher
#

Can anyone see why my relationship isn't working:

class Inventory(db.Model):
    __tablename__ = 'inventory'
    id = db.Column(db.Integer, primary_key=True)
    inventory_id = db.Column(db.String(10), unique=True)
    tracking_number = db.Column(db.String(100), nullable=True)

    user_inventory = db.relationship('Ticket', backref='ticket_assigned_to', lazy=True, uselist=True)

class Ticket(db.Model):
    id = db.Column(db.Integer, primary_key=True)
    user_id = db.Column(db.Integer, db.ForeignKey('users.id'))
    user_inventory = db.Column(db.String(10), db.ForeignKey('inventory.inventory_id'))

t = Ticket().support_users_tickets()
    for i in t:
          print(i.user_inventory.tracking_number)

'str' object has no attribute 'tracking_number'

its not getting the relationship.

#

I have checked the database, and inside ticket, it has the correct inventory_id value

nimble dawn
#

Lol I don't even know one word of this

nimble dawn
#

I want to create a button that sends you to the particular part of the website

#

So I have to use anchor and href or anything else

charred berry
#

for borrower in Borrower.objects.all():
stid = borrower.student.id
bid = borrower.book.id
student1 = Student.objects.get(id=stid)
book1 = BookName.objects.get(id=bid)
if parse(borrower.return_date) <= timezone.now():
student1.total_books_due = F('student1.total_books_due') - 1
student1.save()
book1.available_copies = F('book1.available_copies') + 1
book1.save()
borrower.delete()

#

here why are the values of total books due and available copies not getting updated

#

also if i change the if condition to if True: it is working fine.

#

and there are no errors in the console

thin lichen
#

guys in which channel should i go for webscraping ?

native tide
thin lichen
#

ok, im trying to webscrape info from a json in a website but iget this exception raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

#

for some reason when i use json.loads(string) it just doesnt seem to work

native tide
charred berry
native tide
charred berry
#

if i just change the condition for if to be true its working fine else it just ignores the update code but deletes the borrower object. it's like skipping 4 lines of code while running

native tide
terse vapor
# past cipher Can anyone see why my relationship isn't working: ```py class Inventory(db.Mode...
class User(db.Model, UserMixin):
    __tablename__ = 'user'
    id = db.Column(db.Integer, primary_key=True)
    name = db.Column(db.String(20), unique=True, nullable=False)
    medicines = db.relationship('Medicine', backref='doctor', lazy=True)
class Medicine(db.Model): 
    __bind_key__ = 'medicine'
    __tablename__ = 'medecine'
    id = db.Column(db.Integer, primary_key=True) 
    user_id = db.Column(db.Integer, db.ForeignKey('user.id'), nullable=False) ```
This is mine and work fine
charred berry
#

so i think something in the sslserver package is interfering

native tide
potent trellis
#

Can someone point me to the right resources if I would like to create a Django app that would have interactive element like when I program with JavaScript. For example,

function example() {
    $("id").innerText = "test";
}

Or changing states or animation.
I am just not sure what to search to find a way to attach css and js to my html templates.

charred berry
jovial mist
#

Is it ok to store sensitive info in the session data?

dawn heath
#

is possible to add / setup django celery outside django proyect?

dull wigeon
#

how would i use a form to send data to an external database?

#

in django

vestal hound
#

like a 3rd-party API?

dull wigeon
#

one outside of the project

#

sql lite

vestal hound
#

well

#

it has to have some sort of interface

#

for you to interact with it

#

e.g. HTTP API

#

okay

#

how about you explain

#

what exactly your problem is

vestal hound
potent trellis
vestal hound
#

you can do whatever you would normally do

#

why?

dull wigeon
vestal hound
dull wigeon
#

becuase it is

vestal hound
vestal hound
potent trellis
vestal hound
#

but basicall

#

y

#

a Django template is just a HTML file with "holes" in it that a view will fill

#

it's more or less a big f-string

vestal hound
#

!e

from datetime import datetime, timedelta
print(datetime.now() > datetime.now() - timedelta(seconds=1))
print(datetime.now() > datetime.now() + timedelta(seconds=1))
lavish prismBOT
#

@vestal hound :white_check_mark: Your eval job has completed with return code 0.

001 | True
002 | False
potent trellis
#

I see, thanks @vestal hound !

vestal hound
digital mango
#

yo could i get some help for HTML & CSS?

#

so im using this site called codeacademy

#

Take a look at index.html. Cut the CSS code ruleset in between the opening and closing <style> tags and paste it directly into the file called style.css.

Delete the remaining <style> element (now empty) from index.html and press the Run button.

Hmm, the font changes didn’t take effect? Click the Next button to find out why.

inland oak
#

You can use inspect command, in order to re create classes of inspected db

#

You can use raw sql commands in order to go without classes
("INSERTI INTO...")

#

Basically... you aren't restricted by anything

dawn heath
nimble dawn
#

Try to write it inside body tag

#

In the image line there is no need of /

#

Bruh why have you written title inside head

white spruce
#

need some help

#
const UserProfile = {
    name: 'userprofile',
    template: `

    <div class="profilecard1">
        <img>
        <h1> Full Name </h1>
        <p> username</p>
        <p>bio</p>

        <p>email</p>
        <p>location</p>
        <p>joined</p>

  </div>
  
  <div>
  <h1> Cars Favorite <h1>
  </div>

  <div class="cars-favorite">
        <img src="./static/">

    
  </div>
    `
};

const NotFound = {
    name: 'NotFound',
    template: `
    <div>
        <h1>404 - Not Found</h1>
    </div>
    `,
    data() {
        return {}
    }
};

// Define Routes
const routes = [
    { path: "/", component: Home },
    { path: "/register", component: Register },
    { path: "/auth/login", component: Login },
    { path: "/cars", component: Cars },
    { path: "/upload", component: UploadForm },
    {
        path: "/users/{user_id}",
        component: UserProfile
    },
    // Put other routes here

    // This is a catch all route in case none of the above matches
    { path: '/:pathMatch(.*)*', name: 'not-found', component: NotFound }
];
#
app.component('app-header', {
    name: 'AppHeader',
    template: `
    <nav class="navbar navbar-expand-lg navbar-dark fixed-top">
      <a class="navbar-brand" href="#">United Auto Sales</a>
      <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
        <span class="navbar-toggler-icon"></span>
      </button>
    
      <div class="collapse navbar-collapse" id="navbarSupportedContent">
        <ul class="navbar-nav mr-auto">
        <li class="nav-item active">
            <router-link  to="/home" class="nav-link" to="/">Home <span class="sr-only">(current)</span></router-link>
        </li>
        <li class="nav-item active">
            <router-link to="/cars" class="nav-link">Add Car</router-link>
        </li>
        <li class="nav-item active">
            <router-link to="/profile" class="nav-link">My Profile</router-link>
        </li>

        </ul>

        <ul class="navbar-nav">

        <li class="nav-item active">
        <router-link to="/register" class="nav-link">Register</router-link>
        </li>
        <li class="nav-item active">
        <router-link to="/auth/login" class="nav-link">Login</router-link>
        </li>

        </ul>

      </div>
    </nav>
    `
});
#

can anyone tell me when profile route link not showing when I click it in the header

#

please need some help

charred berry
white spruce
#

@charred berry you see my issue?

charred berry
white spruce
#
{ path: "/profile", component: UserProfile }, ```
#

and still didn't work

#

@charred berry I did that and still nth

#

I am getting 404 not found

#

anyone can help?

charred berry
white spruce
#

it's not error, it's just returning ```js
const NotFound = {
name: 'NotFound',
template: <div> <h1>404 - Not Found</h1> </div> ,
data() {
return {}
}
};

#

@charred berry look at the code above

#

I want it to show UserProfile component

#

!paste

lavish prismBOT
#

Pasting large amounts of code

If your code is too long to fit in a codeblock in discord, you can paste your code here:
https://paste.pydis.com/

After pasting your code, save it by clicking the floppy disk icon in the top right, or by typing ctrl + S. After doing that, the URL should change. Copy the URL and post it here so others can see it.

white spruce
#

I want UserProfile component to show when I go to the router-link /profile

#

hope you see what I am saying

charred berry
white spruce
#

sigh

swift wren
#

hey guys, can somone help me with google maps api, i want to place a google maps window on my react page, currently the page is empty but i was wondering if somone could help me setup google maps api onto my react page

somber sierra
#

Hi guys, tell me how to transfer an image from Flask server via socket io to react. I have been struggling with the problem for a very long time, but the event is not sent from the server, and the client does not react in any way. It is possible that the server sends a picture, but react only catches promise pending...

somber sierra
#

okay, nevermind guys, have a good day 🙂

inland oak
tulip beacon
#

hey guys, anyone good at react?

white spruce
#
<div class = "card-body">
                <div class = "car-title">
                    <h3 id="title1">Car Title</h3>
                    <span id="price1" class="price-tag"> $356335 </span>
                </div>
                <p class="car-text">Huracan</p>
                <button type="button">View More Details</button>
            </div>
#

anyone css to get id=title1
and price1 next to each other?

fading cargo
white spruce
#

I want Car title and $356335 to be in the same line

#

but they are below each other

#

@fading cargo

fading cargo
#

for the parent div

#

you see the div element with the class ="car-title"

#

add this to it:

#

display: flex; justify-content: space-between;

#

update me if it worked or not

white spruce
#

okay

fading cargo
#

wait, instead of space-between put center, otherwise they'll be throwed to the edges of the parent div xD

white spruce
#

it worked, thanks. Is there a way to control the space

fading cargo
#

yes

#

you can simply google justify-content values css

#

here u go:

white spruce
#

I used space between because center moved the title away from the margin

fading cargo
#

wanna share screen ?

white spruce
#

sure

#

because I got another question to ask

marble spade
#
<div>
    <label for="toggle" class="hamburgerboi">&#9776;</label>
    <input type="checkbox" id="toggle" class="check_box_class">
</div>
#toggle:checked{
  background: red;
}

Why doesn't this work?

white spruce
#

Thank you @fading cargo for the great assistance, means a lot

opal robin
#

is it better to do the authentication process with django or react
bcs i used to work with a project with a couple of friends and we were using django and react but they decided to do the authentication with react and i don't know react so i was considering learning it

fading cargo
fading cargo
#

for authentication with react, you can do it through firebase (it's free till u reach a certain level) or you can do it by using local storage, so for example you get the logged in user object and keep it in the local storage and keep the token in the cookies

opal robin
#

i prefer django bcs i don't know react but my question is is the authentication usually done using django or react

tulip beacon
#

anyone good at react? I have a startup project to discuss about..If you are good at react dm me

fading cargo
#

using fire base for authentication will relief stress from the server since it's gonna happen through another API, but eventually if you have a new user signed in, you would want to keep a copy of his infos on ur database for sure

#

so even when your business grow you can use that data base for email marketing and so

opal robin
#

Ok thank you

fading cargo
vivid canopy
#

wo know flask?

#

who

fading cargo
opal robin
#

So react boosts performance?

vivid canopy
#

i know flask i want to ask

signal bronze
#

If i spent my time learning flask would i still need to learn js?

opal robin
vivid canopy
#

how i can to bring out user email in a page

fading cargo
#

so yes, ur app becomes better overall

opal robin
#

Thanks

fading cargo
#

long story short, flask is a framework, js is a language, 2 different things

signal bronze
fading cargo
swift wren
#

im using flask to process data that react frontend gathers such as registration and stuff

fading cargo
swift wren
#

not at all

#

they are just there

fading cargo
#

don't forget to do that, otherwise if i my self knew your API end point, i can see http requests using postman alone xD

#

i wont do that but i'm warning u on what people with bad intentions can do

swift wren
#

im still learning how to make the whole thing, im still a newbie to react, also i need to learn how to use sqlalchemy

fading cargo
#

that's a cool ORM

#

you are on the right path

#

i'm here to help, if anything just tag me

swift wren
#

are you good at js? cos i have a issue

#

im trying to use this mapbox module to get a mapview onto my browser and this is the error code

fading cargo
#

what kind of prob

swift wren
#
Uncaught Error: Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: undefined. You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.

Check the render method of `MapDisplayNoExtras`.
#

this is my code

#
/* eslint-disable no-unused-vars */
/* eslint-disable max-len */
/* eslint-disable linebreak-style */
/* eslint-disable require-jsdoc */
/* eslint-disable react/no-unescaped-entities */

import React from 'react';
import 'bootstrap/dist/css/bootstrap.min.css';
import ReactMapboxGl from 'react-mapbox-gl';
var Layer = ReactMapboxGl.Layer;
var Feature = ReactMapboxGl.Feature;
require('mapbox-gl/dist/mapbox-gl.css');

const Map = ReactMapboxGl(
    {
    accessToken: "pk.eyJ1IjoiMXJvaGFhbiIsImEiOiJja253eGlpNXcwdnNpMnVwajZsdzRlYXI5In0.vAECi86C5Szo-3R6SiQ0iw"  }
);

// eslint-disable-next-line require-jsdoc
export class MapDisplayNoExtras extends React.Component {
    

  // eslint-disable-next-line require-jsdoc
  render() {
    return (
      <div className="App">
        <header className="App-header">
        <Map
        style="mapbox://styles/mapbox/streets-v9"
        containerStyle={{
            height: '100vh',
            width: '100vw'
        }}
        >
        <Layer type="symbol" id="marker" layout={{ 'icon-image': 'marker-15' }}>
            <Feature coordinates={[-0.481747846041145, 51.3233379650232]} />
        </Layer>
        </Map>;
        </header>
      </div>
    );
  }
}
export default MapDisplayNoExtras;
#

idk why its telling me its not exported cos its clearly exported twice

#

because it successful for 1 second and then it throws the error

fading cargo
#

friend, why you exporting it twice ?

swift wren
#

to try to fix the export issue

fading cargo
#

you never export a class twice

#

i always do my classes as arrow functions, this class declaring is old meta

fading cargo
swift wren
#

nah i dont want to use hooks

fading cargo
#

ok just remove the export before the word class

#

and put require('mapbox-gl/dist/mapbox-gl.css'); before your variables declaration

#

and

#

const Map = ReactMapboxGl(
{
accessToken: "pk.eyJ1IjoiMXJvaGFhbiIsImEiOiJja253eGlpNXcwdnNpMnVwajZsdzRlYXI5In0.vAECi86C5Szo-3R6SiQ0iw" }
);

#

put it inside of your class

#

do so and update me plz

#

i'm sleeping in 5 minutes

#

@swift wren

swift wren
#

dude its fine im moving on from this, thanks for the advice tho

fading cargo
rotund token
#

Hello,
I'm Will and i'm making a custom keyboard and PC company and i need a person to help me design the website, all the HTML is complete and i just need you to design it for me.

DM ASAP

swift wren
#

i fixed it. but thank you broski

fading cargo
swift wren
#

no i had to refactor the whole thing

fading cargo
#

can you share the newer version

fading cargo
swift wren
#
/* eslint-disable no-unused-vars */
/* eslint-disable max-len */
/* eslint-disable linebreak-style */
/* eslint-disable require-jsdoc */
/* eslint-disable react/no-unescaped-entities */

import React from 'react';
import 'bootstrap/dist/css/bootstrap.min.css';
import ReactDOM from 'react-dom';
import mapboxgl from 'mapbox-gl/dist/mapbox-gl-csp';
// eslint-disable-next-line import/no-webpack-loader-syntax
import MapboxWorker from 'worker-loader!mapbox-gl/dist/mapbox-gl-csp-worker';
 
mapboxgl.workerClass = MapboxWorker;
mapboxgl.accessToken = "pk.eyJ1IjoiMXJvaGFhbiIsImEiOiJja253ejN0NHgwZjV6MnZuNHVuanJqa2xnIn0.Ls1HOpDT6fwneXOxetJYBw";

// eslint-disable-next-line require-jsdoc
class Map extends React.PureComponent {
    constructor(props) {
        super(props);
        this.state = {
            lng: -70.9,
            lat: 42.35,
            zoom: 9
        };
        this.mapContainer = React.createRef();
    }
    componentDidMount() {
        const { lng, lat, zoom } = this.state;
        const map = new mapboxgl.Map({
            container: this.mapContainer.current,
            style: 'mapbox://styles/mapbox/streets-v11',
            center: [lng, lat],
            zoom: zoom
        });
        
        map.on('move', () => {
            this.setState({
                lng: map.getCenter().lng.toFixed(4),
                lat: map.getCenter().lat.toFixed(4),
                zoom: map.getZoom().toFixed(2)
            });
        });
    }
    render() {
        const { lng, lat, zoom } = this.state;
        return (
                <div>
                <div className="sidebar">
                Longitude: {lng} | Latitude: {lat} | Zoom: {zoom}
                </div>
                <div ref={this.mapContainer} className="map-container" />
                </div>
            );
        }
    }
export default Map;
native tide
#

why i cant see border line with this ```css
table {
width:100%;
font-size: 20px;
}
table, th, td {
border: 1px solid black;
border-collapse: collapse;
}
th, td {
padding: 15px;
text-align: left;
}

fading cargo
#

z-index: 1;

#

in the second class

#

and update if it worked or not

limber laurel
#

Has anyone used put requests with django rest?

fading cargo
nimble dawn
fading cargo
limber laurel
#

I am having a pr9blem where it says method not allowed when I send a put requesy

fading cargo
limber laurel
#

Why not?

limber laurel
#

And if so how can I update through a post request?

opaque rivet
limber laurel
#

No

#

I dont have such decorator

#
class OptionViewSet(viewsets.ModelViewSet):
    queryset = Option.objects.all()
    serializer_class = OptionSerializer
    filter_backends = [DjangoFilterBackend]
    filterset_fields = ['question', 'correct']
    authentication_classes = [TokenAuthentication] # Autentifikācija ar token
    permission_classes = [IsAuthenticatedOrReadOnly] # Iespējams GET bes auth, bet POST nepieciešams auth

    def update(self, request, pk=None):
        pass
    def update(self, instance, validated_data):
        options_data = validated_data.pop('options')
        options = (instance.options).all()
        options = list(options)
        instance.q = validated_data.get('q', instance.q)
        instance.xtraInfo = validated_data.get('xtraInfo', instance.xtraInfo)
        instance.image = validated_data.get('image', instance.image)
        instance.save()

        for option_data in options_data:
            option = options.pop(0)
            option.choice_text = option_data.get('choice_text', option.choice_text)
            option.correct = option_data.get('correct', option.correct)
            option.save()
        return instance
wind walrus
#

To send an email to a mailing list do I use threading to send each person with TO instead of BCC?

limber laurel
#

The update is in the serializer class not viewset the second ine@opaque rivet

wind walrus
#

Since it’s IO bound?

opaque rivet
limber laurel
#

I dont have a seperate view except the viewset itself

#

So what you see there is all put if I call the update put instead nothing changes@opaque rivet

nimble dawn
#

It is literally so small

opaque rivet
opaque rivet
marble spade
#
<div class="Hamburger">
<input type="checkbox" class="check_box_class" id="hamburger_label">
<label class="hamburgerboi" for="hamburger_label">&#9776</label>
</div>
#hamburger_label:checked + li{
    color: green;
  }```
Why won't this work?
limber laurel
#

@opaque rivet will take a look a bit later, thanks, is it ok if I ping you then if I jave any questions?

fading cargo
fading cargo
opaque rivet
marble spade
#

@fading cargo ok well I am trying to make something show up when I click on a button

#

bsaically when I click on the button I want the color of the <li> to change to green

opaque rivet
#

which you have

marble spade
#

yes I can use it as a boolian

#

more or less

opaque rivet
#

but your label class is hamburgerboi.

#

Your CSS is accessing the ID hamburger_label

marble spade
#

so what should I do?

#

<input type="checkbox" class="check_box_class" id="hamburger_label"> Thats the important line

opaque rivet
#
input:checked + label {
  color: green
}

This should select all labels directly after checked inputs

marble spade
#

it only changes the colour of the class

#

it doesn't change the color of the <li>

opaque rivet
marble spade
#
<input type="checkbox" class="check_box_class" id="hamburger_label">
<label class="hamburgerboi" for="hamburger_label">&#9776</label>
</div>
<li>hi</li>```
fading cargo
# marble spade so what should I do?

if you go back to css selector basics, in your code you are selecting <li> element that is placed exactly the element that has ID hamburger_label when it's checked

#

here to select the li element you should go by div+li

marble spade
#

in the css?

fading cargo
#

yes, but u want it to change color only when the checkbox is ticked, i'm thinking of it, wait

marble spade
#

ok

opaque rivet
#
input:checked ~ li{
    color: green;
  }

So you want it just to change the color of the li?

marble spade
#

for now

opaque rivet
#

You can use this, it selects any li after your selected inputs, the + selector won't work in your original code because the + selector only selects elements which are placed directly below the input.

#

also your IDs are confusing. Don't give your input the id hamber_label when it's clearly not a label.

marble spade
#

and yes I know what you mean

#

I have weird names for classes xd

opaque rivet
marble spade
#

ah got it

#

thanks 🙂

green snow
#

how to increase the size of the calendar? this is html

#

<input type="date">

past cipher
#

So my app workings fine locally. however when deploying to Heroku and trying to login, I have a couple of issues.

Sometimes it gives me "invalid csrf token" even though its valid
sometimes it will login me in, send me to the dashboard, and return a 302 and send me back to the login page. I believe this is something to do with the login decorators? But it works fine locally.

Does anyone know why Heroku is giving me these issues?

native tide
vivid canopy
#

Who can help me with flask?

wheat skiff
#

hi, i really need help with building a chat app in django. i built already the site now i need to make the chat with socket or django channels. can some one help me with it?
im very new to django so it is very difficult for me to do this app
(i tried lots of tutorials but its hard for me to understand when i cant ask questions)

past cipher
dawn shard
#

what is command to start virtual env in django

green snow
#

workon

limber laurel
#

could anyone help me with this thing in heroku

#

I am trying to install their cli, but it keeps saying that it is getting blocked by the administrator

#

how can I fix this>

inland oak
#

it is not django tied command

#

python -m venv venv
python3 -m venv venv
(depended on which is your OS)

#

requires installed python3-venv

#

it is from standard python package I guess
if it is not there, it is installed with pip

wind walrus
#

source venv/bin/activate

to activate your virtual env after you create it

rare ibex
#

hello

#

so i tried creating this in django

#
def detail(request,question_id):
    try:
        question = Question.objects.get(pk=question_id)
    except Question.DoesNotExist:
        raise Http404("Question does not exist")
    return render(request, 'polls/detail.html', {'question': question})```
#

this is the detail view in my code but it doesnt output the error on the screen

#

can someone explain what im doing wrong here?

warm fossil
dawn shard
#

Why am I getting this kind of error?

#

Can anybody figure it out and help

inland oak