inchidi
Maz
Is it possible to protect just one app from unauthorirized acess? How do I achieve this? Protecting views doesn't achieve my objective.
Mounikesh
create a model serialize it and add permissions
Maz
No, I mean...the user is already an administrator. But I didn't want them to use the main django admin board. Each user is an administrator of an institution. So I created a separate app from which they can manage their tasks from. Problem is, how do I restrict access to this app and its routes to only the admins of that institution? i.e. admins should not be able to see the data from other institutions of which they are not a part..?
Maz
The task didn't involve creating an API
Maz
e.g admin from school A should not be able to see tasks from school B.
Robert
e.g admin from school A should not be able to see tasks from school B.
I haven't tried it, but maybe this can help. https://books.agiliq.com/projects/django-multi-tenant/en/latest/
Mirco
Yeah I was thinking of the same thing...
Have a try You can try to restrict access using group permissions if I don't go wrong
Mounikesh
does anyone have any idea of using facebook graph api
Mounikesh
inchidi
Yeah I was thinking of the same thing...
actually filtering and permission is the answer. but if you think those not enough then deploy the app as many web app
inchidi
thanks bro
you're welcome
Anonymous
Hi, I came again :) I'm developing django project api base -> django rest framework I wrote a model that has two ForeignKey first to a user and second to a category I wrote Category model also with one field that name is title and it's CharField now I want to wrote this in my serializer like this: category = serializers.CharField(source='category.id', read_only=True) now i got this error: django.db.utils.IntegrityError: NOT NULL constraint failed: websiteApi_userfile.category_id I searched a lot but i didn't find any right answer for my problem thank you for your helping
Mounikesh
may be you need to add null =True &blank =True in yor django models
Maz
Have a try You can try to restrict access using group permissions if I don't go wrong
It's possible to specify permissions to a single app, right?
Anonymous
i have faced this issue once but i dont remember how i solved it
oh men no :( please try to remember ... come on puuuush XD
Anonymous
haha trying to remeber
😍 thank you ❤️
Anonymous
did you try this
yes i tried this but when i sent data no category set to my instance :(
Anonymous
and also i need that is sure my first model have a category
Anonymous
😐 sorry for my bad english, it's not my native language
Anonymous
Mirco
Oh, like school=User.request.get(school=school.id)
You have the user instance into request.user So you can get the school filtering by request.user.id
Anonymous
remove blank = True and rry again
ooom i tried this but as i said my instance category is null :(
Anonymous
Ok, I created my REST API and have tested it through POSTMAN, how do I connect it to the website am creating?
Anonymous
No just HTML, CSS, JavaScript
Anonymous
Guys, i need ideas and advice
Anonymous
I need a fintech solution... It is for a hackathon
Anonymous
I need idea on what to demo for a meetup I have with beginner and intermediate programmers on Saturday🤔
Mirco
No just HTML, CSS, JavaScript
You can use Ajax to call your APIs
Karim Norman
Aws ask me an expiration date in this format: The expiration element specifies the expiration date and time of the POST policy in ISO8601 GMT date format. For example, 2013-08-01T12:00:00.000Z specifies that the POST policy is not valid after midnight GMT on August 1, 2013. I run this, but is not the same datetime.datetime.utcnow().isoformat() '2018-07-18T01:12:47.432459' What that Z means at the end of the string? How I can format the string as AWS request me?
Code9
Roughly equals to UTC +0
Karim Norman
thanks, I didn't know that
Django Bot
>> Links - tutorial.djangogirls.org
Mirco
Do you have two <input> tags in your template with name attribute set to myfile ?
ʚɞÇherry Łoveʚɞ
your code ?
Anonymous
your code ?
where part you want???
ʚɞÇherry Łoveʚɞ
where part you want???
/AdultContentDetection part
Mounikesh
post the code
Anonymous
/AdultContentDetection part
it is a ai app do u want it views?
Anonymous
post the code
def upload_image(request): if request.method == 'POST' and request.FILES['myfile']: print('######################') myfile = request.FILES['myfile'] fs = FileSystemStorage() filename=fs.save(myfile.name, myfile) strat_time=time.time() uploaded_file_url = fs.url(filename) temp_file = os.path.join(BASE_DIR ,str(filename)) my_pridict= test_app(temp_file) print(my_pridict) print(time.time()-strat_time) return render(request, '../templates/upload_image.html', { 'uploaded_file_url': uploaded_file_url, 'my_pridict':my_pridict },) return render(request, '../templates/upload_image.html')
Anonymous
try to print request.FILES
<MultiValueDict: {}>
ʚɞÇherry Łoveʚɞ
<MultiValueDict: {}>
yes. show you input wrong file input. it's not myfile
ʚɞÇherry Łoveʚɞ
can i see your html code ?
Anonymous
YES I SEND IT
ʚɞÇherry Łoveʚɞ
use pastebin pls
Mirco
Check your template code and the name you've given to name attribute of your input file tag
Anonymous
use pastebin pls
<div class="container"> <form id="contact" action="" method="post"> <h3>آپلود تصاویر</h3> <div id="thumbnail"></div> <fieldset> <input type="file" name="myfile" id="file" required> </fieldset> <fieldset> <button name="submit" type="submit" id="contact-submit">آپلود</button> </fieldset> </form> </div>
Anonymous
use pastebin pls
https://pastebin.com/????
Anonymous
this is limited in my location
ʚɞÇherry Łoveʚɞ
ok.
ʚɞÇherry Łoveʚɞ
from officical document : FILES will only contain data if the request method was POST and the <form> that posted to the request had enctype="multipart/form-data". Otherwise, FILES will be a blank dictionary-like object.
Anonymous
ok.
excuse me dear @hahungkk
Mirco
excuse me dear @hahungkk
You've missed enctype as @hahungkk has said
Anonymous
let me i try it
ʚɞÇherry Łoveʚɞ
let me i try it
does it worked ?
Anonymous
does it worked ?
yes thank you and thank from all dear mmebers that try to help
Mirco
syam
anyone having issues while compiling python 3.7 from source
ʚɞÇherry Łoveʚɞ
syam
just for the fun of it
ʚɞÇherry Łoveʚɞ
just for the fun of it
what’s your problem ?
syam
its not compiling... sudo make is throwing out wierd errors..
ʚɞÇherry Łoveʚɞ
can i get that errors ? you just show your screenshot, it’s better than a !meta question.