Using ModelForm to get labels in a DetailView

2021-09-19 Thread bnmng
I don't know if this is good practice, but to get field labels in a 
DetailView, it seems to work fine if you just add a form to the context:

views.py:

class ItemDetailView(DetailView):

model = Item
context_object_name = "item"

def get_context_data(self, **kwargs):
context_data = super().get_context_data(**kwargs)
context_data['form'] = ItemForm # just to get the labels
return context_data


item_detail_view.html:

{{ form.name.label_tag }} {{ 
item.name }}
{{ form.notes.label_tag }} {{ 
item.notes }}
{{ form.asset_number.label_tag }} {{ item.asset_number }}
{{ form.serial_number.label_tag }} {{ item.serial_number }}
{{ form.network_name.label_tag }} {{ item.network_name }}

-- 
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/e84f2b57-6e64-4801-bd0f-ff8525e93ba1n%40googlegroups.com.


Re: Idea

2021-09-19 Thread Helin Cao
To answer your 2nd question: there is PyWebIO, an open-source library that
allows you to write web UI using only Python and deploy it as a Django app:
GitHub: https://github.com/pywebio/PyWebIO
Doc: https://pywebio.readthedocs.io/en/latest/

BTW, if you like other Python-based web frameworks, it also supports, such
as Flask, FastAPI etc.

On Sat, Sep 18, 2021 at 3:11 PM Jet Ezra  wrote:

> I know this may not be necessary at the moment because we are comfortable
> depending on front-end frameworks, but I have my two ideas here:
> 1. what if django alone without any framework can be used to design
> progressive web apps, with routers that do not reload the page, we
> currently have one of the best routing but what if they support SPAs this
> time?
> 2. what if we could instead of Javascript in the templates, we write
> python, case in example is forexample how we write C# in .NET withing our
> templates not writing JavaScript. Currently DJango is requiring its
> developer to again go ahead and learn JS too, what if we remove that??
>
>
> --
> 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/e050d91d-7c5b-40ff-8501-41d8008de627n%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/CAHRR7tySBRvbAukG66ay5e9jsD3on5YUnzYa29HY7CfAaicqEQ%40mail.gmail.com.


Re: Error on import psycopg2

2021-09-19 Thread Felix Orinda
pip install psycopg2-binary
Should work for you. Give me feedback on whether it has worked or not

On Sep 17, 2021 21:18, "Aashish Kumar"  wrote:

install this package 👇

pip install psycopg2-binary

It works perfectly

On Wed, 15 Sep 2021 at 9:40 PM, 'Maryam Yousaf' via Django users <
django-users@googlegroups.com> wrote:

> Hello,
>
> I need psycopg2 for postgres database in django. While installing it, I am
> getting below error. I tried everything on internet but it still there.
> Kindly help me out.
>
> Error:
> "File
> "/Users/maryam.yousaf/Documents/venv/lib/python3.8/site-packages/psycopg2/__init__.py",
> line 51, in 
> from psycopg2._psycopg import ( # noqa
> ImportError:
> dlopen(/Users/maryam.yousaf/Documents/venv/lib/python3.8/site-packages/psycopg2/_
> psycopg.cpython-38-darwin.so, 2): Symbol not found: _PQbackendPID
>   Referenced from:
> /Users/maryam.yousaf/Documents/venv/lib/python3.8/site-packages/psycopg2/_
> psycopg.cpython-38-darwin.so
>   Expected in: flat namespace
>  in
> /Users/maryam.yousaf/Documents/venv/lib/python3.8/site-packages/psycopg2/_
> psycopg.cpython-38-darwin.so"
>
> Regards,
> Maryam.
>
>
> --
> This email and any files transmitted with it contain confidential
> information and/or privileged or personal advice. This email is intended
> for the addressee(s) stated above only. If you are not the addressee of the
> email please do not copy or forward it or otherwise use it or any part of
> it in any form whatsoever. If you have received this email in error please
> notify the sender and remove the e-mail from your system. Thank you.
>
> This is an email from the company Just Eat Takeaway.com N.V., a public
> limited liability company with corporate seat in Amsterdam, the
> Netherlands, and address at Oosterdoksstraat 80, 1011 DK Amsterdam
> ,
> registered with the Dutch Chamber of Commerce with number 08142836 and
> where the context requires, includes its subsidiaries and associated
> undertakings.
>
> --
> 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/a1ed0079-ee5f-4da1-977c-a02ee5600d6dn%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/CACTAcrxJJ-9qqyYW%3DHmXurZypRi6Ve82QjTudOZW2gy40-yVww%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/CAKh5HMsBxjsHJH%3DkbM5pP%3DUKzaFeyPgZdbeHnyLCns7p-1VRsw%40mail.gmail.com.


Re: How to update old data with new data everyday from a scraper

2021-09-19 Thread Adib Neymar Jr.

Interesting, is there a way to peek for an existing record instead of 
calling get to see whether the record exists in the database? I'm thinking 
of making this snippet of code a bit more efficient

try:
   obj = Hackathon.objects.get(**each_dict)
except Hackathon.DoesNotExist:
   obj = Hackathon(**each_dict)
   obj.save()
On Saturday, September 18, 2021 at 10:31:46 AM UTC-4 J.T. wrote:

> Take a look at update_or_create()
>
>
> https://docs.djangoproject.com/en/3.2/ref/models/querysets/#update-or-create
>
> On Sat, Sep 18, 2021, 9:27 AM Adib Neymar Jr.  wrote:
>
>> Hello,
>>
>> What is a good way to compare new data with old data which is updated 
>> everyday with Django ORM? Basically I have a scraper which fetches 
>> hackathons everyday (basically just a celery task) and I want the newest to 
>> be unioned it with my master database which has the latest fetched 
>> hackathons from yesterday. I don't want to destroy my master database and 
>> then just upload everything that I just fetched since that seems wasteful. 
>> This is my strategy in approaching my problem but I am open to hear other 
>> options as well.
>>
>>
>> Thanks,
>>
>>
>>
>> Adib
>>
>> -- 
>> 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...@googlegroups.com.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/django-users/CAN%3Doy7JkqHEtaizgKtHniofSS7T%2BybqVer0mJc1uRPRLupUSdQ%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/07e19d5a-579a-4ec6-91f0-4ccba9790d0fn%40googlegroups.com.


Re: Django

2021-09-19 Thread MR INDIA
Try 
this 
https://stackoverflow.com/questions/35572662/django-runserver-stuck-on-performing-system-checks
 
which django version and any database you are using?


On Sunday, 19 September 2021 at 03:42:11 UTC+5:30 OSV wrote:

> I´m just start with Django and have this issue bellow. Some have the 
> sameWarm greetings for every one
>
>
> "Django runserver stuck on Performing system checks"

-- 
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/d4533610-2909-4161-a760-2631757619edn%40googlegroups.com.


Re: need help integrating SSL with react/django web app

2021-09-19 Thread MR INDIA
Select os and server and it will show the docs, you have to first shutdown 
the server then after following the docs restart the server.


On Saturday, 18 September 2021 at 19:33:31 UTC+5:30 hey there wrote:

> hey
>
> I am with Cloudflare ssl with httpd autonomous linux with mos_wsgi. 
> foe Django you need mod_wsgi with all which is tricky. 
>
> On Sat, Sep 18, 2021 at 7:18 PM MR INDIA  wrote:
>
>> See this 
>> https://certbot.eff.org/lets-encrypt/ubuntufocal-nginx Use letsencrypt 
>> if you have shell access
>> On Saturday, 18 September 2021 at 02:41:54 UTC+5:30 hey there wrote:
>>
>>>
>>> python 3.2.6
>>> django 3.2.7
>>> cx_oracle 8
>>>
>>>
>>>
>>> On Sat, 18 Sep 2021, 2:25 am hey there,  wrote:
>>>
 hi 

 i am also stuck 

 On Monday, May 10, 2021 at 12:21:25 AM UTC+5:30 jmccla...@gmail.com 
 wrote:

> Hello Ammar,
>
> we're stuck, have been for days
>
> We have nginx set in ec2 instance but cannot get the ssl to slip in.
>
> I copied in Divy who is also working to get this solved
>
> any help would be appreciated
>
>
> can you help me with this or provide any documentation
>
> On Sat, 8 May 2021 at 10:16, Ammar Mohammed  
> wrote:
>
>> I am using Nginx as a proxy for my Django app and this method is 
>> working just fine.
>>
>> On Sat, May 8, 2021, 11:14 Ammar Mohammed  wrote:
>>
>>> I think you're supposed to install the certificate in your web 
>>> server (Nginx, Apache).
>>> Follow the manual to install it to your server and everything will 
>>> be fine.
>>>
>>> On Sat, May 8, 2021, 10:35 John McClain  wrote:
>>>
 Hello,

 I am having difficulties connecting SSL to my React/Python webapp

 I am trying to integrate the PWA and am having difficulties getting 
 the SSL to adopt to the app.

 Does anyone have experience with this?

 Cheers

 -- 
 John McClain

 Cell: 085-1977-823
 Skype: jmcclain0129
 Email: jmccla...@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...@googlegroups.com.
 To view this discussion on the web visit 
 https://groups.google.com/d/msgid/django-users/CAN-hv_qHS2wdhuwYQLob1C_uM8vgfpbqnvxGke5oy8CyuT551g%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...@googlegroups.com.
>>
> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/django-users/CAHs1H7stQG2aqWD95LxH3PSUGaijRYL0%2BEmGCWC2s57A4dJwBw%40mail.gmail.com
>>  
>> 
>> .
>>
>
>
> -- 
> John McClain
>
> Cell: 085-1977-823
> Skype: jmcclain0129
> Email: jmccla...@gmail.com
>
 -- 

>>> You received this message because you are subscribed to a topic in the 
 Google Groups "Django users" group.
 To unsubscribe from this topic, visit 
 https://groups.google.com/d/topic/django-users/4WtsxZ6FUJo/unsubscribe.
 To unsubscribe from this group and all its topics, send an email to 
 django-users...@googlegroups.com.
 To view this discussion on the web visit 
 https://groups.google.com/d/msgid/django-users/1c48904e-41b0-4959-8daf-6926f7b95652n%40googlegroups.com
  
 
 .

>>> -- 
>> You received this message because you are subscribed to a topic in the 
>> Google Groups "Django users" group.
>> To unsubscribe from this topic, visit 
>> https://groups.google.com/d/topic/django-users/4WtsxZ6FUJo/unsubscribe.
>> To unsubscribe from this group and all its topics, send an email to 
>> django-users...@googlegroups.com.
>>
> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/django-users/fc47fc8f-2894-4869-b275-4ebe7211c2bbn%40googlegroups.com
>>  
>> 
>> .
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsu

Auto populating business organization logos

2021-09-19 Thread Ram
Hi,

As most of you know LinkedIn automatically adds a logo of a company when
you update your profile with work experience from that company. Similar to
that functionality, is there a  way to auto  populate any business
organizaiton logo in Django?  I guess this can be done using an API but not
sure who provides such API?

Any pointers will be appreciated.

Best regards,
~Ram

-- 
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/CA%2BOi5F1Jy%3DF7eEpqYuf8ET3vHxe6d%2BKijiA02VNqs4WtkZTvLw%40mail.gmail.com.


Re: Auto populating business organization logos

2021-09-19 Thread Shishir Jha
I believe linkedin is not using any api. Why would they need that? All the
companies have their own accounts in the linkedin itself right? Thats how
you apply to them. So linkedin muat be using images from its own database
and not from some third party api.

On Mon, 20 Sep 2021, 6:19 am Ram,  wrote:

> Hi,
>
> As most of you know LinkedIn automatically adds a logo of a company when
> you update your profile with work experience from that company. Similar to
> that functionality, is there a  way to auto  populate any business
> organizaiton logo in Django?  I guess this can be done using an API but not
> sure who provides such API?
>
> Any pointers will be appreciated.
>
> Best regards,
> ~Ram
>
> --
> 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/CA%2BOi5F1Jy%3DF7eEpqYuf8ET3vHxe6d%2BKijiA02VNqs4WtkZTvLw%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/CA%2BC7wFTD5SK_kSpsBbWrL%3DCR7QqyqqRZMPWRoR9bdnw%3D2BcAQw%40mail.gmail.com.


Re: Auto populating business organization logos

2021-09-19 Thread Lalit Suthar
good point @Shishir

Ram you can try getting favicon from the organization url they enter. I
found a package for that also
https://pypi.org/project/favicon/

On Mon, Sep 20, 2021, 6:49 AM Shishir Jha  wrote:

> I believe linkedin is not using any api. Why would they need that? All the
> companies have their own accounts in the linkedin itself right? Thats how
> you apply to them. So linkedin muat be using images from its own database
> and not from some third party api.
>
> On Mon, 20 Sep 2021, 6:19 am Ram,  wrote:
>
>> Hi,
>>
>> As most of you know LinkedIn automatically adds a logo of a company when
>> you update your profile with work experience from that company. Similar to
>> that functionality, is there a  way to auto  populate any business
>> organizaiton logo in Django?  I guess this can be done using an API but not
>> sure who provides such API?
>>
>> Any pointers will be appreciated.
>>
>> Best regards,
>> ~Ram
>>
>> --
>> 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/CA%2BOi5F1Jy%3DF7eEpqYuf8ET3vHxe6d%2BKijiA02VNqs4WtkZTvLw%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/CA%2BC7wFTD5SK_kSpsBbWrL%3DCR7QqyqqRZMPWRoR9bdnw%3D2BcAQw%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/CAGp2JVFJARP-BejWNOnjHD307deJFzYv%3DABmAB8RxYtrcxwKUA%40mail.gmail.com.


'str' object is not callable error appears from Django Message Framework

2021-09-19 Thread Salima Begum
Hi all,


Our web application prompts confirmation messages when user submits the
form and users can continue to submit additional forms while they are using
application and the confirmation messages are prompted fine, but  'str'
object is not callable error appears randomly before prompting a
confirmation message and once this error starts appearing it will continue
to appear for any form submission. During our testing we observed that this
issue is happening  in Django version 3.2.7 (ubuntu 20.x), but it is not
reproducible in Django version 3.1.6 (windows10). So, we think that this
could be a bug in version 3.2.7 . We made sure our code by following this
page.

https://docs.djangoproject.com/en/3.2/ref/contrib/messages/

In views.py :

{{{
 messages.success(request, "Item is successfully removed.")
}}}


In template:

{{{
 {% for message in messages %}


×
{% if message.tags == 'error' %}
   
{{ message|safe }}  
{% else %}
 
   {{ message|safe
}}  
{% endif %}


{% endfor %}
}}}

-- 
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/CAMSz6b%3DJ2OLkOiwpRw2h6H48x6ELb61REWM%3Dj913pssxBZsrhA%40mail.gmail.com.