image not showing on page

2020-04-03 Thread John McClain
html page

[image: image.png]

[image: image.png]


settings.py

[image: image.png]


any suggestions would be appreciated

-- 
John McClain

Cell: 085-1977-823
Skype: jmcclain0129
Email: jmcclain0...@gmail.com

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAN-hv_ocNWa2jy%3D70iLywax5fP8nC3Cjqj_Hi53%3Dq-co3XMJnw%40mail.gmail.com.


Re: image not showing on page

2020-04-03 Thread Andréas Kühne
Why do you have  a ; in the src part of the img tag? I am guessing that you
get a 404 now?

Regards,

Andréas


Den fre 3 apr. 2020 kl 12:08 skrev John McClain :

> html page
>
> [image: image.png]
>
> [image: image.png]
>
>
> settings.py
>
> [image: image.png]
>
>
> any suggestions would be appreciated
>
> --
> John McClain
>
> Cell: 085-1977-823
> Skype: jmcclain0129
> Email: jmcclain0...@gmail.com
>
> --
> 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAN-hv_ocNWa2jy%3D70iLywax5fP8nC3Cjqj_Hi53%3Dq-co3XMJnw%40mail.gmail.com
> 
> .
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAK4qSCcZRjjzgvZ1HHauiMY9br9hHMCJbck%2BVcfYcs_T2h_f_Q%40mail.gmail.com.


Re: image not showing on page

2020-04-03 Thread Kasper Laudrup

Hi John,

On 03/04/2020 12.18, John McClain wrote:

snap a screenshot of what you are saying

am not getting 404
am not getting any error returned at all
I simply cannot see the image



Learn to use your browsers debugging tools and read the output from the 
Django server logs. That will make it much easier for you to find the 
cause of your problems.


Kind regards,

Kasper Laudrup

--
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/f705006b-543c-0a20-99e7-553ba67e5cd0%40stacktrace.dk.


Re: image not showing on page

2020-04-03 Thread John McClain
genius ;-(

On Fri, 3 Apr 2020 at 11:27, Kasper Laudrup  wrote:

> Hi John,
>
> On 03/04/2020 12.18, John McClain wrote:
> > snap a screenshot of what you are saying
> >
> > am not getting 404
> > am not getting any error returned at all
> > I simply cannot see the image
> >
>
> Learn to use your browsers debugging tools and read the output from the
> Django server logs. That will make it much easier for you to find the
> cause of your problems.
>
> Kind regards,
>
> Kasper Laudrup
>
> --
> 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/f705006b-543c-0a20-99e7-553ba67e5cd0%40stacktrace.dk
> .
>


-- 
John McClain

Cell: 085-1977-823
Skype: jmcclain0129
Email: jmcclain0...@gmail.com

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAN-hv_pgNp8gs_PkVmcZ89FUwNnb22qn5QtM1oZW4TPK2U449w%40mail.gmail.com.


Re: image not showing on page

2020-04-03 Thread Kasper Laudrup

On 03/04/2020 12.31, John McClain wrote:

genius ;-(



I'm sorry, I don't understand what that's supposed to mean?

I would assume that the log from Django or your web browsers console 
would show something, but you haven't posted any output from it so how 
could I know if you already had a look there?


What is the output from both logs?

Kind regards,

Kasper Laudrup

--
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/caa01a02-c356-a2f1-3859-129653689548%40stacktrace.dk.


Django + hosted videos and user rights

2020-04-03 Thread Moreplavec
Greetings,

i'd like to have online courses in my website. I found it quite difficult 
to serve and protect videos (i'm not so skilled in Django), so i'd like to 
try to use some service like Vimeo to make my life easier and solve 
serving/playing and video protection.

Right now i have website based on Django 2.x with Wagtail CMS to easy 
manage website content. I'd like to add pages with type Online course, 
which will be accessible only to users with purchase (access will be 
granted after Orders table check and only to bought courses). Videos will 
be inserted in Online course page. The only problem is, how to "hide" or 
modify video urls to prevent from download/publish/bookmark or direct 
access. The main purpose is to hide/protect video urls, secondary is to 
prevent downloading. So users with expired membership can't access course 
anymore or can't send links to other people. I know i can't protect videos 
100%, but i want to hide it for "regular" users. 

So, to make my life easier i hope Vimeo (paid membership) or other services 
should be able to help me. I have few question as Django beginner and 
looking for your help:

1. is my solution fine or i should change something?
2. is Vimeo good choice to serve videos? Do you have any experiences with 
Vimeo?
3. if i insert Vimeo videos to pages, is it somehow protected? Or it's like 
YT videos and anybody can simply download?
4. are there any other problems to be considered?

Many thanks for help or tips!

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/af1fe937-b7bc-4b37-85f4-37a3c9b4b516%40googlegroups.com.


Re: image not showing on page

2020-04-03 Thread John McClain
I mean your answer was quite derogatory and if you are not part of the
solution then you are part of the problem

and for your information, I am a learner and I am trying to learn and I
have spent a lot of time on the boards on StackOverflow and elsewhere
including using my inspect tool inside chrome

this is coming through email message so I get a lot of other gibberish in
the inspect tool

while I appreciate you may have the best of intentions by making a
statement like the one you did, I would also suggest it is not helpful. My
"GENIUS" statement was only pointing out the obvious which is what you
stated... if I knew how to use those tools I likely wouldn't be here on
this forum asking for help! So I simply am pointing out that you're the
"master of the obvious" and a genius for (or smartass) for posting such a
comment!

as I stated earlier

IF YOU ARE NOT PART OF THE SOLUTION YOU ARE PART OF THE PROBLEM

Please be more considerate in the future with your post, I think you have
made a conclusion (or assumption) that is not fair to make. You have zero
idea of what I have been doing to this point to try and resolve the problem
on my own. I should not have to put up with the likes of you and your
comments when I am posting requests for guidance or help (neither should
anyone else for that matter)

be kind or get lost!

On Fri, 3 Apr 2020 at 11:39, Kasper Laudrup  wrote:

> On 03/04/2020 12.31, John McClain wrote:
> > genius ;-(
> >
>
> I'm sorry, I don't understand what that's supposed to mean?
>
> I would assume that the log from Django or your web browsers console
> would show something, but you haven't posted any output from it so how
> could I know if you already had a look there?
>
> What is the output from both logs?
>
> Kind regards,
>
> Kasper Laudrup
>
> --
> 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/caa01a02-c356-a2f1-3859-129653689548%40stacktrace.dk
> .
>


-- 
John McClain

Cell: 085-1977-823
Skype: jmcclain0129
Email: jmcclain0...@gmail.com

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAN-hv_pfaUS9%3Dii7yd86h5219YS%3DVF6x9Bpf2Dp-Gy8_x--TpA%40mail.gmail.com.


Re: Mobile friendly admin

2020-04-03 Thread guettli
Oh, sorry, I saw this on a very old django application. Thank you Graham 
for this hint.

Am Freitag, 3. April 2020 02:18:19 UTC+2 schrieb Tim Graham:
>
> What version of Django are you using?
>
> https://github.com/elky/django-flat-responsive is an extension for the 
> Django admin that makes the interface mobile-friendly. It's part of Django 
> 2.0 and later. 
>
> On Wednesday, April 1, 2020 at 4:02:57 AM UTC-4, guettli wrote:
>>
>> I know there a several third party packages which try to improve the 
>> great django admin:
>>
>> See: https://djangopackages.org/grids/g/admin-interface/
>>
>> A lot of packages are already outdated. AFAIK no sane and simple default 
>> package exists.
>>
>> I think the only solution to this would be an improvement which is not a 
>> third party package.
>>
>> With other words: An update of the original admin. AFAIK no major change 
>> is planed by
>> the core developers, or am I missing something?
>>
>> My goal: mobile friendly admin interface.
>>
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/e179803e-2e79-4cb1-9eb8-5940f8dc61da%40googlegroups.com.


Class 'Question' has no 'objects' . problem in Writing your first Django app, part 3 tutorial

2020-04-03 Thread yoav
I'm using vs code and doing the tutorial  
https://docs.djangoproject.com/en/3.0/intro/tutorial03/

at the " Here’s one stab at a new index() " part of the tutorial when 
writing to polls/vies.py
file I get an error from vs code (in the "latest_questin_list=") 
that Question has no 'objects.

why it says  Question has no 'objects.?


-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/c585143e-a2b0-40a4-a77b-59140adae41a%40googlegroups.com.


Cannot use django.db.models.Model.objects

2020-04-03 Thread Jesper Nymark Pedersen
Hi

I am new to Python and Django and following a great tutorial to buidl a 
simple webpage.
But I ran into a problem when trying to utilize the 'objects' function 
within django.db.models.Model - it's simply not there...?

I have searched inside the source code in django and could not find it.

Running:

Pycharm 2019.3.4
Python 3.8.1
Django 2.1.5

Any help would be greatly appreciated!



-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/75198527-cd81-4c6f-aaf8-974b71122133%40googlegroups.com.


Re: Django Error - 'staticfiles' is not a registered tag library. Must be one of: admin_list admin_modify admin_urls

2020-04-03 Thread Arjun Singh
Thank You 
For Posting this answer ...I was trying to solve this error whole night but 
thank you i got solution from YOU.


On Thursday, December 12, 2019 at 1:34:59 PM UTC+5:30, Andréas Kühne wrote:
>
> Are you running django 3.0?
>
> If you are you shouldn't use: {% load static from staticfiles %} anymore. 
> You should just write {% load static %}
>
> This broke a couple of things for me as well, but this minor change got it 
> working again.
>
> Regards,
>
> Andréas
>
>
> Den tis 10 dec. 2019 kl 16:59 skrev Balaji Shetty  >:
>
>> Hi
>>
>> I am getting error for every Project.
>>
>> I  created new environment and reinstalled python and Django.
>>
>> emplateSyntaxError at /
>>
>> 'staticfiles' is not a registered tag library. Must be one of:
>> admin_list
>> admin_modify
>> admin_urls
>> cache
>> i18n
>> l10n
>> log
>> propeller
>> static
>> tz
>>
>>
>>
>>
>> -- 
>>
>>
>> *Mr. Shetty Balaji S.Asst. ProfessorDepartment of Information Technology,*
>> *SGGS Institute of Engineering & Technology, Vishnupuri, Nanded.MH.India*
>> *Official: bssh...@sggs.ac.in  *
>> *  Mobile: +91-9270696267*
>>
>> -- 
>> 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...@googlegroups.com .
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/django-users/CAECSbOu6bW6G3Wqmz7w3AkezhuGGax9Z4dH7LzEVLAAV5ZtaKQ%40mail.gmail.com
>>  
>> 
>> .
>>
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/1949af3f-2fd6-4285-b17e-f64c1d7f5884%40googlegroups.com.


Re: image not showing on page

2020-04-03 Thread Kasper Laudrup

Hi John,

On 03/04/2020 12.52, John McClain wrote:
I mean your answer was quite derogatory and if you are not part of the 
solution then you are part of the problem




I'm sorry if it sounded like that. That was not my intention. I was 
definitely trying to help. I don't understand which problem you are 
saying I'm part of.


and for your information, I am a learner and I am trying to learn and I 
have spent a lot of time on the boards on StackOverflow and elsewhere 
including using my inspect tool inside chrome




OK. How was I supposed to know that? You didn't post any output from the 
inspect tool.


this is coming through email message so I get a lot of other gibberish 
in the inspect tool




Maybe some of that gibberish would help point out where your problem is? 
I'm guessing there's a 404 hidden somewhere there.


while I appreciate you may have the best of intentions by making a 
statement like the one you did, I would also suggest it is not helpful. 
My "GENIUS" statement was only pointing out the obvious which is what 
you stated... if I knew how to use those tools I likely wouldn't be here 
on this forum asking for help! So I simply am pointing out that you're 
the "master of the obvious" and a genius for (or smartass) for posting 
such a comment!




I'm not sure I understand. Do you know how to look in the logs or don't you?

Maybe writing something like "I already know how to use the Chrome 
inspect tools, but I'm not sure what to look for. There's a lot of 
gibberish there" would have been a bit more constructive than simply 
calling me "genius".



as I stated earlier

IF YOU ARE NOT PART OF THE SOLUTION YOU ARE PART OF THE PROBLEM



I'm still not sure which problem I'm part of. I definitely cannot see 
I'm part of your problem getting an image to display on your web page, 
so that cannot be it.


Please be more considerate in the future with your post, I think you 
have made a conclusion (or assumption) that is not fair to make. You 
have zero idea of what I have been doing to this point to try and 
resolve the problem on my own. I should not have to put up with the 
likes of you and your comments when I am posting requests for guidance 
or help (neither should anyone else for that matter)




I will try to be more considerate and I'm sorry that you read my comment 
the wrong way. That was not my intention. I was trying to help you.



be kind or get lost!



I cannot really see how I am the one being rude here...

Kind regards,

Kasper Laudrup

--
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/cb4a68f4-0536-aad0-8083-3212938aeddf%40stacktrace.dk.


Re: image not showing on page

2020-04-03 Thread John McClain
Kasper,

Thanks for clarifying matters...

I think you could have asked for more details or asked for me to provide
those resources so you could evaluate further rather than replying the way
you did.

As far as the inspector goes it is not flagging anything that is useful for
this matter. As I stated the issue is related to an email auth verification
process whereby the path is not working. When google grabs it the path is
interrupted for some reason.

However, I have resolved the issue by removing the django path requirements
and using the direct path to the was s3 location that hosts the image. I am
not sure this is the best practice but it did work for me

I went from this:

style="background-image: img src="{% static 'images/image_name.png'
%};">


to this:

https://alphabetacharlie.s3.amazonaws.com/static/images/image_name.png";>

and it worked

Keep in mind this is only a solution for dealing with the mail routing
issue as I can use normal django syntax within the app itself.

Thanks for your feedback.

Cheers,

John

On Fri, 3 Apr 2020 at 13:04, Kasper Laudrup  wrote:

> Hi John,
>
> On 03/04/2020 12.52, John McClain wrote:
> > I mean your answer was quite derogatory and if you are not part of the
> > solution then you are part of the problem
> >
>
> I'm sorry if it sounded like that. That was not my intention. I was
> definitely trying to help. I don't understand which problem you are
> saying I'm part of.
>
> > and for your information, I am a learner and I am trying to learn and I
> > have spent a lot of time on the boards on StackOverflow and elsewhere
> > including using my inspect tool inside chrome
> >
>
> OK. How was I supposed to know that? You didn't post any output from the
> inspect tool.
>
> > this is coming through email message so I get a lot of other gibberish
> > in the inspect tool
> >
>
> Maybe some of that gibberish would help point out where your problem is?
> I'm guessing there's a 404 hidden somewhere there.
>
> > while I appreciate you may have the best of intentions by making a
> > statement like the one you did, I would also suggest it is not helpful.
> > My "GENIUS" statement was only pointing out the obvious which is what
> > you stated... if I knew how to use those tools I likely wouldn't be here
> > on this forum asking for help! So I simply am pointing out that you're
> > the "master of the obvious" and a genius for (or smartass) for posting
> > such a comment!
> >
>
> I'm not sure I understand. Do you know how to look in the logs or don't
> you?
>
> Maybe writing something like "I already know how to use the Chrome
> inspect tools, but I'm not sure what to look for. There's a lot of
> gibberish there" would have been a bit more constructive than simply
> calling me "genius".
>
> > as I stated earlier
> >
> > IF YOU ARE NOT PART OF THE SOLUTION YOU ARE PART OF THE PROBLEM
> >
>
> I'm still not sure which problem I'm part of. I definitely cannot see
> I'm part of your problem getting an image to display on your web page,
> so that cannot be it.
>
> > Please be more considerate in the future with your post, I think you
> > have made a conclusion (or assumption) that is not fair to make. You
> > have zero idea of what I have been doing to this point to try and
> > resolve the problem on my own. I should not have to put up with the
> > likes of you and your comments when I am posting requests for guidance
> > or help (neither should anyone else for that matter)
> >
>
> I will try to be more considerate and I'm sorry that you read my comment
> the wrong way. That was not my intention. I was trying to help you.
>
> > be kind or get lost!
> >
>
> I cannot really see how I am the one being rude here...
>
> Kind regards,
>
> Kasper Laudrup
>
> --
> 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/cb4a68f4-0536-aad0-8083-3212938aeddf%40stacktrace.dk
> .
>


-- 
John McClain

Cell: 085-1977-823
Skype: jmcclain0129
Email: jmcclain0...@gmail.com

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAN-hv_pJn3y0QyLpMwXZxe2a2YnhfZYL2y6E_gugh9xZsBQeXg%40mail.gmail.com.


how to use django template language inside script html tag using django-jsRender

2020-04-03 Thread Yacin Omar
As I know, there is no way to use Django template language inside 
Javascript block so I searched for a way how to do it, I found a Django app 
on github  called django-jsrender but unfortunately, there isn't enough 
documentation for this app and when I tried to use it I couldn't and this 
is my code: 

[image: Capture.PNG] 

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/a1c20606-bf66-4638-a006-be592a938c66%40googlegroups.com.


Re: image not showing on page

2020-04-03 Thread Andréas Kühne
What I stated earlier is probably your issue:

You have the following:
style="background-image: img src="{% static 'images/image_name.png'
%};">

You see the ";" at the end? The path to your image is then
"images/image_name.png;" <- which is incorrect because of the
extra semicolon.

I would at least start by removing that.

Regards,

Andréas


Den fre 3 apr. 2020 kl 15:14 skrev John McClain :

> Kasper,
>
> Thanks for clarifying matters...
>
> I think you could have asked for more details or asked for me to provide
> those resources so you could evaluate further rather than replying the way
> you did.
>
> As far as the inspector goes it is not flagging anything that is useful
> for this matter. As I stated the issue is related to an email auth
> verification process whereby the path is not working. When google grabs it
> the path is interrupted for some reason.
>
> However, I have resolved the issue by removing the django path
> requirements and using the direct path to the was s3 location that hosts
> the image. I am not sure this is the best practice but it did work for me
>
> I went from this:
>
> style="background-image: img src="{% static 'images/image_name.png'
> %};">
>
>
> to this:
>
> https://alphabetacharlie.s3.amazonaws.com/static/images/image_name.png";>
>
> and it worked
>
> Keep in mind this is only a solution for dealing with the mail routing
> issue as I can use normal django syntax within the app itself.
>
> Thanks for your feedback.
>
> Cheers,
>
> John
>
> On Fri, 3 Apr 2020 at 13:04, Kasper Laudrup  wrote:
>
>> Hi John,
>>
>> On 03/04/2020 12.52, John McClain wrote:
>> > I mean your answer was quite derogatory and if you are not part of the
>> > solution then you are part of the problem
>> >
>>
>> I'm sorry if it sounded like that. That was not my intention. I was
>> definitely trying to help. I don't understand which problem you are
>> saying I'm part of.
>>
>> > and for your information, I am a learner and I am trying to learn and I
>> > have spent a lot of time on the boards on StackOverflow and elsewhere
>> > including using my inspect tool inside chrome
>> >
>>
>> OK. How was I supposed to know that? You didn't post any output from the
>> inspect tool.
>>
>> > this is coming through email message so I get a lot of other gibberish
>> > in the inspect tool
>> >
>>
>> Maybe some of that gibberish would help point out where your problem is?
>> I'm guessing there's a 404 hidden somewhere there.
>>
>> > while I appreciate you may have the best of intentions by making a
>> > statement like the one you did, I would also suggest it is not helpful.
>> > My "GENIUS" statement was only pointing out the obvious which is what
>> > you stated... if I knew how to use those tools I likely wouldn't be
>> here
>> > on this forum asking for help! So I simply am pointing out that you're
>> > the "master of the obvious" and a genius for (or smartass) for posting
>> > such a comment!
>> >
>>
>> I'm not sure I understand. Do you know how to look in the logs or don't
>> you?
>>
>> Maybe writing something like "I already know how to use the Chrome
>> inspect tools, but I'm not sure what to look for. There's a lot of
>> gibberish there" would have been a bit more constructive than simply
>> calling me "genius".
>>
>> > as I stated earlier
>> >
>> > IF YOU ARE NOT PART OF THE SOLUTION YOU ARE PART OF THE PROBLEM
>> >
>>
>> I'm still not sure which problem I'm part of. I definitely cannot see
>> I'm part of your problem getting an image to display on your web page,
>> so that cannot be it.
>>
>> > Please be more considerate in the future with your post, I think you
>> > have made a conclusion (or assumption) that is not fair to make. You
>> > have zero idea of what I have been doing to this point to try and
>> > resolve the problem on my own. I should not have to put up with the
>> > likes of you and your comments when I am posting requests for guidance
>> > or help (neither should anyone else for that matter)
>> >
>>
>> I will try to be more considerate and I'm sorry that you read my comment
>> the wrong way. That was not my intention. I was trying to help you.
>>
>> > be kind or get lost!
>> >
>>
>> I cannot really see how I am the one being rude here...
>>
>> Kind regards,
>>
>> Kasper Laudrup
>>
>> --
>> 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 view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/cb4a68f4-0536-aad0-8083-3212938aeddf%40stacktrace.dk
>> .
>>
>
>
> --
> John McClain
>
> Cell: 085-1977-823
> Skype: jmcclain0129
> Email: jmcclain0...@gmail.com
>
> --
> 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...@googlegr

Re: how to use django template language inside script html tag using django-jsRender

2020-04-03 Thread Antje Kazimiers
I think you can use some basic template language within a script block like
below. myData is a stringified json object, that worked for me.
antje


  {% if myData %}
var table_data = {{ myData|safe }};
  {% else %}
var table_data = null;
  {% endif %}



On Fri, Apr 3, 2020 at 4:00 PM Yacin Omar  wrote:

> As I know, there is no way to use Django template language inside
> Javascript block so I searched for a way how to do it, I found a Django app
> on github  called django-jsrender but unfortunately, there isn't enough
> documentation for this app and when I tried to use it I couldn't and this
> is my code:
>
> [image: Capture.PNG]
>
> --
> 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/a1c20606-bf66-4638-a006-be592a938c66%40googlegroups.com
> 
> .
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAN6tUh%3DQ4Ueh%2B%2BHA-2PwmYpv0MwLhc%3DFKMiDt9jz1GeKgiKiWA%40mail.gmail.com.


Re: Mobile friendly admin

2020-04-03 Thread Motaz Hejaze
Thank you for your reply

On Fri, 3 Apr 2020, 1:31 pm guettli, 
wrote:

> Oh, sorry, I saw this on a very old django application. Thank you Graham
> for this hint.
>
> Am Freitag, 3. April 2020 02:18:19 UTC+2 schrieb Tim Graham:
>>
>> What version of Django are you using?
>>
>> https://github.com/elky/django-flat-responsive is an extension for the
>> Django admin that makes the interface mobile-friendly. It's part of Django
>> 2.0 and later.
>>
>> On Wednesday, April 1, 2020 at 4:02:57 AM UTC-4, guettli wrote:
>>>
>>> I know there a several third party packages which try to improve the
>>> great django admin:
>>>
>>> See: https://djangopackages.org/grids/g/admin-interface/
>>>
>>> A lot of packages are already outdated. AFAIK no sane and simple default
>>> package exists.
>>>
>>> I think the only solution to this would be an improvement which is not a
>>> third party package.
>>>
>>> With other words: An update of the original admin. AFAIK no major change
>>> is planed by
>>> the core developers, or am I missing something?
>>>
>>> My goal: mobile friendly admin interface.
>>>
>> --
> 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/e179803e-2e79-4cb1-9eb8-5940f8dc61da%40googlegroups.com
> 
> .
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAHV4E-dWkBifK3ybhfYxFawdqFDEuExJgZ7XF08q9L%3Do1CxZVQ%40mail.gmail.com.


Error in formatting: AttributeError: 'UUID' object has no attribute 'int'

2020-04-03 Thread aetar
When trying to render my content_detail.html template (printed below), I am 
receiving the following error: 

   - 
   - /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/uuid.py
in __init__
   1. 
  
  raise ValueError('badly formed hexadecimal UUID string')
  
  …
   ▼ Local vars 
   VariableValue
   bytes 
   
   None
   
   bytes_le 
   
   None
   
   fields 
   
   None
   
   hex 
   
   '2'
   
   int 
   
   None
   
   is_safe 
   
   
   
   self 
   
   Error in formatting: AttributeError: 'UUID' object has no attribute 'int'
   
   version 
   
   None
   
   

*archive/urls.py:*
from django.contrib import admin
from django.urls import include, path
from django.views.generic import RedirectView
from django.conf import settings
from django.conf.urls.static import static

urlpatterns = [
path('posts/', include('posts.urls')),
path('admin/', admin.site.urls),
path('', RedirectView.as_view(url='posts/', permanent=True)),] + 
static(settings.STATIC_URL, document_root=settings.STATIC_ROOT)

*archive/posts/urls.py:*
from django.urls import path

from . import views

app_name = 'posts'

urlpatterns = [
path('', views.index, name='index'),
path('/', views.ContentDetailView.as_view(), 
name='content-detail'),
]

*archive/posts/models.py:*
import datetime

from django.db import models
from django.utils import timezone
import uuid
from django.urls import reverse

# Create your models here.

class Content(models.Model):
title = models.CharField(max_length=200)
pub_date = models.DateTimeField(null=True, blank=True)

def __str__(self):
return self.title

def get_absolute_url(self):
return reverse('content-detail', args=[str(self.id)])

class ContentInstance(models.Model):
id = models.UUIDField(primary_key=True, default=uuid.uuid4, 
editable=False)
content = models.ForeignKey(Content, on_delete=models.SET_NULL, 
null=True)
text = models.TextField()

def __str__(self):
return '{0} ({1})'.format(self.id, self.content.title)

*archive/posts/views.py:*
from django.shortcuts import render

# Create your views here.

from .models import Content, ContentInstance
from django.views import generic

def index(request):
archive_list = Content.objects.order_by('-pub_date')
context = {'archive_list': archive_list}
return render(request, 'index.html', context)

class ContentDetailView(generic.DetailView):
model = Content

*archive/posts/templates/posts/content_detail.py:*

{% extends "base_generic.html" %}

{% block content %}
  Heading
  {{ content.title }}
  {{ content.pub_date }}
  
  {% for copy in content.contentinstance_set.all %} 
  <{{ copy.text }}>
  {% endfor %}
  
{% endblock %}


-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/a55a7579-1cd1-4003-bb4e-2398ace9ed0a%40googlegroups.com.


multiple constraints not working in the db

2020-04-03 Thread mccc
Hello,

I'm having issues getting multiple constraints to work (in postgres, if it 
matters).
Here is the Meta:


class Meta:
constraints = [
CheckConstraint(
check=(Q(target_value__gt=0) & ~Q(target_metric=DEFAULT)) |
  (Q(enabled=False) |
   Q(status=IMPORTING) |
   Q(status=IMPORT_FAILURE)),
name="positive_target_value",
)
]


It would seem straightforward enough to me, but it ends up not working.
Here is the generated SQL (pulled from the db itself):
target_value > 0.0::double precision AND NOT target_metric::text = 'DEFAULT'
::text OR enabled = false OR status = 20 OR status = 30

And here is proof that it should actually work (pulled from a django 
console, where the conditions are copied from the migration file):

Folder.objects.filter(models.Q(models.Q(('target_value__gt', 0), 
models.Q(_negated=True, target_metric='DEFAULT')), ('enabled', False), 
('status', 20), ('status', 30), _connector='OR'))
web_1   | Out[5]: ]>
Folder.objects.filter(models.Q(models.Q(('target_value__gt', 0), 
models.Q(_negated=True, target_metric='**SOMETHING DIFFERENT**')), ('enabled', 
False), ('status', 20), ('status', 30), _connector='OR'))
web_1   | Out[7]: , < Folder: 
Folder thisFolderShouldNotHaveBeenCreted>]>


Anybody has any suggestion?
Btw, I also tried switching the first condition with the second one, 
effectively putting the AND at the bottom of the query, but it didn't seem 
to have any effect.

Thanks a lot.

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/dc746463-ef4c-4e17-9251-572ed374c0a4%40googlegroups.com.


Re: multiple constraints not working in the db

2020-04-03 Thread mccc
oh, forgot: versions are Python 3.7.6 and Django 2.2.11


On Friday, April 3, 2020 at 7:46:40 PM UTC+2, mccc wrote:
>
> Hello,
>
> I'm having issues getting multiple constraints to work (in postgres, if it 
> matters).
> Here is the Meta:
>
>
> class Meta:
> constraints = [
> CheckConstraint(
> check=(Q(target_value__gt=0) & ~Q(target_metric=DEFAULT)) |
>   (Q(enabled=False) |
>Q(status=IMPORTING) |
>Q(status=IMPORT_FAILURE)),
> name="positive_target_value",
> )
> ]
>
>
> It would seem straightforward enough to me, but it ends up not working.
> Here is the generated SQL (pulled from the db itself):
> target_value > 0.0::double precision AND NOT target_metric::text = 
> 'DEFAULT'::text OR enabled = false OR status = 20 OR status = 30
>
> And here is proof that it should actually work (pulled from a django 
> console, where the conditions are copied from the migration file):
>
> Folder.objects.filter(models.Q(models.Q(('target_value__gt', 0), 
> models.Q(_negated=True, target_metric='DEFAULT')), ('enabled', False), 
> ('status', 20), ('status', 30), _connector='OR'))
> web_1   | Out[5]: ]>
> Folder.objects.filter(models.Q(models.Q(('target_value__gt', 0), 
> models.Q(_negated=True, target_metric='**SOMETHING DIFFERENT**')), 
> ('enabled', False), ('status', 20), ('status', 30), _connector='OR'))
> web_1   | Out[7]: , < 
> Folder: Folder thisFolderShouldNotHaveBeenCreted>]>
>
>
> Anybody has any suggestion?
> Btw, I also tried switching the first condition with the second one, 
> effectively putting the AND at the bottom of the query, but it didn't seem 
> to have any effect.
>
> Thanks a lot.
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/d11734fe-1691-419e-bf87-792981315901%40googlegroups.com.


problem with user autentication

2020-04-03 Thread Luca Bertolotti
Hello i can't authenticate user

I have crete the user with:

def create_user(request

us = request.POST['username']
ml = request.POST['email']
passw = request.POST['password']
User.objects.create_user(us, ml, passw)

   return..

I see the user in the database

than i need to autenticate for the login

def check_user(request):
email = request.POST.get('email')
username = request.POST.get('username')
password = request.POST.get('password')
user = authenticate(username=username, password=password, email=email)
if user is not None:
login(request, user)
return redirect('aabb')
else:
return ..

but i never get the user object, user and password are correct

Can you help me

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/0295bf65-6cfc-4614-9476-799589d507e7%40googlegroups.com.


Re: problem with user autentication

2020-04-03 Thread ahmed elabbasy
u must include the save method

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/ddc2ee9b-cb3a-4b6d-8c1e-2000b7e9097d%40googlegroups.com.


Re: problem with user autentication

2020-04-03 Thread Motaz Hejaze
authenticate take only 2 parameters :
1 - username_field ( default : username , if you changed it to email you
need to pass email )
2 - password



On Sat, Apr 4, 2020 at 1:19 AM ahmed elabbasy 
wrote:

> u must include the save method
>
> --
> 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/ddc2ee9b-cb3a-4b6d-8c1e-2000b7e9097d%40googlegroups.com
> 
> .
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAHV4E-eSXM264SAjvvnhuUeETKz7L_S6zqNEWhWuEE0eUhK8nQ%40mail.gmail.com.


Working with forms

2020-04-03 Thread Ifeanyi Chielo
Hello,I developed a form with a single field, but this form displays only 
the submit button at the browser as shown in the image below. Please how 
can I correct this and also  save the field to the MySQL table.  My code is 
also shown below

[image: django form.png]

View.py 

from django.http import HttpResponseRedirect

from django.shortcuts import render

from .models import Namerec

from .forms import NameForm

from django.views.generic import TemplateView

 

def HomePageView (request, *args, **kwargs):

 return render(request,"home.html", {})

def Namev_view (request):

if request.method == 'POST':

form = NameForm (request.POST)

if NameForm.is_valid():

NameForm.save()

context = {

'form': form

}

return render(request, 'namev.html', {})

form.py

from .models import Namerec

from django import forms

class NameForm(forms.Form):

your_name = forms.CharField(label='Your name', max_length=100)

template (namev.htlm)



{% csrf_token %}

{{ form  }}





 

 

Model.py 

from django.db import models

class Namerec(models.Model):

your_name = models.CharField(max_length=30)

   

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/f50577dd-d5c0-4478-8993-7bab533f24f9%40googlegroups.com.


Re: Working with forms

2020-04-03 Thread victor awakan
In the form template tag, shouldn’t it be {{ form.as_p}} tag?

On Sat 4. Apr 2020 at 3.35, Ifeanyi Chielo 
wrote:

> Hello,I developed a form with a single field, but this form displays only
> the submit button at the browser as shown in the image below. Please how
> can I correct this and also  save the field to the MySQL table.  My code is
> also shown below
>
> [image: django form.png]
>
> View.py
>
> from django.http import HttpResponseRedirect
>
> from django.shortcuts import render
>
> from .models import Namerec
>
> from .forms import NameForm
>
> from django.views.generic import TemplateView
>
>
>
> def HomePageView (request, *args, **kwargs):
>
>  return render(request,"home.html", {})
>
> def Namev_view (request):
>
> if request.method == 'POST':
>
> form = NameForm (request.POST)
>
> if NameForm.is_valid():
>
> NameForm.save()
>
> context = {
>
> 'form': form
>
> }
>
> return render(request, 'namev.html', {})
>
> form.py
>
> from .models import Namerec
>
> from django import forms
>
> class NameForm(forms.Form):
>
> your_name = forms.CharField(label='Your name', max_length=100)
>
> template (namev.htlm)
>
> 
>
> {% csrf_token %}
>
> {{ form  }}
>
> 
>
> 
>
>
>
>
>
> Model.py
>
> from django.db import models
>
> class Namerec(models.Model):
>
> your_name = models.CharField(max_length=30)
>
>
>
> --
> 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/f50577dd-d5c0-4478-8993-7bab533f24f9%40googlegroups.com
> 
> .
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAAipwd8nHw9WeLmhG2Eo7o5NztkJZ7xWSLa8d%3D-1_yiVjw6CrQ%40mail.gmail.com.


Re: Working with forms

2020-04-03 Thread Ifeanyi Chielo
Thanks Victor, 
I did it and it does not make any cnange

On Saturday, April 4, 2020 at 1:41:19 AM UTC+1, victor awakan wrote:
>
> In the form template tag, shouldn’t it be {{ form.as_p}} tag?
>
> On Sat 4. Apr 2020 at 3.35, Ifeanyi Chielo  > wrote:
>
>> Hello,I developed a form with a single field, but this form displays only 
>> the submit button at the browser as shown in the image below. Please how 
>> can I correct this and also  save the field to the MySQL table.  My code is 
>> also shown below
>>
>> [image: django form.png]
>>
>> View.py 
>>
>> from django.http import HttpResponseRedirect
>>
>> from django.shortcuts import render
>>
>> from .models import Namerec
>>
>> from .forms import NameForm
>>
>> from django.views.generic import TemplateView
>>
>>  
>>
>> def HomePageView (request, *args, **kwargs):
>>
>>  return render(request,"home.html", {})
>>
>> def Namev_view (request):
>>
>> if request.method == 'POST':
>>
>> form = NameForm (request.POST)
>>
>> if NameForm.is_valid():
>>
>> NameForm.save()
>>
>> context = {
>>
>> 'form': form
>>
>> }
>>
>> return render(request, 'namev.html', {})
>>
>> form.py
>>
>> from .models import Namerec
>>
>> from django import forms
>>
>> class NameForm(forms.Form):
>>
>> your_name = forms.CharField(label='Your name', max_length=100)
>>
>> template (namev.htlm)
>>
>> 
>>
>> {% csrf_token %}
>>
>> {{ form  }}
>>
>> 
>>
>> 
>>
>>  
>>
>>  
>>
>> Model.py 
>>
>> from django.db import models
>>
>> class Namerec(models.Model):
>>
>> your_name = models.CharField(max_length=30)
>>
>>
>>
>> -- 
>> 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...@googlegroups.com .
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/django-users/f50577dd-d5c0-4478-8993-7bab533f24f9%40googlegroups.com
>>  
>> 
>> .
>>
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/9825aec7-7e87-4d4a-80f9-634cb9e4dd59%40googlegroups.com.


Re: Working with forms

2020-04-03 Thread Bruckner de Villiers
Please share code for home.html & urls.py.  Also have you included the app name 
in the settings.py?

Thanks,

 

Bruckner de Villiers

083 625 1086

 

From:  on behalf of Ifeanyi Chielo 

Reply to: 
Date: Saturday, 04 April 2020 at 02:51
To: Django users 
Subject: Re: Working with forms

 

Thanks Victor, 

I did it and it does not make any cnange


On Saturday, April 4, 2020 at 1:41:19 AM UTC+1, victor awakan wrote:

In the form template tag, shouldn’t it be {{ form.as_p}} tag?

 

On Sat 4. Apr 2020 at 3.35, Ifeanyi Chielo  wrote:

Hello,I developed a form with a single field, but this form displays only the 
submit button at the browser as shown in the image below. Please how can I 
correct this and also  save the field to the MySQL table.  My code is also 
shown below

 

View.py 

from django.http import HttpResponseRedirect

from django.shortcuts import render

from .models import Namerec

from .forms import NameForm

from django.views.generic import TemplateView

 

def HomePageView (request, *args, **kwargs):

 return render(request,"home.html", {})

def Namev_view (request):

if request.method == 'POST':

form = NameForm (request.POST)

if NameForm.is_valid():

NameForm.save()

context = {

'form': form

}

return render(request, 'namev.html', {})

form.py

from .models import Namerec

from django import forms

class NameForm(forms.Form):

your_name = forms.CharField(label='Your name', max_length=100)

template (namev.htlm)



{% csrf_token %}

{{ form  }}





 


 

Model.py 

from django.db import models

class Namerec(models.Model):

your_name = models.CharField(max_length=30)

   

 

-- 
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...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/f50577dd-d5c0-4478-8993-7bab533f24f9%40googlegroups.com.

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/9825aec7-7e87-4d4a-80f9-634cb9e4dd59%40googlegroups.com.


-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/E47A5C26-9855-4ED7-86AD-3F427A2E88B7%40gmail.com.