#web-development
2 messages · Page 98 of 1
is there any possible way to do with datetime ?
i think not because it stores time also but when you receive bet it's not the same time when you created it
class CreateBet(models.Model):
owner = models.ForeignKey(settings.AUTH_USER_MODEL,related_name="bets",null=True, on_delete=models.CASCADE)
bet_name= models.CharField(max_length=255)
amount = models.CharField(max_length=255)
scheduled_datetime = models.DateField()```
this model should work for you
but storing time is necessary for me .
then you should use the same time for getting data
ok I think I get it . Thank you for your time...
@outer pier i think you should use lte in query to get data
no problem
its still not working lte is having the value today andd previously created one
even gt is having the value today and upcoming one
Hey guys, i am really curious to know your thougts about these: https://carrot.io and https://twist.com.
Do you think it’s a growing market?
Do you find these kinda apps useful?
Thanks for any feedback in advance!
anyone know of a way of saying if the username is admin , they get access to the admin panel in flask?
currently with the "current_user.is_authenticated()" , everyone as long as they are logged in, get access to the admin panel.
But i want it that so if the username == admin, they get access, but only then.
is it good design to have a back button on page which takes user back to previous page or no?
If it just replicates the browser back button then no. Users already know about the browser back button, or if on mobile the swipe. So if the browser gives you this option, and the users know it exists already, then why include a redundant version of this.
oh
@outer pier use both lte & gte
@outer pier use lte with to today's datetime & gte with yesterday's datetime
@outer pier py def get_queryset(self): today = datetime.datetime.today() yesterday=today - datetime.timedelta(days = 1) return CreateBet.objects.filter(Q(scheduled_datetime__gte=yesterday) & Q(scheduled_datetime__lte=today))
thankz
def get_queryset(self):
def get_queryset(self):
today = datetime.date.today()
return CreateBet.objects.filter(Q(scheduled_datetime__gt=today)).exclude(scheduled_datetime__date=today)
worked for me
def get_queryset(self):
today = datetime.date.today()
return CreateBet.objects.filter(scheduled_datetime__date=today)
todays bet
anyway thanq so much @stable kite for the time
ok
@winter spindle go to their website, click on get font awesome
you'll probably have to enter your email id, and then get the cdn in your email
use it between <script> tags as you normally would
literally le first search I did led me to : https://www.bootstrapcdn.com/fontawesome/
https://stackpath.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css
bro what is tht kit
i dont use bootstarp
i like have a kit so should i copy its script ?
okya thanks i got it !
np :)
Has anyone ever submitted their Google OAuth App for verification?
If so, can you tell me about the process, what are the criteria that they check and all
Hi. Can anyone clear my doubt regarding Django and API call?
I am calling an API which will return data in JSON format, I am not planning to save any data into database. So should I make a model or directly render it on webpage?
@uneven radish why should yo make model if you don't want to store data in database
How to use List View then? Without model?
If I understand correctly, you can add the json data in your context in the view, and then display it in your template file.
Oh cool. Thanks. I'll try that.
@proud falcon NewsListView is missing a QuerySet. Define NewsListView.model, NewsListView.queryset, or override NewsListView.get_queryset().
This error is coming.
a listview is a generic view for listing objects (the ones from models.py), so I suggest you to switch to a TemplateView, which does not requires any model :)
Help pls, can anyone direct me to a newbie friendly framework for testing asynchronous requests? Fake responses, httpstatus codes etc?
hey guys i need to make a key value as a constant in my whole web application. how do i tackle this? i dont even know what to seach... im using flask, or you could give me something to search for or startwith
Help pls, can anyone direct me to a newbie friendly framework for testing asynchronous requests? Fake responses, httpstatus codes etc?
@high jacinth DRF it set up for doing this fairly well. Not sure if it meets your other criteria though.
How do I use Expires Headers in Flask?
@native tide DRF? What is that in full?
Django Rest Framework. I'm not on a work machine right now or I'd show you the default HTTP page you get when you set up an endpoint.
But look into it, its something you can add on to Django and makes serving an HTTP API very straight forward
If you're not already using Django it might be a bit more than you need
@high jacinth to test a framework receiving the requests or a framework to test the requests being sent?
A framework to test the requests im sending.
Ok
Lets say for example I wanted to check if my fetch function waits long enough before retrying, can I do that here?
Or if it reacts to a 404 the right way
err if you wanna do that just make a simple flask app
from flask import Flask
app = Flask(__name__)
@app.route("/")
def hello():
return "Hello World!"
if __name__ == "__main__":
app.run()```
Hey guys.. i have a problem related to django
I have a database in which date is stored.
I want to get that object whose date matches with today's date.
do you have some tutorial that shows how to connect your flask app on heroku to an S3 Bucket?
Hello, what icon would convey the message of terminate or fire.
Last time i found it so complicated, that i gave up and just made all data public and hardcoded the URL to the pictures in the s3 bucket
@devout coral prolly sth like https://www.flaticon.com/search?word=fire
But back to my Heroku / S3 problem: what is the correct way to do this?
I dont want to give up this time
@native tide As in like to fire an employee not fire itself i mean
@devout coral try this one: https://www.flaticon.com/svg/static/icons/svg/48/48052.svg
for real tho try sth like this: https://www.flaticon.com/search?search-type=icons&word=job+rejection&license=&color=&stroke=¤t_section=&author_id=&pack_id=&family_id=&style_id=&category_id=
@native tide That is great, just got to find it in font awesome.
Don't want to add another icon library just for one icon
you can simply take the svg code from flaticon for the single icon
dont need to implement the entire library
Finally done with the re design, any feedback?
maybe make that nav bar a bit easier to read / access
now everything else is more clean and smooth the nav seems a lil outa place
Ok cool
where is the button to fire the employee?
@native tide It is the running man 
There are titles on hover so there won't be any confusion
@quick cargo Should I just make the background a dark color or something?
you can
you can make that a theme though ig
so light or dark
i dont think it looks too bad as white
though maybe try a gradient background or something
not too drastic change but enough to make the boxes a lil more pronounced
Oh on the body backgorund?
@quick cargo How is this?
looks good
maybe move the nav text weighting to semibold which is like 500 weight if i remember
Here is 600 it was at 500.
look 👌
Should I make the "Title" bigger the thing that says "Division 12"?
can do yeah
@quick cargo Whhy is it that when I increase the text size of my title it also increases the image size?
if the image is set to fill how ever high it is then increasing the text size will increase the overall height
so maybe check what size the image scales to / is affected by
Here we go
On Django, If I'm logged in as a user, how do I have my input from user to a database table linked to my user logged in? Does it automatically do that or is there a way to have them linked?
A user can access the same specific set of info they inputted from the database.
You want to figure out who is logged in?
You can use permissions and in the views when you do your query for you data check for permissions?
How difficult would it be to make a search engine, that searches the internet ofc
@devout coral When the logged in user inputs information into the database, is there a key or something that links it with the user logged in? I will have to look more into permisisons I haven't used it yet I believe
a basic keyword search engine would be easy
https://www.postgresql.org/docs/10/datatype-textsearch.html
- crawling websites and getting meaningful data back is the hard part
Like to have the Users in the Authentication section (logged in), have their information linked with the input they put in to Usersinfo. From what I can tell there's no link that User put 'Example1' into Usersinfo
There should be a LogEntry when users update stuff.
Easiest way to check if it's a display problem or a model problem is peek around in your DB
@plucky tapir Not by default, You can add a one to one relationship
oh or is that just inside admin models?
Anyways, I have a Django auth flow question. I can't figure out the best way to do SAML auth.
The python-saml3 lib is great, but do I use a backend or setup an auth app basically?
The way is works is you redirect to your identify provider, auth, then POST redirect back with a signed SAML assertion which gets consumed by you, the service provider.
@devout coral I see thank you. I'm reading a bit on it and trying to sort the difference between a primary key (many to one) and one to one. For example, if a user will only have their own their expenses for budgeting inputted, that'd be a.....one to one?
what sort of table is Usersinfo?
If you've got user_id -> user_id, key, value on userinfo that'd be a one to many relationship
if you've got user_id -> user_id, extra1, extra2 that'd be one to one
@plucky tapir The different relationships will determine how two tables will interact with each other. One to one means only one object from one table can ralate to only one object in the other table. One to Many will be one object from one table can ralate to many objects in the other table
I am trying to overlay this img "On Hold" over the profile picture like you see above but I am getting that empty space where the "on hold" img was before doing the
position: relative;
top: -50%;
Is there any good way to do this properly? To note I am using bootstrap and the pictures are currently both in a col.
eh relative positioning will work fine
yo @topaz widget hmu whenever you got some time lol
@quick cargo It leaves that space tho.
If you look under the profile pic you can see the space
That's probably how your html is laid out
Make a div that is a relative box and then make the text absolute
So that the div contains both the image and the text
@winter spindle Link?
Well, I would center the main title horizontally first of all.
"don't just watch | learn"
Your vertical alignment needs some work, too.
I would put all the text in the main section in a container and make sure that container is centered vertically in the parent element.
You can play around with margins if it needs to be off-center vertically a little for balance (since the text on top is larger)
I would get rid of the Lorem ipsum text under the title. You should pretty much know what this is going to say.
I guess I don't know what's supposed to be in that block, but it looks like a sub-title or little blurb you should probably have a rough idea of what it should say.
All the letters in HTML should be the same case since it's an acronym.
all caps is best but sometimes you might do lowercase if all caps stands out too much.
Hey can anyone tell me how I can do some of those cool intro effects when the page first loads in
@winter spindle Change the font ASAP bro, and fix the spelling
Hey can anyone tell me how I can do some of those cool intro effects when the page first loads in
@twilit dagger got an example?
http://www.nycitimail.com/ @vestal hound Like when this page loads in
宝通信箱 Citimail Service NY 宝通信箱成立于1994年,位于纽约华埠包厘街112号。20多年来,我们致力于为大家提供专业的私人信箱出租服务。Mailbox rental in Manhattan
Someone asked me to make a site like this and it has these intro effects
Hi! Im working on a simple web app with python and django and i need to decide which frontend framework i will use, i have never worked with fronted libraries or frameworks before, which one is the most easy and quick to learn?
you don't have to use one
you can work without one, django has templating functionality too
but if I had to pick a framework, I'd pick Nuxt (based on Vue)
I think bootstrap can also be used
I mean if you're new to frontend, try using Bootstrap first with django
you don't necessarily have to use any front-end framework
Ok, thanks! I will try to use bootstrap
I picked up Angular first
it's kinda like Django in terms of design philosophy (opinionated)
Hello! I've been attempting login validation in flask against a hashed password (using from passlib.hash import sha256_crypt) that is stored inside a PostgreSQL database. While I am able to hash the password when it enters, I keep running into an error that reads TypeError: secret must be unicode or bytes, not wtforms.fields.simple.PasswordField whenever I attempt to check a users login password to the one stored in the database:
username = StringField('Username',
[validators.InputRequired(message="Username required")])
password = PasswordField('Password',
[validators.InputRequired(message="Password Required")])
def validate_username(self, username):
user_object = User.query.filter_by(username=username.data).first()
if user_object is None:
raise ValidationError("Username or password is incorrect.")
def validate_password(self, password):
hash_pass = sha256_crypt.verify(password, password)
if password != hash_pass:
raise ValidationError("Username or password is incorrect.")```
The way that it is placed into the database is by (this is in another .py file with the code around it omitted):
`name = form.name.data
username = form.username.data
password = sha256_crypt.encrypt(str(form.password.data))
registration_data = User(name,
username,
password)
db.session.add(registration_data)
db.session.commit()`
I've been attempting to try and solve this for a few weeks now and am at my wits end. I'm not sure if I am missing something blatantly obvious or if I set this all up wrong. If anyone has any suggestions or guidance to help me get on the right path, I would really appreciate it. Also, if I should have posted this in a python help room, I am extremely sorry for posting it here then.
@native tide just so you know, you can use three backticks for a code block
```py
code here
more code
```
becomes:
code here
more code
also, can you paste the full error traceback
my guess, though, is that this is the problem:
def validate_password(self, password):
hash_pass = sha256_crypt.verify(password, password)
if password != hash_pass:
raise ValidationError("Username or password is incorrect.")
I think you want password.data?
I have never used Flask, but judging by the text of the error and your validate_username method, I'm guessing password is the field object and you want password.data to extract the raw value from it.
Thanks for telling me how to do the code block, and I will get you the traceback in just one moment.
try what I said first though
Would that be on the second password in the verify section?
...both...?
I'll give it a try with each one then both together
actually
I think the way you're using it is wrong?
shouldn't you be pulling the password from the database
and doing it like
sha256_crypt.verify(password.data, password_from_database)
because the first argument is the raw password
and the second is the hash, right?
Yes, the first is raw with the second being hash
The documentation for passlib for sha256_crypt made it sound that I should do it this way.
where?
I'm looking at it
and it doesn't sound like that at all
>>> hash = sha256_crypt.hash("password")
>>> hash
'$5$rounds=80000$wnsT7Yr92oJoP28r$cKhJImk5mfuSKV9b3mumNzlbstFUplKtQXXMo4G6Ep5'
>>> # same, but with explict number of rounds
>>> sha256_crypt.using(rounds=12345).hash("password")
'$5$rounds=12345$q3hvJE5mn5jKRsW.$BbbYTFiaImz9rTy03GGi.Jf9YY5bmxN0LU3p3uI1iUB'
>>> # verify password
>>> sha256_crypt.verify("password", hash)
True
this is the example given in the documentation
it's pretty clear that the first argument is the plaintext and the second the hash
So my thought process was that I needed to put in what the field was called for where the entry would be entered, which in this case I named it password as it was the password field, for the hash section, I had it called password = sha256_crypt.encrypt(str(form.password.data)) which resulted in another password name (as a replacement to hash). So I thought for me to verify the results, I needed to do something along the lines of sha256_crypt.verify(password, password) since the first password would be the plain text answer along with the second password being there to replace hash.
I generally use bcrypt 
I don't really understand your thought process TBH
there is only one circumstance under which that would work
and that is when a password is its own hash
unless I have misread what you're saying
huh, why did you put the same variable twice
@native tide it should be py def validate_password(self, password): hash_pass = sha256_crypt.verify(password, password) if not hash_pass: raise ValidationError("Username or password is incorrect.")
huh, again
huh, why did you put the same variable twice
@marble carbon So when I was making the program, I ended up calling the index in my database as password which is the hashed value entering the database. Then when I was making the form... I for some reason named the form password as it was a password entry field. I can easily change the name of the one in the form though
yes, it returns a bool, but that's not the point
@native tide it should be
py def validate_password(self, password): hash_pass = sha256_crypt.verify(password, password) if not hash_pass: raise ValidationError("Username or password is incorrect.")
@stable kite the point is that you shouldn't be verifying the password against itself
ok
he should pass the password from validate username ()
you're just confusing yourself
I see only one issue here
@marble carbon also that apparentlypasswordis a field object
and not a string
at least, that's what I guessed from the error
That... is 100% most likely.
not being a Flask user
@marble carbon there are two issue
Thanks gm!
I'll give that a try @marble carbon
Hey does anyone know if chained comparisons are verboten in JavaScript?
Anyone know about the possibility of chained comparisons in JavaScript? Or do I need to use && ?
Can I do 5 < x < 10?
Are you sure?
you'll have to use &&
we can chain in python
huh
That's what I normally do, but I saw someone use the chained syntax in chat the other day.
but not in javascript
interesting
Cool, thanks for the clarification.
as far as i think so
I'm pretty sure it doesn't work in JS because I just tried to do a conditional ladder that failed with the chained syntax.
use '&&'
but I mean, i wouldn't personally use chained operations, might confuse others reading code
&& is more explicit
whats they?
chaining
i think no there are many languages that have chaninig
Mathematical syntax uses the chained syntax, so it's what's learned earlier in life typically.
@stable kite I gave that code block a try and TypeError: validate() missing 2 required positional arguments: 'username' and 'password' greeted me.
it's kinda like Django in terms of design philosophy (opinionated)
@vestal hound
Ok thank! But which one do you recommend on terms of easy to learn?
@marble carbon I changed the password in the validation form and the login for to login_password and the error disappeared, it doesn't log in if I use the wrong username, but I can log in if the username is correct and the password is wrong. But at least it's a step in the right direction! Though you mentioned bcrypt earlier, do you recommend I switch over to that salt and hash instead?
you have to pass two arguments that came from from your form that are username & password
I personally haven't worked with passlib, but have seen it mentioned in articles
@native tide ```py
class LoginForm(FlaskForm):
username = StringField('Username',
[validators.InputRequired(message="Username required")])
password = PasswordField('Password',
[validators.InputRequired(message="Password Required")])
def validate(self, ):
user_object = User.query.filter_by(username=self.username.data).first()
if user_object is None:
raise ValidationError("Username or password is incorrect.")
else:
hash_pass = sha256_crypt.verify(self.password, user_object.password)```
user_object.password
I take it that the userobjects.password is meant to be user_object.password?
yea
@native tide but why are you doing like so djano have in built method for authentication
@stable kite I was planning on learning Django, but a friend recommended I give Flask a try and now I am determined to solve this problem before moving onto Django.
[SQL: SELECT "user".id AS user_id, "user".name AS user_name, "user".username AS user_username, "user".password AS user_password
FROM "user"
WHERE "user".username = %(username_1)s
LIMIT %(param_1)s]
[parameters: {'username_1': <wtforms.fields.core.StringField object at 0x000001BAEB901E48>, 'param_1': 1}]
(Background on this error at: http://sqlalche.me/e/13/f405)```
I may try changing a few more things in my code to get this to work, such as organizing the code in a more... reader friendly fashion... But I really appreciate the attempts for help, I think I messed up quite a few steps back so I am going to go back to where I first hashed everything and see if I made an error back there in the end.
Looking for someone that I can work with to setup Flask-change-password module on my flask site. Please DM
@stable kite Sadly no luck, but it gave me an idea for how to solve it though. Thank you for the help!
ok
var div = document.getElementById("board")[0];
div.addEventListener('click',function(event) {});
});
error
: cannot read property addEventListener of undefined at html document
anyone got any idea what's wrong here
var div = document.getElementById("board")[0]; div.addEventListener('click',function(event) {}); });
@white spruce it should be var div = document.getElementById("board")
remove the 0
Are you saying that the element you are targeting is within a div?
yeah it can be done.
using xpath, or of its id of it has a unique one
what if it has no id
or I think using nth child too, but I don't know much about this method
This is my jquery code.I need javascript code to select nth child.Is it possible to select nth child using javascript
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min....
damn lucid been typing so long. I be wondering if he trying to help me
hey, this is my first time using jinja and I've run into a suuper weird problem... the page is displayed with all the css but when you delete the css files it still runs normally is this a common issue or do you have no idea what I'm talking about
dang
lol no sorry I'm a noob
@eager panther maybe your browser has cached the css?
you need to force reload your browser
ctrl shift r for Google Chrome i think
ohh okay lemme try that
that was such a simple solution lol but it worked thanks a ton!!
I am dynamically adding background colour to an input fields to indicate validation to the user upon form submission.. but the browser is overriding my background colour even when ! important is given.. help
hi guys, I'm setting up my first website but I can't seem to get the favicon.ico get actually displayed when i go to the website. I use Flask with templates and I tried putting the favicon inside the templates folder and the root directory, but it still doesn't seem to do the trick.
Any help will be appreciated
oh yeah by the way the website can be found on: https://matbitt.herokuapp.com
and yes i use heroku for this
the folder structure is like this:
I have collapsed the unnesecary ones
@real rain your favicon.ico is being displayed in your web page
Hey all, I have a question about apps.py for Django applications. Let's say I have two apps in my Django app, one for books and another for readers. Where do I put my apps.py? One in each of those directories?
fixed it! typo lol
as font awesome doesn't have discord icon how can I add it to a webpage?
@tender seal go to discord's branding page
huh wdym

it's there
can i change a model values accordingly when a specific field in another model changes in django ?
@outer pier yep, you can look at singals
https://docs.djangoproject.com/en/3.1/topics/signals/
Hello , I've been trying to host a web services with php and nginx docker , but after hosting , when I try to connect to the website , I get ,
Fatal error: Uncaught Error: Call to undefined function mysqli_connect() in /app/public/config.php:3 Stack trace: #0 /app/public/index.php(3): include() #1 {main} thrown in /app/public/config.php on line 3
here's the config.php
<?php
$conn = mysqli_connect(localhost, root, toor, tmp) ;
if(!$conn) {
die("Connection failed: " . mysqli_connect_error());
}
//echo "Conneted successfully";
?>```
here's the nginx dockerfile
FROM nginx:1.17.8-alpine
Copy the public directory
COPY ./public/ /app/public/
Copy the nginx config file
COPY ./docker/nginx/nginx.conf /etc/nginx/conf.d/default.conf```
is there a fix/workaround for this?
here's the php dockerfile ```yml
FROM php:7.4.3-fpm-alpine3.11
RUN apk add php-mysqli
Copy the php config file
COPY ./docker/php/php-fpm.conf /usr/local/etc/php-fpm.d/www.conf
Copy the application code
COPY . /app
VOLUME ["/app"]
If for example I have the following models:
class Author(models.Model):
name = models.CharField()
class Book(models.Model):
author = models.ForeignKey(Author, on_delete=CASCADE)
name = models.CharField()```
How can i make a rest serializer to show the author with books?
If for example I have the following models:
class Author(models.Model): name = models.CharField() class Book(models.Model): author = models.ForeignKey(Author, on_delete=CASCADE) name = models.CharField()``` How can i make a rest serializer to show the author with books?
@sullen basalt nested serializers
one serializer contains another
How redirect on django from the real root (not an apps root) to an application?
I mean like from localhost:8000/ to localhost:8000/home
@abstract kite thanq ... helped me
@vapid acorn can you explain a bit? Do you want an html button to redirect? or use python code?
How redirect on django from the real root (not an apps root) to an application?
I mean like fromlocalhost:8000/tolocalhost:8000/home
@vapid acorn create a new route in urls for''which will redirect tohome/
@versed python i meant like the website staring off at "home/"
@vapid acorn follow what thatrandomnpc said, but for production environments you'll have to look for more robust solutions, like configuring your apache or ngnix routing or something
ok
class TestViewSet(viewsets.ModelViewSet):
serializer_class = TestSerializer
queryset = Test.objects.last()``` Why does this result in 'AttributeError: 'Test' object has no attribute 'model''
Test.objects.last() will return a model instance not a queryset. @sullen basalt
So how do I do this then?
i dont remember tbh but maybe try queryset = [Test.objects.last(), ]
Results in: AttributeError: 'list' object has no attribute 'model'
show your test serializer
@sullen basalt try this py class TestViewSet(viewsets.ModelViewSet): serializer_class = TestSerializer queryset = Test.objects.all().last()
Does anyone knows a python lib that does query parsing ala github API ? a bit like this js project https://github.com/GitbookIO/filterable ?
my aim is to have my_api/search?water_level:<=5000&&color:=pink for example
pls ping me if you some suggestion
are you trying to get the 5000 and pink values?
if so, you can try this https://fastapi.tiangolo.com/
FastAPI framework, high performance, easy to learn, fast to code, ready for production
the 5000 and pink and the operator
we use a little flask app
so i can easily get stuff like field=value with request.args
i just want something more versatile
Hey guys, I needed a help in CSS
What I'm facing currently is : I've coded a website and now there's a scrollbar over the x-axis which is really looking bad.
I've tried *{ overflow : hidden} but it actually ruins a text effect I've used.
Surprisingly, the text effect isnt doing anything wrong coz I removed it from my project once and it did not affect anything which ensures that its completely fine.
I just spotted the problem (ig so) , whenever I do it width : 98 vw, it removes the scrollbar-x, but whenever i make it 100vw , it adds the scroll bar back
@gilded monolith I never head of an framework that has this '<' operator. But if FastAPI is the GOAT to builduing fast and scalable REST API
If you use bs4 like soup.find("div",attrs={"class":"row"}, will it also detect an element with the class "row header" ?
https://stackoverflow.com/questions/64280978/updating-a-model-with-respect-to-a-field-django
could anybody ans this question ?
I m doing a bet app and if the admin verify the screenshot sent by the won he will set the verified field to be true .
This is how both the models look like :
class ScreenshotVerification(models.Mo...
Hey, anyone here can assist with an onclick function?
I might be able to help - best to just post your question
So, it kinda does what I expect it to do, I mean, when you press it twice it eventually starts flicking between front of card and back of card
however, I was trying to get those divs on top of each other
hide the back when it's not being used
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.
how do I get the given arguments in Quart? (query string)
https://pgjones.gitlab.io/quart/reference/cheatsheet.html#request
check this @heady frigate
request.args.get("a") # Query string e.g. example.com/hello?a=2
this line
Thanks
Hey! What is the minimum time that i can learn enough javascript to implement it on a project with for example react
if you go as you learn?
just learn basic js and start with react
you will probably hate your life for the next few weeks, assuming you already don't, but you'll catch up soon
you will probably hate your life for the next few weeks, assuming you already don't, but you'll catch up soon
@versed python lol i will try with react if it's to difficult i will go with vue.js
Ok, yes , thinking that better, i think that i will go wih vue, because i have only a few weeks to build the project
How do you limit user uploaded file size depending on the page/context? Consider youtube where a user may need to upload multi-gigabyte video files, but when uploading a profile picture, there is no reason to allow the user to upload anything larger than a few megabytes. Is this handled on the web server side or the application side? Can the "over size" error occur immediatly, or do you need to wait until the user has already uploaded the maximum amount of data before triggering the error
can anyone think of a way to save any more space here? (save removing the indentation and newlines) ```html
<html>
<svg viewBox="0 0 10 5">
<path fill="#5BCEFA"d="M0 0h10v5H0z"/>
<path fill="#F5A9B8"d="M0 1h10v3H0z"/>
<path fill="#FFF"d="M0 2h10v1H0z"/>
</svg>
</html>
@lofty matrix if you're using django forms, then just use an appropriate validator to that field, django will take care of the rest
Hey guys, is there anyway to I run my discord bot inside my website that i made with django?
$(document).ready(function(){
if ($('.memorizePanel').length != 0) {
$('.flipCard').click(function(){
if ($('.cardFront').is(":visible") == true) {
$('.cardFront').hide();
$('.cardBack').show();
} else {
$('.cardFront').show();
$('.cardBack').hide();
}
});
}
});
I'm gonna update the divs to resemble this but here's the thing, I don't get where exactly I'm supposed to place card.back in my html
Do I need to repeat the code for the entire column?
I tried that earlier today and it just displays one under the other even though the button kinda worked.
{% extends "base.html" %}
{% block content %}
<div class="row memorizePanel">
<div class="cardFront">
<h3 class="text-center">{{ card.front }}</h3>
</div>
</div>
<div class="cardBack">
{{ card.back }}
</div>
<div class="row">
<a href="javascript:" class="btn btn-primary btn-lg flipCard">
Flip Card
</a>
</div>
{% endblock %}
issue is that both card.front and card.back are visible when the page is loaded, however, when you click the button it exhibits the expected behaviour
Ok, so like
if I add this line (line 2)
It works, but it loads it and then hides it -.-
I'm just fudging my way through this and it hurts me.
so like i can see the card.back very briefly then it just hides
I've updated styles.css to .cardBack: display: none; and this has not helped
Ok, it has, just needed to refresh with clearing cookies.
thank you for facilitating my internal monologue.
how do I get a div element to click only once in js? anyone?
?
@white spruce Quick google search, seems like using some jquery.
https://stackoverflow.com/questions/54726632/usin-jquery-how-to-make-an-element-clickable-only-once
In Django how should I best organize all my JS and JQuery? Currently I have everything inline and I know I should move it to external files but don't know a good way to organize it all.
static/js?
Yeah I have that now. BUt should I have one JS file per template?
Yeah I have that now. BUt should I have one JS file per template?
Hell, nah.
So one big JS file?
Don't repeat yourself.
Write reusable functions and share them, as much as possible.
I am saying for organization purposes
You can (and should) split them up in separate JS files...
But by functionality, not by template....
That was the question. Was not sure what others did. I know to re use functions.
So as if they were packages then?
So as if they were packages then?
Basically, yes. Hard to say without knowing anything about your project, but you could have e.g. a file with date functions, a file with text processing functions, a file for animations, etc.
To be honest all this JS is solving one or more specific problem for the template as opposed to like utility functions.
@lethal orbit Yeah I get that, but most of my functions are not general purpose use.
That is why I said by template
If it is highly template-specific, you can always keep it inline.
Like if you know it's not reused anywhere....
You can just stick a <script> tag in the template.
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
If it is not too large.
This is one of my functions, it is only really used for this template though. I do not need it elsewhere
well no need then
So leave that function inline.
Then when do I decide to move it to a separate JS file. Because technically if I need to use a function elsewhere or everywhere I could just but it in my base template. (which I had until a few minutes ago but not sure if that is the right choice lol)
My website here
has a few problems
for example when you try to reset your password
it will prompt for an email
And it should send you an email
but you get an error
Did you get an email!?
Hmmm... It is a bit long. Might not be a bad idea to separate it. I'd probably be lazy and just move it to a separate file, and just do <script>{% include "add_row.js" %}/<script> in my template lol
Then the file is cleaner while you edit, but you don't have to worry about serving it separately.
But I tend to use Django for APIs exclusively, so maybe not the best person to ask :p
O
@native tide I did not put an actual email.
<img src="gaming_Discord_logo.png" alt="DiscordImage"></img>
why is my image not showing upo
it's safe
Im using React JS btw
You should be
Hey all, for Django, is it better to use TemplateView.as_view or views.home for URL patterns?
@native tide I got an error now
Would it be faster to have 100 blueprints with 1 app.route or 1 blueprint with 100 app.routes? Flask
performance wise
can you send a screen shot plz @devout coral
@native tide
@glass badger You mean using a class based view vs a function based one?
oh my
You are using Django?
@devout coral yes exactly, class based vs function. Sorry didnt know how to word it
It is a preference thing tbh. I prefer function based views. But class based views can save you a lot of time, specially when paginating and filtering.
so class view for lets say a blog?
Class based views for a blog will probably make your life somewhat easier. A bit less code to write.
Do things conflict when I have a mix of URL patterns?
for static pages like about, home, keep things function based, then for the blog part, keep things class based?
It won't conflict.
But it might be easier to follow your code if you keep it consistent.
But even then, you should be fine in mixing it.
Ah documentation, lol. I need to get better at that .
No need for a different django app, just use different views.
Assuming they fit together.
Apps should be used to separate things logically.
You can have a home app, and an about app, but if they are small, don't rely on many models, etc. you can also keep them in a single core app or whatever.
awesome, understood
Matter of preference, really.
Any good way to go through a css file and Identify unused classes?
yes
https://unused-css.com/
Remove Unused CSS | UnusedCSS
Unused CSS is an online tool to remove unused CSS rules. It will check your pages, find unused CSS and let you download a clean CSS file.
https://web.dev/unused-css-rules/
Remove unused CSS - Web.dev
thats a good share.
like when in live preveiw i want a thin bllue border to appear but a highlighted region comes
@devout coral do you know how to use brackett
i will send you the problem
it is there on github and someone has asked it before
Could i get someone some help from someone who knows Django in #help-coconut ? I need help with something very trivial
@devout coral
ohh okayyyy !!
Which reminds me my license expires in 6 days
ohh okay 😂
http://127.0.0.1:8000/about/about/ has anyone had this happen before in django?
@glass badger What are your urls.py files in your project app and your app with your about page?
@glass badger By "project app", I mean the folder with asgi.py and wsgi.py in it.
Do I have the Django APPEND_SLASH behavior right?
I have this
urlpatterns = [
path('Shibboleth.sso/', views.sso_login, name='login'),
path('Shibboleth.sso/SAML2/POST', views.acs, name='acs'),
path('Shibboleth.sso/SLO/Redirect', views.sso_logout, name='logout'),
path('Shibboleth.sso/attrs/', views.attrs, name='attrs'),
path('Shibboleth.sso/metadata/', views.metadata, name='metadata')
]```
I can access acs, but get it gives me a redirect for logout ...
nvm, it was my browser redirect cache. 🙄
Shib is fun, it doesn't matter what* your AssertionConsumerService endpoint is as long as the Idp and SP metadata matches.
is it possible for the frontend to receive text data from the backend?
@jagged crater , I fixed it. the issue was i included include() to a url path twice.
thank you though for trying to help
@trail axle what do you mean by text data?
@trail axle of course, all requests are essentially text data
You can request whatever you'd like, JSON, HTML, XML god willing
albeit they have a definite structure, commonly json
normal text, i.e
Hello World!
sure it can
Set up a view that returns text as a response, make a fetch or XMLHttpRequest call.
it’s to write a web syntax highlighter without using too much js
yeah it can be done
Ah okay, you're returning preformatted text?
basically, yes.
it returns
<span class="keywordhighlight">keyword</span>
im new to web development kinda
know a little html a little css
but I mainly do python and mysql
is that kind of a bad way to do it?
nope it's completely fine
is the text itself highlighted on the server or client side?
it highlights the text the person is writing on a <div contenteditable>
you said you won't use js so it's server side i suppose
using innerHTML=highlightedText which comes from a replaced python string
@MrAwesomeRocks#9809, I fixed it. the issue was i includedinclude()to a url path twice.
@glass badger I assumed that was what happened, that's why I was asking for yoururls.pyfiles.
At least your website is working now 
Hello, friends. Im hoping someone can help me understand backend auth.
I am using graphql for an api with django. I Would like to use token authentication for this. There is no good token auth module specifically for what I am doing and I would really like to learn this stuff.
I currently have a system to create a jwt token and send it back to the user. As a temporary test, I am testing that the token is valid in the DB, but I understand this is not needed and is also bad.
Could someone point me in the direction on how to build an auth backend for an api?
I am used signing in to get a bearer and refresh token, then sending a header like {"Authorization": "bearer <token_here>"} to make an authenticated request, and refresh token to get a new bearer token. I am unsure on what this type of auth is called our how I can code it from scratch in my own app. Any help is greatly appreciated.
if you are using any sort of Javascript framework for your frontend, most of them have a module to handle authentication.
this is purely python client to a python server
I am more doing this for learning. I am have been reading articles for awhile and feel that I am stuck. I am unsure how I can use a token ONLY to authenticate a user, ensure proper permissions, and that the token is valid without a db query. But the articles I am reading say that is the main benefit of JWT: authentication without the need to check the db
or even store a token on the server
I have just gotten to the point where I am out of google search results, so I am totally lost haha. This is probably better for #cybersecurity actually
how are your users supposed to access that website? browser? curl?
well, using aiohttp, or any method really xD this is a backend for discord bot client.
upon a bit more thinking and help, I am understanding jwt a bit more, but I am still unsure how to implement the full backend for this.
there's a lot of packages for this django-simple-jwt is one,though I have never gotten it to work tbh. Maybe try using them instead of implementing your own backend?
Ty, there are some tools I saw. I am more doing this for learning purposes as I would like to understand more about how jwt works and auth as a whole.
implementing your own sounds like a big task, can't really help with that tbh. But if you make a github for it, hit me up, I'll try to contribute.
It is on github as part of the backend for my bot, I do not have a separate module for it though.
is it possible to chain together {% extend %} html files in django?
@glass badger I think you are looking for {% include "template_name.html" %} ?
yes, use margin-left and margin-right
on each of those boxes
btw, are you using flexbox or grid ?
div
box-sizing: border-box;
border:4px solid black;
width: 100px;
height: 100px;
display: inline-block;
padding: 10px;
text-align: center;
transition: 3s ease;
}
div:focus{
background-color: blue;
}
div:hover{
width: 200px;
border-radius: 200px;
background-color: orange;
}
.animate:hover{
transform: rotate(360deg);
background-color: pink;
width: 50px;
height:50px;
}```
html code
you can add margin on those divs and u will get spacing
ok
although, I would recommend you to look into flexbox, its really handy
box-sizing: border-box;
border:4px solid black;
width: 100px;
height: 100px;
display: inline-block;
padding: 10px;
text-align: center;
transition: 3s ease;
}
div:focus{
background-color: blue;
}
div:hover{
width: 200px;
border-radius: 200px;
background-color: orange;
}
.animate:hover{
transform: rotate(360deg);
background-color: pink;
width: 50px;
height:50px;
}```
css
ok i will try flex box
Check out my courses and become more creative!
https://developedbyed.com
Learn Flexbox In 20 Minutes | Learn HTML & CSS | Flexbox Tutorial
Today we are going to cover how to build modern responsive layouts using flexbox and all of its properties.
Going into 2019 flexbox wil...
👍
I learnt flex box from here hope this helps 🎀
Cool so ya i was working with flask on a web based card game kinda and i gave the css files and all but when i changed the css file, the changes were not made in the website
I googled this up and i saw that chrome caches the css file and js file so everytime i make a change in css i have to go to chrome settings and then clear the cache data everytime is there anyway i can fix this without having to clear cache data everytime
@ornate lotus ctrl-F5
Generic views are exactly that- generic views. Django provides views for very common problems, like rendering a list of your model instances from database. Or rendering a form.
okey, so if i have to create Contact page, where on GET i return page, on POST i get data from form (captcha,email,username,txt) and i send it through GMAIL and i save it to database
?
i should use generic or default
?
You should judge which view you want to use- for example if you need to display 2 forms with 1 FormView, that'd be difficult without tinkering. Then you should consider using fucntion based views (unless this DoubleFormView is to be used more than once, in which case you should create a mixin)
?
@valid prairie Generic View-FormView
Here's an example if you want one https://github.com/IgnisDa/ocean-pv/blob/master/home/views.py#L18
Yeah most of the views are common enough, so django already provides them
If you want to use django's inbuilt form verification then yeah. Otherwise your HTML form is okay too
But then you won't be able to use FormView
okey, ill do that
Does anyone know if a website GUI is possible to be tied into Discord? Like, a GUI app for a Discord bot is possible... but what about through a website?
what would be the best way to encrypt database fields and documents/photos with django & drf?
@stable kite has a package for that
for my documents i use a FileField I do not see that being supported by Django-CryptographicFields
Hey guys, do you think that i can use vanilla javascript for a project? It is a notes app where you can save them, and i don't know javascript so i need to start learning, would i need to use some library like vue or react?
And, because i'm very new to fronted libraries, what does libraries like vue.js used for?
@ionic idol try this i have created a package for cryptography in django https://pypi.org/project/Django-CryptographicFields/
@ionic idol i think as File Fields just store your URL for the file so you can use URL field for that
https://codepen.io/pixskull/pen/myPGpm Can someone send me a codepen like this but with a change effect?
i create server client model i need to display client info on html page i am using sockets for my model , so can i display my client info on html page if i am using sockets?
@glad patrol which framework are you using?
simple html
are you storing data in database?
I think you should store your data somewhere & then render it in html
@stable kite thank you
i got you so it is possible to that i can dispaly my client data on html if i use socket right
@ionic idol for what?
@ionic idol i think as File Fields just store your URL for the file so you can use URL field for that
@stable kite this
@glad patrol i don't think socket is the best way for sending data to html
Can anyone recommend a good Django model template for a blog?
@ionic idol are you using my package?
not yet but i'm considering using it
@stable kite i already create server client model using socket now i want to display it on web , please suggest me what can i do .
@ionic idol ok please share you views about it and create issue on github if you feel so
@glad patrol i think you should create a web socket to share data between html & python
use js for web socket
is there any darag and drop html page generateor
@ionic idol use the package from starting in production otherwise it will raise an error
hii guys is it possible to update the unfilled fields of existing model when somebody hit another url
using serializer
hey guys, when do you think that is the right time to setup firebase(the database and the storage) with django? i mean after making the views or before
@outer pier using update method
I tried it but not working in my case
I am trying to add to this
model:
class CreateBet(models.Model):
owner = models.ForeignKey(settings.AUTH_USER_MODEL,related_name="bets",null=True, on_delete=models.CASCADE)
bet_name= models.CharField(max_length=255)
amount = models.CharField(max_length=255)
scheduled_datetime = models.DateTimeField(null=True,blank=True)
accepted_user = models.ForeignKey(settings.AUTH_USER_MODEL,on_delete=models.SET_NULL,related_name="accept",null=True)
status = models.BooleanField(default=False)
the other fields are already created whenever a user hit a url but whenever I try to accept bet with some another url all I want is to update accepted_user and status field .
if somebody knows the ans pls let me know . Thanq in advance
since I want to serialize the the data I have to use serializer and viewset in drf
this is all i wanted
class AcceptBetSerializer(serializers.ModelSerializer):
bet = BetCreateSerializer(many = True , read_only= True)
class Meta:
model = CreateBet
fields ='__all__'
# def update(self, instance, validated_data):
# id = validated_data.pop('id')
# object = CreateBet.objects.get(id=id)
# object.save(status=True)
this is all i tried
class AcceptBetSerializer(serializers.ModelSerializer):
bet = BetCreateSerializer(many = True , read_only= True)
class Meta:
model = CreateBet
fields ='__all__'
# def update(self, instance, validated_data):
# id = validated_data.pop('id')
# object = CreateBet.objects.get(id=id)
# object.save(status=True)
@outer pier this is serializes This will not update your database
@outer pier you need to create a view for it
@outer pier it should not be read-only
@stable kite
class AcceptBetViewset(viewsets.ModelViewSet):
serializer_class = AcceptBetSerializer
permission_classes = [permissions.IsAuthenticated]
def perform_create(self,serializer):
print('hii')
serializer.save(accepted_user = self.request.user,status=True)
def get_queryset(self):
return CreateBet.objects.filter(accepted_user=self.request.user)
have already created the view
@outer pier https://www.youtube.com/watch?v=7Kdvc8yG7bM
Thanks for watching.
Do not forget to leave a comment below.
your feedback is very important for me.
Please like and share share this video with your friends to spread the knowledge with others.
Subscribe VFX Pipeline on YouTube
https://www.youtube.com/vfxpipeline
Like VFX P...
check this out
it will help you
lemme check thanq ..
How do I make one of those buttons which changes the section under it depending on which button is clicked
Like if I have three buttons - Html, CSS, JS then clicking on the Html button which display Html under it, clicking CSS will display Css under it and so on
Sort of like this - https://codepen.io/pixskull/pen/myPGpm
Why is it not loading the render?
@twilit dagger https://github.com/IgnisDa/ocean-pv/blob/master/graphs/templates/graphs/multiple_results.html#L74
https://github.com/IgnisDa/ocean-pv/blob/master/graphs/templates/graphs/multiple_results.html#L98
The first element is the button that will trigger the change, and the function is the one that changes the content
@stable kite that was all I wanted thanq for your help
but lemme ask a dbt . If I use put this way then couldnt the user get the data and manipulated. ?
hello gentle people
i would like to inquire about methodology, the best methodology to construct the back end system of a 'next' feature which queries a sqlite database for another random row in the same table
two things
- should i create a
@app_route('/next')or can i do something more intelligent to display it in place in the same html page - how can i stop it from displaying the previous row again, since this is random, be aware i do have access to the current object as i am displaying it
any tips/hints/help would be much appreciated.
let me know if i've explained this question horribly
the current random object is displayed via a sqlite query in the app_route function definition, then is passed to the front end, if you will.
You asked for my two cents. I would suggest examining other similar projects to determine their approaches to solving this type of problem.
Compare, and see which, if any, suits you best.
thank you for your input, the only issue i have with it is that
often times one functionality is deeply tied into another piece of functionality
and it's a little tough to decipher / amend my code to do so entirely to replicate their methodology
When in doubt, I read over the PEP documents. They often provide brain/logic untangling wisdom.
Hello Everyone
Hi, I'm so beginner, in fact, I just started, however, when I do python manage.py startapp app-name I get:
File "manage.py", line 22, in <module>
main()
File "manage.py", line 18, in main
execute_from_command_line(sys.argv)
File "C:\Users\Admin\anaconda3\lib\site-packages\django\core\management\__init__.py", line 381, in execute_from_command_line
utility.execute()
File "C:\Users\Admin\anaconda3\lib\site-packages\django\core\management\__init__.py", line 375, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "C:\Users\Admin\anaconda3\lib\site-packages\django\core\management\base.py", line 336, in run_from_argv
connections.close_all()
File "C:\Users\Admin\anaconda3\lib\site-packages\django\db\utils.py", line 224, in close_all
connection.close()
File "C:\Users\Admin\anaconda3\lib\site-packages\django\db\backends\sqlite3\base.py", line 248, in close
if not self.is_in_memory_db():
File "C:\Users\Admin\anaconda3\lib\site-packages\django\db\backends\sqlite3\base.py", line 367, in is_in_memory_db
return self.creation.is_in_memory_db(self.settings_dict['NAME'])
File "C:\Users\Admin\anaconda3\lib\site-packages\django\db\backends\sqlite3\creation.py", line 12, in is_in_memory_db
return database_name == ':memory:' or 'mode=memory' in database_name
TypeError: argument of type 'WindowsPath' is not iterable
hmmmm, did you edit DATABASES in settings.py?
Why would I?
you would just do that to change your DB settings
so you should NOT edit it after creating a project if you just want a basic project
I have the default settings.py, but like, what does db does with startapp?
so you should NOT edit it after creating a project if you just want a basic project
@acoustic oyster I didn't edit a thing
ok, hmmmm
maybe try to python manage.py makemigrations and python manage.py migrate?
oh, make sure django is installed and you are in the virtual environment with your django install
that can cause this issue
sorry I went afk
I changed my editor
However, now when I do django-admin startproject project-name I get 'djagno-admin' is not recognized as an internal or external command, operable program or batch file.
Even tho I have django installed
@brisk wadi you're probably in the wrong directory
guys how would i go about counting the amount of a certain model i have
Has anyone implemented Blockchain with Python on Windows OS ?
Getting error while installing web3 on Windows
@brisk wadi activate your virtual environment buddy
OK, is
from django.urls import path
same as
from django.conf.urls import url
?
@brisk wadi older version of django uses url latest versions uses path and you cant use usl
how do i count the number of times an object is assigned to a manytomany field
@brisk wadi older version of django uses url latest versions uses path and you cant use usl
ok, but I noticed that the old one uses a regular expression
Can i make a aimbot with python?
we're not gonna help with that
@brisk wadi indeed
Can someone help me with a web dashboard for discord bot?
many people here can, just ask any specific questions you have
Anyone know how i can make similar to this?
it is card view, but i dont know how to get this layout
i will do with boostrap card view
if you know some css it shouldn't be too hard to recreate
can someone help me with the post save reciever on django
what is a deferred attribute
code?
@receiver(post_save, sender=Rant)
def postSaveUpdate(sender, instance, **kwargs):
print("joe nuts",instance)
for cateogry in instance.categories.all():
#category.count+=1
print(category.name)
#category.save()
the print returns this "<django.db.models.query_utils.DeferredAttribute object at 0x0000022F3564B808>"
huh
i have found no information of this
so basically im trying to add categories to a blog post and every time i add a category to blog i want the count value to increase
so i know the total number of blogs under that catgory
the blog model has a manytomany field with the another model object called category
each category has a count which is an integerField
and after i save a post i want all the categories in that manytomany field to be updated
what...no
you don't need a field to save the number of posts under a category
Post.objects.filter(category=cat).count()
ez
or using a related name
Category.objects.get(pk=5).posts.count()
anyone?
??
@halcyon palm , I am asking what else do I need to add to the javascript to get the 9 grids to show after click
class SnippetSerializer(serializers.ModelSerializer):
class Meta:
model = Snippet
fields = ['id', 'title', 'code', 'linenos', 'language', 'style']```
Hi guys I'm readying about DRF, but I don't understand what the class Meta does... can anybody explain this please?
Oh I guess it stands for the "metadata" of an object in that class
So within the parent class, you can have multiple subclasses. but the Meta class has metadata such as the fields etc... so if you had an object, x, you could do x.Meta.info for the required info... cool
Can anybody build on this?
Hey guys I am trying to log into a Google account with Python and I have tried using automation frameworks like Selenium but Google detects that and kicks me out. Would it be possible to use an App Password and log in that way? I have found some articles about loging into Gmail but nothing about a general Google account
don't think anyone is really available in web dev today
Where else should I try asking?
not sure just hope someone comes to answer your question
yeah me too, I've been hacking at this nonstop for like a week
You hack? and what?
Sorry its a phrase used around where I am, it just means working on it
No I am a system admin so my tools revolve around that
Oh that sounds really cool
can i have the admin pannel?
XD
Do you have a admin pannel?
Lol I have a couple
So within the parent class, you can have multiple subclasses. but the
Metaclass has metadata such as the fields etc... so if you had an object, x, you could do x.Meta.info for the required info... cool
@native tide https://stackoverflow.com/a/10344231
@harsh sigil what are you trying to achieve?
@harsh sigil what are you trying to achieve?
I have a website that is hidden behind a google account login prompt. I need to be able to log into a google account
Send me the link
oww
oww
Unfortunetly I am not sharing a clients URL. It is not important anyways. I am trying to get through the Google account log in page.
hmm fair enough
Hack them
rn
Share your videos with friends, family, and the world.
Here is a link to the log in page. I need to type in a email, go to the next page type in a password, and submit them
xss the site why not
Google does not allow that, so I need to find a way around it
yep, google won't allow that
5. Do not provide or request help on projects that may break laws, breach terms of services, be considered malicious or inappropriate. Do not help with ongoing exams. Do not provide or request solutions for graded assignments, although general guidance is okay.
python can xss right?
sorry
did i break a rule sorry if i did
no I mean not yet
but if we proceed further we will breaking it
want to procced?
I am willing to use their API or I was reading about "App Passwords" but cannot find an example using them outside of sending emails with gmail. I have also tried seeding chrome with user data with --user-data-dir and it works great if I type the command in manually but it still detects the automation controlling the browser and kicks me back out when using Python
i said xss the site
@halcyon palm not like xss on Google would work
want to procced?
@halcyon palm no
it was a joke
I am not going to hack Google. Even if that was possible this is a commercial product for a paying customer and I am not exactly in the business of selling exploits.
Should i try to hack roblox?
bro... please, if a mod sees u talking about this ur banned, don't joke around like that @halcyon palm
OHH
ok i will not hack roblox
i was just asking ok
plus that would take years
and i would not have the tim e
and i would need a team
@harsh sigil u only want the login?
@marble carbon yeah after I get passed the google log in prompt I am able to just use Selenium or some other testing framework for the website
is that ok to do?
So the website is only using google login, not the regular one?
Lets go i made a box
uh I'm not 100% sure what your asking, but its the same prompt you would use for gmail or youtube or something?
my box looking so poggers
Yes?
....
anyone here as yet that can help?
anyone here as yet that can help?
@white spruce just ask ur question
I can try to help
What do you need?
or do you want to help?
@marble carbon I asked about a hour ago, but because I never got a respond I was just wondering
making a spam bot https://www.playstation.com/en-us/
var btn;
var container;
window.addEventListener('load', () => {
btn = document.querySelector('.btn');
btn.addEventListener('click', e => {
e.preventDefault();
container = document.getElementById('board').className="square";
console.log(container);
})
});
What is it for?
Did you put the dots in right?
since you going a way
and cap them right?
SQL a tictactoe
tehe
uh I'm not 100% sure what your asking, but its the same prompt you would use for gmail or youtube or something?
@harsh sigil ur question isn't really web development specific, if ur Willing to go through the app password and API route, and not breaking ToS try opening a help channel, #❓|how-to-get-help
since you going a way
@white spruce be back in 5 mins
@marble carbon you dm'ed or should i ?
@marble carbon Okay I will move my question there. Thank you
[] POGGERS phone
I got these divs ```
<body>
<h1>Tic <span>-Tac-</span> Toe</h1>
<div id="game">
<div id="status">Move your mouse over a square and click to play an X or an O.</div>
<div id="board">
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
</div>
<div class="controls">
<button class="btn">New Game</button>
</div>
</div>
</body>
I am trying to get these divs into a 9 grid cell for tic tac toe, when I press the btn element. So what I am doing is trying to add the square class from my css to all these divs in javascript, but it seems to only be adding to the board div. Here is my javascript so far. Would this work and what would I need to add to my EventListener?
var btn;
var container;
window.addEventListener('load', () => {
btn = document.querySelector('.btn');
btn.addEventListener('click', e => {
e.preventDefault();
container = document.querySelectorAll('board').className="square";
console.log(container);
})
});
Here is my square css class and board
#board {
display: grid;
grid-template-columns: repeat(3, 150px);
grid-gap: 20px;
}
.square {
background: white;
border: 1px solid var(--grey);
box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
border-radius: 10px;
width: 150px;
height: 150px;
font-size: 96px;
font-weight: bold;
display: flex;
justify-content: center;
align-items: center;
}
Add comments so i can read it lol
#this is a box
yoo why mute me
who tf di tha
Let me go raid a furry server
peacea
Lol what?
finally
!tempmute 753791188527743017 3d making completely irrelevant comments in an on-topic channel, saying they're going to make a spam bot, among other nonsense
:incoming_envelope: :ok_hand: applied mute to @halcyon palm until 2020-10-14 00:58 (2 days and 23 hours).
im 13
@halcyon palm we know
thanks
okay so did u post ur question completely should I read it?
yeah it's complete
I am trying to add the square style to the divs after I click the button that way the 9 grid cells can show up
that's what I am trying to do, hope you understand
because the squares has what the cells should look like to play the game
hmm
I have tried all the stuff I know and the square class just will not add to the divs
the most I got it added to was the board using getElementId
and that does not work correctly
okay what if
u added a placeholder class to all those divs and selected then using that placeholder class instead
oh keep in mind, the css nor html can be touched
only allowed to use javascript
if I could have touch the html and css
I would have been fix this lol
Ow
I have tried ```
querySelectorAll('#board>div').className="square";
thought that would work but nth
i got it in my notes, i'll check on it
it's a lab to get our practice
but he wants to see it
you can't help me?
I don't see how to use the for loop
okay if it's for practice
but ofc it's gonna be graded
what
the children
exactly man
that's why I am here now
I tried everything I know
was hoping someone could help me fix what I got
been stuck at this point for hours man
@marble carbon you mind writing inside my code I showed you
I am getting an error still
what exactly are we putting in for each
Okay so
querySelectorAll returns the list of all elements
what you're doing won't work
so that list of elements is an array
I told you, you can use forEach to loop through that array
and do what u want
I Can't give u exact code because
!rule 5
5. Do not provide or request help on projects that may break laws, breach terms of services, be considered malicious or inappropriate. Do not help with ongoing exams. Do not provide or request solutions for graded assignments, although general guidance is okay.