Sunday, January 30, 2022

Re: Syntax to Generate salary for next month

use filter method 

On Sun, 30 Jan 2022, 4:50 am Feroz Ahmed, <feroz.resh@gmail.com> wrote:

Hi,

I came across the problem, how to generate salary for upcoming month ( records are of month January in db)

 

 

I have records in django db.

Insert of new record

update / delete / hide    of record functions are ok

 

Request your support, to generate the salary for month February (by clicking on generate salary button) see pic2 below.

 

syntax to code in views??

 

model.py

Fields are :    month , cmonth, name, salary

 

* month field is in list format , (values from January to December)

                                                                                          pic1

                                                                                         

 

                                                                                          pic2

--
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+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/61f5d2a5.1c69fb81.f300.5a1c%40mx.google.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+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAD54KQYLH8ROS13ksObkLRd7V8Z3yfK0%3DZ4G0jbuSfe%3D46qoSw%40mail.gmail.com.

Saturday, January 29, 2022

Syntax to Generate salary for next month

Hi,

I came across the problem, how to generate salary for upcoming month ( records are of month January in db)

 

 

I have records in django db.

Insert of new record

update / delete / hide    of record functions are ok

 

Request your support, to generate the salary for month February (by clicking on generate salary button) see pic2 below.

 

syntax to code in views??

 

model.py

Fields are :    month , cmonth, name, salary

 

* month field is in list format , (values from January to December)

                                                                                          pic1

                                                                                         

 

                                                                                          pic2

Re: Download html pages as pdf using headless Chrome


from request.get("https://---") i am getting instance of requests.models.Response, how can i convert it to pdf

On Sat, Jan 29, 2022 at 9:31 PM Vishesh Mangla <manglavishesh64@gmail.com> wrote:
Get the link and cookies from the webdriver and put that in requests.get using request library to download the html on the page.

On Sat, 29 Jan 2022, 21:29 Vishesh Mangla, <manglavishesh64@gmail.com> wrote:
Use requests for that .

On Sat, 29 Jan 2022, 21:28 Aadil Rashid, <aadil10121998@gmail.com> wrote:
Hello Django Family, I came across the problem of downloading HTML pages as pdf using headless chrome, Can anybody here who could please let me know how can I do it or any good resource to follow, it would be appreciable. I am using Django python,
Thank you very much.

--
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+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAAYXZx-Ar-PeKeOLA27TgTwQoct3e9Y1E%2BAPtWyPQMq78EaTNg%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+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CACaE8x5C2dihUH4iapMvu8aqMZFWFfpF6VRPHA%2BEkF5PhDQDJA%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+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAAYXZx-1w-U-LrNM2fG3WzMohXY-PayNCdw53rR2osKM7BNyhw%40mail.gmail.com.

Re: Download html pages as pdf using headless Chrome

Get the link and cookies from the webdriver and put that in requests.get using request library to download the html on the page.

On Sat, 29 Jan 2022, 21:29 Vishesh Mangla, <manglavishesh64@gmail.com> wrote:
Use requests for that .

On Sat, 29 Jan 2022, 21:28 Aadil Rashid, <aadil10121998@gmail.com> wrote:
Hello Django Family, I came across the problem of downloading HTML pages as pdf using headless chrome, Can anybody here who could please let me know how can I do it or any good resource to follow, it would be appreciable. I am using Django python,
Thank you very much.

--
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+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAAYXZx-Ar-PeKeOLA27TgTwQoct3e9Y1E%2BAPtWyPQMq78EaTNg%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+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CACaE8x5C2dihUH4iapMvu8aqMZFWFfpF6VRPHA%2BEkF5PhDQDJA%40mail.gmail.com.

Re: Download html pages as pdf using headless Chrome

Use requests for that .

On Sat, 29 Jan 2022, 21:28 Aadil Rashid, <aadil10121998@gmail.com> wrote:
Hello Django Family, I came across the problem of downloading HTML pages as pdf using headless chrome, Can anybody here who could please let me know how can I do it or any good resource to follow, it would be appreciable. I am using Django python,
Thank you very much.

--
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+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAAYXZx-Ar-PeKeOLA27TgTwQoct3e9Y1E%2BAPtWyPQMq78EaTNg%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+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CACaE8x4R2oyqJGjDPM7t_%2Be4mF52bO%3DZB82AiQd11iYDzDTDQg%40mail.gmail.com.

Download html pages as pdf using headless Chrome

Hello Django Family, I came across the problem of downloading HTML pages as pdf using headless chrome, Can anybody here who could please let me know how can I do it or any good resource to follow, it would be appreciable. I am using Django python,
Thank you very much.

--
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+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAAYXZx-Ar-PeKeOLA27TgTwQoct3e9Y1E%2BAPtWyPQMq78EaTNg%40mail.gmail.com.

Friday, January 28, 2022

Re: Queryset in settings.py?

The solution I think of for this is to overwrite get_template_names

https://ccbv.co.uk/projects/Django/4.0/django.views.generic.base/TemplateView/#get_template_names

I quickly made a draft implementation (which I couldn't test)


from django.core.exceptions import ImproperlyConfigured
from django.views.generic import TemplateView
from app.models import UserTemplate

class PrependTemplatePathMixin:

    def get_template_names(self):
        """
        Return a list of template names to be used for the request. Must return
        a list. May not be called if render_to_response() is overridden.
        """
        if self.template_name is None:
            raise ImproperlyConfigured(
                "PrependTemplatePathMixin requires either a definition of "
                "'template_name' or an implementation of 'get_template_names()'")
        else:
            user_template = UserTemplate.object.get(
                user_id=self.request.user.pk
            )
            template_namespace = user_template.template_namespace.strip().replace('..', '').lstrip('/')
            template_name = f'{template_namespace}/{self.template_name}'
            return [template_name]


class MyTemplateView(PrependTemplatePathMixin, TemplateView):
    template_name = 'my-template.html'



another option is to use or implement something similar to https://github.com/jazzband/django-dbtemplates/


Em sex., 28 de jan. de 2022 às 20:20, Sebastian Jung <sebastian.jung2@gmail.com> escreveu:
Hello Fabio,

i want that admin can make in database a entry to a field in my own settings model in field standardtemplatepath for example /newtemplate/ in my views.py there are exists a normal CBV Templateview with template_name = 'Testtemplate.html' and in settings.py i have a entry TEMPLATES = [
    {
       
        'DIRS': [
            location('templates'),
        ]}

Now when a endcustomer open this view then this view get template from /templates/newtemplate/Testtemplate.html. How can archive this?

Thank you very much

Am Sa., 29. Jan. 2022 um 00:14 Uhr schrieb Fabio C. Barrionuevo da Luz <bnafta@gmail.com>:
Hi Sebastian, I guess this is not possible.

But the real question is: why do you need a queryset to perform in the settings?

Perhaps if you explain what problem you want to solve, we can give you some options for other possible solutions.



Em sex., 28 de jan. de 2022 às 20:00, sebasti...@gmail.com <sebastian.jung2@gmail.com> escreveu:
Hello,

i want to import from a app models.py like this:

from app1.models import classname

then i get:

django.core.exceptions.AppRegistryNotReady: Apps aren't loaded yet.

I want to get a queryset from app1.models.classname in settings.py. How is this possible?

Regards

--
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+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/18ef496c-c9a1-40df-b251-7ce2cc2dad82n%40googlegroups.com.


--
Fábio C. Barrionuevo da Luz
Palmas - Tocantins - Brasil - América do Sul


Blog colaborativo sobre Python e tecnologias Relacionadas, mantido totalmente no https://github.com/pythonclub/pythonclub.github.io .

Todos são livres para publicar. É só fazer fork, escrever sua postagem e mandar o pull-request. Leia mais sobre como publicar em README.md e contributing.md.
Regra básica de postagem:
"Você" acha interessante? É útil para "você"? Pode ser utilizado com Python ou é útil para quem usa Python? Está esperando o que? Publica logo, que estou louco para ler...

--
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+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAPVjvMaWUcpwzWePO3XF%2BtqRP3e-YFH4iE9om8ig2hhTeazN%3DQ%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+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAKGT9myirfhUNdMhThSMFwCVStWgpYyFfJUZb6uieD%3Dt%3DMipkA%40mail.gmail.com.


--
Fábio C. Barrionuevo da Luz
Palmas - Tocantins - Brasil - América do Sul


Blog colaborativo sobre Python e tecnologias Relacionadas, mantido totalmente no https://github.com/pythonclub/pythonclub.github.io .

Todos são livres para publicar. É só fazer fork, escrever sua postagem e mandar o pull-request. Leia mais sobre como publicar em README.md e contributing.md.
Regra básica de postagem:
"Você" acha interessante? É útil para "você"? Pode ser utilizado com Python ou é útil para quem usa Python? Está esperando o que? Publica logo, que estou louco para ler...

--
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+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAPVjvMa-5LXwnHU8UCTdqQYXwvkvFpGc27tYZk8%2BTLDUZfJ1Rw%40mail.gmail.com.