Re: Sanitize field from xss attacks in django models

2021-11-06 Thread omar ahmed
My final solution : [image: bb.png] On Saturday, November 6, 2021 at 6:03:59 PM UTC+2 st...@jigsawtech.co.uk wrote: > Are you using the safe filter in your templates as otherwise that "attack" > won't do anything but you are right that other XSS attack vectors can be > used as per the example

Sanitize field from xss attacks in django models

2021-11-06 Thread omar ahmed
hi all i want to sanitize 'content' field from XSS attacks in django models so i installed 'bleach' and used but script like "an evil() example" store as is (without sanitize script) Note: i need bleach via function in models Any idea ? Thanks [image: bleach-Models.png] -- You received this

Re: access league by league-code REST api

2019-07-09 Thread omar ahmed
thank you Derek it works now i read documentation do you have any advice ? On Sunday, July 7, 2019 at 10:18:56 AM UTC+2, Derek wrote: > > Have you tried without the {'code'} > > As per their example: > > [image: api1.png] > > > On Thursday, 4 July 2019 23:42:05 UTC+2, o

Re: access league by league-code REST api

2019-07-05 Thread omar ahmed
please explain ? On Friday, July 5, 2019 at 7:25:08 AM UTC+2, Serdar Emirci wrote: > > > /League > /League > > > Serdar EMIRCI > > > omar ahmed >, 5 Tem 2019 Cum, 00:43 > tarihinde şunu yazdı: > >> hiii .. >> i use REST api to get dat

access league by league-code REST api

2019-07-04 Thread omar ahmed
hiii .. i use REST api to get data from "https://www.football-data.org; .. i want to create one view that can restore any league (by league code like: PL for premier league) not for particular league openleague.html {% block content %} Premier League Spanish League Italian League German League

send league code in REST api

2019-07-04 Thread omar ahmed
hiii .. i use REST api to get data from "https://www.football-data.org; .. i want to create one view that can restore any league (by league code like: PL for premier league) not for particular league openleague.html {% block content %} Premier League Spanish League Italian League German League

Re: Deploying a static website

2019-07-04 Thread omar ahmed
Heroku is very helpful and easy to deploy on it https://medium.com/@BennettGarner/deploying-django-to-heroku-procfile-static-root-other-pitfalls-e7ab8b2ba33b this is very good tutorial to deploy to heroku ... i deployed my first Django app by it good luck On Thursday, July 4, 2019 at 3:47:15 AM

use filters with Rest api

2019-06-23 Thread omar ahmed
it's my first time to use REST APIs ... now i try to retrieve data from "https://www.football-data.org; i want to list teams for a particular competition .. so in docs it was sample ... and i should to use these filters season={YEAR} stage={STAGE} but i don't know how ..thanks connection =

Re: my file uploads missing/deleted

2019-06-14 Thread omar ahmed
your photos. You need to define it with this variable in settings.py. > Typically I call it 'images' like this: > DROPBOX_ROOT_PATH = '/images/' > > > On Thursday, June 13, 2019 at 3:44:20 PM UTC-5, omar ahmed wrote: >> >> i did first and second steps >> but what ab

Re: my file uploads missing/deleted

2019-06-13 Thread omar ahmed
go best practices says an app does one > thing and does it well. > > > On Friday, June 7, 2019 at 6:32:21 PM UTC-5, omar ahmed wrote: >> >> hii .. >> i deployed my first django app on Heroku https://arena3.herokuapp.com/ >> but my media files ( like club logo

Re: my file uploads missing/deleted

2019-06-13 Thread omar ahmed
mport(name[level:], package, level) File "" in _gcd_import 994. File "" in _find_and_load 971. File "" in _find_and_load_unlocked 955. File "" in _load_unlocked 665. File "" in exec_module 678. File "" in _call_with_fr

Re: my file uploads missing/deleted

2019-06-13 Thread omar ahmed
t; Sent from my mobile device > > On Jun 13, 2019, at 7:07 AM, omar ahmed > > wrote: > > i followed the steps > when i typed > python manage.py test [--settings=test_settings] > i found this error > ModuleNotFoundError: No module named '[--settings=test_settings]'

Re: my file uploads missing/deleted

2019-06-13 Thread omar ahmed
; https://pypi.org/project/django-dropbox-storage/ > > If you use this package, remove the sample code I sent > > > On Wed, Jun 12, 2019 at 3:53 PM omar ahmed > wrote: > >> i added this function at the end of views.py file >> def connect_to_dropbox

Re: my file uploads missing/deleted

2019-06-12 Thread omar ahmed
en) > dbx.users_get_current_account() > > # this stuff likely would go in a separate function > for entry in dbx.files_list_folder(‘’).entries: > print(entry.name) > > > At some point in your code you would call the function: > connect_to_dropbox() >

Re: my file uploads missing/deleted

2019-06-12 Thread omar ahmed
#overview > > You can checkout this project for ideas > https://github.com/singingwolfboy/django-with-dropbox > > and here is documentation for django-storages > https://django-storages.readthedocs.io/en/latest/backends/dropbox.html > > > > On Tue, Jun 11, 2019 at 2:17 PM

Re: my file uploads missing/deleted

2019-06-12 Thread omar ahmed
ed in my database and > presents them in a list view in the Admin panel alongside the other model > data. > > On Tuesday, June 11, 2019 at 4:16:43 PM UTC-5, omar ahmed wrote: >> >> yes James you are right i need to upload images using the Django >> admin, ... how can i

Re: my file uploads missing/deleted

2019-06-11 Thread omar ahmed
yes James you are right i need to upload images using the Django admin, ... how can i use Dropbox for this issue ? i need a good tutorial On Tuesday, June 11, 2019 at 6:14:10 PM UTC+2, James Farris wrote: > > He is saying these aren’t static files. It sounds like he uploads them > using

Re: my file uploads missing/deleted

2019-06-10 Thread omar ahmed
hoto, you can do what I suggested using codepen.io > or surge.sh or almost any other remote storage that allows you to > 'hotlink' <https://simple.wikipedia.org/wiki/Hotlinking> image files. > > > On Sunday, June 9, 2019 at 9:17:42 PM UTC-5, omar ahmed wrote: >> >> this i

Re: my file uploads missing/deleted

2019-06-10 Thread omar ahmed
r site on herokuapp, > because i am getting application error > > On Sat, Jun 8, 2019 at 5:02 AM omar ahmed > wrote: > >> hii .. >> i deployed my first django app on Heroku https://arena3.herokuapp.com/ >> but my media files ( like club logo ) disappear or deleted

Re: my file uploads missing/deleted

2019-06-09 Thread omar ahmed
site and > then use the links to the images. If that makes sense. > > I have used both options to store my static files in various projects. > These options are good for testing and development. > > On Sunday, June 9, 2019 at 9:07:01 AM UTC-5, omar ahmed wrote: >> >> i

Re: my file uploads missing/deleted

2019-06-09 Thread omar ahmed
/backends/dropbox.html > > It's easy to setup. > > On Saturday, June 8, 2019 at 8:23:17 AM UTC-5, omar ahmed wrote: >> >> ok joe how can i use Dropbox for this issue .. >> >> On Saturday, June 8, 2019 at 2:59:20 AM UTC+2, Joe Reitman wrote: >>> >

Re: my file uploads missing/deleted

2019-06-08 Thread omar ahmed
9 at 6:32:21 PM UTC-5, omar ahmed wrote: >> >> hii .. >> i deployed my first django app on Heroku https://arena3.herokuapp.com/ >> but my media files ( like club logo ) disappear or deleted ... >> i found this article on Heroku >> https://help.heroku.com/K1PPS2WM/w

my file uploads missing/deleted

2019-06-07 Thread omar ahmed
hii .. i deployed my first django app on Heroku https://arena3.herokuapp.com/ but my media files ( like club logo ) disappear or deleted ... i found this article on Heroku https://help.heroku.com/K1PPS2WM/why-are-my-file-uploads-missing-deleted that means The Heroku filesystem is ephermal and

WhiteNoise configuration is incompatible 'Heroku'

2019-05-31 Thread omar ahmed
hii .. I deployed one Django project on Heroku.The project was running on my local server .. but it doesn't appear good on heroku i typed : git add . then git commit -am "Implement database connection" then git push heroku master it as result remote: -> $ python manage.py collectstatic

WhiteNoise configuration is incompatible Heroku

2019-05-31 Thread omar ahmed
hii .. I deployed one Django project on Heroku.The project was running on my local server .. but it doesn't appear good on heroku i typed : git add . then git commit -am "Implement database connection" then git push heroku master it as result remote: -> $ python manage.py collectstatic

Re: deploy to Heroku " collectstatic --noinput "

2019-05-27 Thread omar ahmed
i can't publish my project On Monday, May 27, 2019 at 8:45:59 PM UTC+2, Jamiu Olashile Salimon wrote: > > Hello Omar, what’s the problem? > > On Sun, 26 May 2019 at 10:35 PM, omar ahmed > wrote: > >> git push heroku master >> Counting objects: 4, done. >

deploy to Heroku " collectstatic --noinput "

2019-05-26 Thread omar ahmed
git push heroku master Counting objects: 4, done. Delta compression using up to 4 threads. Compressing objects: 100% (4/4), done. Writing objects: 100% (4/4), 414 bytes | 0 bytes/s, done. Total 4 (delta 3), reused 0 (delta 0) remote: Compressing source files... done. remote: Building source:

push project to Heroku " collectstatic --noinput "

2019-05-26 Thread omar ahmed
git push heroku master Counting objects: 4, done. Delta compression using up to 4 threads. Compressing objects: 100% (4/4), done. Writing objects: 100% (4/4), 414 bytes | 0 bytes/s, done. Total 4 (delta 3), reused 0 (delta 0) remote: Compressing source files... done. remote: Building source:

Re: set python 3.6.8 default in my ubuntu

2019-05-22 Thread omar ahmed
thank you nick it works -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to

Re: set python 3.6.8 default in my ubuntu

2019-05-22 Thread omar ahmed
; > You can however create a virtualenv with python3 by simply running > *virtualenv > env -p python3*. > > It is also worth noting that as far as I know Heroku does support python3. > There is some documentation on this here > <https://devcenter.heroku.com/articles/python-runtime

set python 3.6.8 default in my ubuntu

2019-05-22 Thread omar ahmed
hello .. just finished my first project with django but i can not publish it because my default python is python 2.7.12 and Heroku now does not support it .. now i installed python 3.6.8 how can i set it as default python version to make my projects with virtualenv ? thanks in advance --

Re: i am new i want full details of Django

2019-05-17 Thread omar ahmed
if you know python basic go to https://www.djangoproject.com/ On Thursday, May 16, 2019 at 4:00:02 PM UTC+2, Sanjay K wrote: > > could u please provide the basic books > -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this

Re: could not connect to server: Connection refused Is the server running on host "localhost" (::1) and accepting TCP/IP connections on port 5432?

2019-05-16 Thread omar ahmed
do you mean firewall stop all connections ?? thank you On Thursday, May 16, 2019 at 3:24:52 PM UTC+2, OnlineJudge95 wrote: > > So one check would be to see all the connections that are allowed by your > firewall. > > On Thu, May 16, 2019, 6:45 PM omar ahmed > > w

Re: could not connect to server: Connection refused Is the server running on host "localhost" (::1) and accepting TCP/IP connections on port 5432?

2019-05-16 Thread omar ahmed
r to anyone….thats >> very dangerous. Now anyone can log in to your server with nefarious >> intentions. >> Be more careful. >> >> But it sounds like something on the server is blocking your connection. >> >> On May 16, 2019, at 8:57 AM, omar ahmed >

Re: could not connect to server: Connection refused Is the server running on host "localhost" (::1) and accepting TCP/IP connections on port 5432?

2019-05-16 Thread omar ahmed
sounds like something on the server is blocking your connection. > > On May 16, 2019, at 8:57 AM, omar ahmed > > wrote: > > hii .. > i try to publish my first project on python anywhere but it still not > working and this is my error : > could not connect to server: Con

could not connect to server: Connection refused Is the server running on host "localhost" (::1) and accepting TCP/IP connections on port 5432?

2019-05-16 Thread omar ahmed
hii .. i try to publish my first project on python anywhere but it still not working and this is my error : could not connect to server: Connection refused Is the server running on host "localhost" (::1) and accepting TCP/IP connections on port 5432? could not connect to server: Connection

Re: compute model field by related field

2019-04-24 Thread omar ahmed
tation > > On Tuesday, 23 April 2019 16:31:43 UTC+2, omar ahmed wrote: >> >> yes i studied this tutorial before and i added this function to "Club" >> class (( Receiver function class )) but it does not affect fields >> def teampoints( sender, instanc

Re: compute model field by related field

2019-04-23 Thread omar ahmed
You need to use Django signals to provide a custom "post_save". There is > a good tutorial here: > > https://simpleisbetterthancomplex.com/tutorial/2016/07/28/how-to-create-django-signals.html > > > On Monday, 22 April 2019 16:22:19 UTC+2, omar ahmed wrote: >> >

Re: compute model field by related field

2019-04-22 Thread omar ahmed
n Saturday, April 20, 2019 at 9:09:01 AM UTC+2, Derek wrote: > > That should just require a basic if/then logic test; "get" the correct > Club object, update the win/loss field and save the Club. Repeat for both > Clubs. > > On Thursday, 18 April 2019 14:09:41 UTC+2,

Re: compute model field by related field

2019-04-18 Thread omar ahmed
model that updates the > "won" or "lost" fields for each Club in the match (simple if/then logic > based on winner). > > PS I think the default values for "won" and "lost" for a Club should be > "0" and not "1". > > On Tue

compute model field by related field

2019-04-16 Thread omar ahmed
hello ... i have two models "Club" class and "Match" class and it has foreign key to Club now i want to increment "won" field (or draw or lost) in "Club" class by "score_local" and "score_visitor" in "Match" class .. how can i do this class Club(models.Model): name =

make relevance between two fields in django model

2019-04-15 Thread omar ahmed
hii .. in models i have two classes 'Club' and 'League' and i created third class 'Match' class Match(models.Model): league = models.Foreignkey(League) club = models.Foreignkey(League) now i want to make relevance between league and club fields in this class -- You received this message because

Re: TypeError unsupported operand type(s) for *: 'NoneType' and 'int'

2019-04-07 Thread omar ahmed
the error to occur. > > In this case though you only have a (single line in CalcPoints) which uses > the '*' operator. > > On Sat, 2019-04-06 at 10:35 -0700, omar ahmed wrote: > > models.py > def CalcPoints(self): > return self.won*3 + self.draw > > > > The python docu

TypeError unsupported operand type(s) for *: 'NoneType' and 'int'

2019-04-06 Thread omar ahmed
models.py class Club(models.Model): league_names = models.ForeignKey(League, on_delete= models.CASCADE, related_name='club') name = models.CharField(max_length=100) logo = models.ImageField(upload_to='media/core', max_length=255, null=True, blank=True) won = models.IntegerField() draw =

psycopg2.DataError: invalid input syntax

2019-04-03 Thread omar ahmed
i am getting this error : psycopg2.DataError: invalid input syntax what is the solution ? -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to

Re: how can i get current username in model field ??

2019-04-01 Thread omar ahmed
ok i solved it name = request.user.username form = CommentForm(initial={'author': name}) return render(request, 'core/add_comment_to_news.html', {'form':form On Monday, April 1, 2019 at 6:02:21 PM UTC+2, omar ahmed wrote: > > explain please > > On Monday, April 1, 2019 at 3:57

Re: how can i get current username in model field ??

2019-04-01 Thread omar ahmed
gt; This does not make sense to me. A model is not a dynamic entity. It is >> something that's created beforehand. Getting the current username into >> model should be done in your logic (views), or the template >> Sincerely yours, >> >> Joel G Mathew >> >

Re: how can i get current username in model field ??

2019-04-01 Thread omar ahmed
ould be done in your logic (views), or the template > Sincerely yours, > > Joel G Mathew > > > > On Mon, 1 Apr 2019 at 19:01, omar ahmed > > wrote: > >> i want to put value of logged in user.username in author field >> class Comment(models.Model): &

how can i get current username in model field ??

2019-04-01 Thread omar ahmed
i want to put value of logged in user.username in author field class Comment(models.Model): leaguenews = models.ForeignKey(LeagueNews, on_delete= models.CASCADE, related_name='comments') author = models.CharField(max_length=200) text = models.TextField() -- You received this message because you

add comment to post

2019-03-25 Thread omar ahmed
hiii how can i make comments to my news posts ? -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this

Re: Error in Django url mapping

2019-03-24 Thread omar ahmed
hello ... your code is good but you forgot to put comma after second path in urls.py urlpatterns = [ path('admin/', admin.site.urls), path('first_app/', include('first_app.urls')), ] On Saturday, March 23, 2019 at 6:08:24 PM UTC+2, The Aryas wrote: > > Hey Guys, I am facing problem

social share

2019-03-23 Thread omar ahmed
hello ... how can i add social share in django like FB ,twitter and G+ ? -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to

is_valid() method and cleaned_data attribute

2019-03-22 Thread omar ahmed
hello guys i created contact form in my view : if form.is_valid(): message = form.cleaned_data['message'] what is .is_valid() method and what is cleaned_data attribute ??? -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this

Re: How To Use PostgreSQL with your Django on Ubuntu

2019-03-20 Thread omar ahmed
9985864383 > intis...@gmail.com > > > On Tue, Mar 19, 2019 at 6:28 PM omar ahmed > wrote: > >> ok what about old projects >> only install postgresql and change db settings >> >> On Tuesday, March 19, 2019 at 2:42:02 PM UTC+2, Jani Tiainen wrote:

Re: How To Use PostgreSQL with your Django on Ubuntu

2019-03-19 Thread omar ahmed
Mar 19, 2019 at 2:35 PM omar ahmed > wrote: > >> hello .. >> how can i Use PostgreSQL with your Django on Ubuntu >> >> -- >> You received this message because you are subscribed to the Google Groups >> "Django users" group. >> To unsu

How To Use PostgreSQL with your Django on Ubuntu

2019-03-19 Thread omar ahmed
hello .. how can i Use PostgreSQL with your Django on Ubuntu -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To

Re: filter two columns django

2019-03-17 Thread omar ahmed
tion_date')[:10] > > AND > news_list = LeagueNews.objects.filter(publication_date__lte=timezone.now, > league_name='english').order_by('-publication_date')[:10] > > On Sun, 17 Mar, 2019, 7:25 PM omar ahmed, > wrote: > >> hi guys >> this is my view >> def premierleag

filter two columns django

2019-03-17 Thread omar ahmed
hi guys this is my view def premierleague(request): news_list = LeagueNews.objects.filter((publication_date__lte=timezone.now)|(league_name='english')).order_by('-publication_date')[:10] return render(request, 'core/premierleague.html', {'news_list':news_list}) i want to filter my objects by two

Re: image didn't upload

2019-03-14 Thread omar ahmed
i want to post image in news page On Thursday, March 14, 2019 at 6:26:26 PM UTC+2, AbsolutEdge findout wrote: > > Hello omar, > > I don't see that you're uploading the picture anywhere, you haven't used a > form to upload the image, your template is just trying to display the > image, where are

Re: image didn't upload

2019-03-14 Thread omar ahmed
pMsj-+xZonEUTLt8HKoXBnKA@mail.gmail.com_m_4678954581711788864_DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2> > > On Thu, Mar 14, 2019 at 5:43 PM omar ahmed > wrote: > >> this is my model >> class LeagueNews(models.Model): >> ... >> news_image = models.ImageField(upload

image didn't upload

2019-03-14 Thread omar ahmed
this is my model class LeagueNews(models.Model): ... news_image = models.ImageField(upload_to='core/media/core',max_length=255, null=True,blank=True) and this is my template {% block content %} {{ article.news_title }} {{ article.publication_date }} {{ article.news_text }} {% endblock

Re: add Image Field in model

2019-03-13 Thread omar ahmed
; Amitesh Sahay > *91-750 797 8619* > > > On Tuesday, 12 March, 2019, 6:51:09 pm IST, omar ahmed > wrote: > > > hello > i want to add image field in my model > i typed : > image = models.ImageField() > but : > Cannot use ImageField because Pillow is not

Re: add Image Field in model

2019-03-12 Thread omar ahmed
ok i will try it ... thank you On Tuesday, March 12, 2019 at 3:24:04 PM UTC+2, Suresh Kannan wrote: > > Hi, > > https://stackoverflow.com/a/49867787/4037275 > > On Tue, 12 Mar 2019 at 09:20, omar ahmed > > wrote: > >> hello >> i want to add image f

add Image Field in model

2019-03-12 Thread omar ahmed
hello i want to add image field in my model i typed : image = models.ImageField() but : Cannot use ImageField because Pillow is not installed -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving

Re: any good books for django2

2019-01-29 Thread omar ahmed
Django documentation is very good بتاريخ ٢٠١٩/٠١/٢٩ ٦:٠٢ م، كتب "Lutalo Bbosa joseph" : > guys can anyone assist me with a link to any django2 book because it seems > its > most are not free > > -- > You received this message because you are subscribed to the Google Groups > "Django users"

Re: Django Databade

2019-01-22 Thread omar ahmed
Postgresql is the best db for Django projects بتاريخ ٢٠١٩/٠١/٢٢ ٤:٠٧ م، كتب : > Guys please kindly advise me, what db is pleasant for django projects, > been trying to use firebase with pyrebase but it is slow and not efficient. > Thanks. > > -- > You received this message because you are

Re: Need tutorials

2019-01-22 Thread omar ahmed
Django documentation is very good to learn the basics بتاريخ ٢٠١٩/٠١/١٩ ٥:٣٩ ص، كتب "Madhav Rajmohan" : > > Guys, >I've Heard that django helps you create something that is > mesmerizing form your mind and I've heard that you guys can help me bring > up my basics.I Am just a

Re: simple boy start learn python

2019-01-05 Thread omar ahmed
Django documentation is very good بتاريخ ٢٠١٩/٠١/٠٥ ١٠:٤٦ م، كتب : > I know that you are exp in django, so I need you tell me the best way to > learn django is what ? > > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To unsubscribe from