First DRF project.

2021-03-11 Thread Kelvin Sajere
Good day everyone,

I’ve been developing web applications in django since late 2019, I have
done quite a number of projects, but I always felt using django for just
the backend and maybe a frontend framework for the frontend would actually
be better. I decided to look into vue this January, and developed an app
for listening, reading and sharing positivity. The backend is developed
with django and DRF, while the frontend is developed with Vuejs. It’s a
PWA, so it comes installable on Pc and Android devices. Check it out and
let me know what you think. Thanks. https://divineword.life
-- 
KeLLs

-- 
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/CADYqDX2WkAEpsqinw%2BCfqyG_qDC8P%3DyfXYppzekYvSbyjrF32Q%40mail.gmail.com.


Model inheritance with optional self reference

2021-03-11 Thread Mateusz Wroblewski
Hi All,

does anybody have experience with the following data model and could advise 
which Django tools fit it best?

Background:
I have two types of Components (Core and Complex) that share many 
attributes and methods, but also have their own, specific data fields and 
methods.

What complicates the design is the fact, that ComplexComponent might have 
CoreComponents assigned to it. A CoreComponent instance might be a 
"self-standing" entity without any relation to ComplexComponent, but there 
are also CoreComponents created only for the purpose of "building" 
ComplexComponents.
ComplexComponent (although complex :) ) might (or might not) use 
CoreComponents in its structure ("complexity" comes then from a different, 
unrelated feature).

99.99% of the time I need to be able to handle instances of CoreComponent 
(self-standing entities) and instances of ComplexComponent (with their 
linked core components) separately in different views/areas of my 
application, however I can envision some special use cases where I would 
need to use aggregation on both types to return data for some dash board 
type of views (e.g. average cost of all components created this year).
Also, when a ComplexComponent is handled/displayed in the view, I need to 
be able to access CoreComponents that "compose" it (if applicable).

I'm trying to figure out what Django tools to use for modelling this setup 
and would be thankful to hear your take on that problem.

My current setup uses base Component concrete model and 
CoreComponent/ComplexComponent deriving from it (and also being concrete 
models).
I end up with three different tables. Having core components and complex 
components in separate tables seemed right initially, but I know this 
approach might be difficult to handle down the road, so I'm thinking about 
restructuring it and using e.g. Proxy models instead? If I rebuild these 
models now, I would prefer to do it "right".

Does anybody have experience with a similar (the same?) design and could 
advise what would be the best tool in Django to implement this?

Below a simplified view of the classes in scope (only for demonstration 
purpose).

Many thanks for any feedback.

Have a nice day!

-- 
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/36e6d27b-fd5d-4891-b999-0863a81ade85n%40googlegroups.com.


Re: First DRF project.

2021-03-11 Thread ajaykumar...@gmail.com
Hi KeLLs, I want to develop the website like you developed...

Regards,
Ajay 

On Thursday, March 11, 2021 at 3:51:43 PM UTC+5:30 kells...@gmail.com wrote:

> Good day everyone, 
>
> I’ve been developing web applications in django since late 2019, I have 
> done quite a number of projects, but I always felt using django for just 
> the backend and maybe a frontend framework for the frontend would actually 
> be better. I decided to look into vue this January, and developed an app 
> for listening, reading and sharing positivity. The backend is developed 
> with django and DRF, while the frontend is developed with Vuejs. It’s a 
> PWA, so it comes installable on Pc and Android devices. Check it out and 
> let me know what you think. Thanks. https://divineword.life
> -- 
> KeLLs
>

-- 
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/5548dae8-f614-4135-aff5-e9b3fbae4452n%40googlegroups.com.


Re: First DRF project.

2021-03-11 Thread sakshi jain
nice

On Thu, Mar 11, 2021, 16:07 ajaykumar...@gmail.com <
ajaykumar.bit.1...@gmail.com> wrote:

> Hi KeLLs, I want to develop the website like you developed...
>
> Regards,
> Ajay
>
> On Thursday, March 11, 2021 at 3:51:43 PM UTC+5:30 kells...@gmail.com
> wrote:
>
>> Good day everyone,
>>
>> I’ve been developing web applications in django since late 2019, I have
>> done quite a number of projects, but I always felt using django for just
>> the backend and maybe a frontend framework for the frontend would actually
>> be better. I decided to look into vue this January, and developed an app
>> for listening, reading and sharing positivity. The backend is developed
>> with django and DRF, while the frontend is developed with Vuejs. It’s a
>> PWA, so it comes installable on Pc and Android devices. Check it out and
>> let me know what you think. Thanks. https://divineword.life
>> --
>> KeLLs
>>
> --
> 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/5548dae8-f614-4135-aff5-e9b3fbae4452n%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/CAJhs3iOOcwTm4nm8WEDA4wbjvkXVLyTdjzuOudkecVYr_opPSg%40mail.gmail.com.


Re: Model inheritance with optional self reference

2021-03-11 Thread Kunal Solanke
That's too hard of a problem statement for me,ig more experienced people
will be able to answer it more properly. But if its 99.99% I'd go with
whatever you have right now, rather than creating bunch or proxy models.

On Thu, Mar 11, 2021, 16:06 Mateusz Wroblewski  wrote:

> Hi All,
>
> does anybody have experience with the following data model and could
> advise which Django tools fit it best?
>
> Background:
> I have two types of Components (Core and Complex) that share many
> attributes and methods, but also have their own, specific data fields and
> methods.
>
> What complicates the design is the fact, that ComplexComponent might have
> CoreComponents assigned to it. A CoreComponent instance might be a
> "self-standing" entity without any relation to ComplexComponent, but there
> are also CoreComponents created only for the purpose of "building"
> ComplexComponents.
> ComplexComponent (although complex :) ) might (or might not) use
> CoreComponents in its structure ("complexity" comes then from a different,
> unrelated feature).
>
> 99.99% of the time I need to be able to handle instances of CoreComponent
> (self-standing entities) and instances of ComplexComponent (with their
> linked core components) separately in different views/areas of my
> application, however I can envision some special use cases where I would
> need to use aggregation on both types to return data for some dash board
> type of views (e.g. average cost of all components created this year).
> Also, when a ComplexComponent is handled/displayed in the view, I need to
> be able to access CoreComponents that "compose" it (if applicable).
>
> I'm trying to figure out what Django tools to use for modelling this setup
> and would be thankful to hear your take on that problem.
>
> My current setup uses base Component concrete model and
> CoreComponent/ComplexComponent deriving from it (and also being concrete
> models).
> I end up with three different tables. Having core components and complex
> components in separate tables seemed right initially, but I know this
> approach might be difficult to handle down the road, so I'm thinking about
> restructuring it and using e.g. Proxy models instead? If I rebuild these
> models now, I would prefer to do it "right".
>
> Does anybody have experience with a similar (the same?) design and could
> advise what would be the best tool in Django to implement this?
>
> Below a simplified view of the classes in scope (only for demonstration
> purpose).
>
> Many thanks for any feedback.
>
> Have a nice day!
>
> --
> 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/36e6d27b-fd5d-4891-b999-0863a81ade85n%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/CAOecAnyLK2seCjbMrEtSj5KWqKEPmFNgDXoKw%3DUYU2PHwHfn6g%40mail.gmail.com.


Re: Model inheritance with optional self reference

2021-03-11 Thread Kunal Solanke
Btw parts should be a m2m field ig.

On Thu, Mar 11, 2021, 16:14 Kunal Solanke 
wrote:

> That's too hard of a problem statement for me,ig more experienced people
> will be able to answer it more properly. But if its 99.99% I'd go with
> whatever you have right now, rather than creating bunch or proxy models.
>
> On Thu, Mar 11, 2021, 16:06 Mateusz Wroblewski  wrote:
>
>> Hi All,
>>
>> does anybody have experience with the following data model and could
>> advise which Django tools fit it best?
>>
>> Background:
>> I have two types of Components (Core and Complex) that share many
>> attributes and methods, but also have their own, specific data fields and
>> methods.
>>
>> What complicates the design is the fact, that ComplexComponent might have
>> CoreComponents assigned to it. A CoreComponent instance might be a
>> "self-standing" entity without any relation to ComplexComponent, but there
>> are also CoreComponents created only for the purpose of "building"
>> ComplexComponents.
>> ComplexComponent (although complex :) ) might (or might not) use
>> CoreComponents in its structure ("complexity" comes then from a different,
>> unrelated feature).
>>
>> 99.99% of the time I need to be able to handle instances of CoreComponent
>> (self-standing entities) and instances of ComplexComponent (with their
>> linked core components) separately in different views/areas of my
>> application, however I can envision some special use cases where I would
>> need to use aggregation on both types to return data for some dash board
>> type of views (e.g. average cost of all components created this year).
>> Also, when a ComplexComponent is handled/displayed in the view, I need to
>> be able to access CoreComponents that "compose" it (if applicable).
>>
>> I'm trying to figure out what Django tools to use for modelling this
>> setup and would be thankful to hear your take on that problem.
>>
>> My current setup uses base Component concrete model and
>> CoreComponent/ComplexComponent deriving from it (and also being concrete
>> models).
>> I end up with three different tables. Having core components and complex
>> components in separate tables seemed right initially, but I know this
>> approach might be difficult to handle down the road, so I'm thinking about
>> restructuring it and using e.g. Proxy models instead? If I rebuild these
>> models now, I would prefer to do it "right".
>>
>> Does anybody have experience with a similar (the same?) design and could
>> advise what would be the best tool in Django to implement this?
>>
>> Below a simplified view of the classes in scope (only for demonstration
>> purpose).
>>
>> Many thanks for any feedback.
>>
>> Have a nice day!
>>
>> --
>> 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/36e6d27b-fd5d-4891-b999-0863a81ade85n%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/CAOecAnwV_Zi3%3DdrUnUkChszUHktP13GO3fKkso1EA3QGjDKvjw%40mail.gmail.com.


Re: First DRF project.

2021-03-11 Thread Kelvin Sajere
Hi Ajay,
If you would like to build something like this, then you should look into
Vuejs. I also used a design framework for Vuejs called Vuetify. You don’t
even get to see all of the amazing features the site has until you’re
logged in. I would really appreciate some positive or negative feedback
from you all. Thanks.

On Thu, Mar 11, 2021 at 05:37 ajaykumar...@gmail.com <
ajaykumar.bit.1...@gmail.com> wrote:

> Hi KeLLs, I want to develop the website like you developed...
>
> Regards,
> Ajay
>
> On Thursday, March 11, 2021 at 3:51:43 PM UTC+5:30 kells...@gmail.com
> wrote:
>
>> Good day everyone,
>>
>> I’ve been developing web applications in django since late 2019, I have
>> done quite a number of projects, but I always felt using django for just
>> the backend and maybe a frontend framework for the frontend would actually
>> be better. I decided to look into vue this January, and developed an app
>> for listening, reading and sharing positivity. The backend is developed
>> with django and DRF, while the frontend is developed with Vuejs. It’s a
>> PWA, so it comes installable on Pc and Android devices. Check it out and
>> let me know what you think. Thanks. https://divineword.life
>> --
>> KeLLs
>>
> --
> 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/5548dae8-f614-4135-aff5-e9b3fbae4452n%40googlegroups.com
> 
> .
>
-- 
KeLLs

-- 
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/CADYqDX2jUax%2BbbYS8cdMaVKbOwu6nADzq5LzA%3DUhTPVCjYi%2B4A%40mail.gmail.com.


Why does my django form with recaptcha send data even empty the recaptcha?

2021-03-11 Thread Sergei Sokov
I put the google recaptcha V2 to my django project form. It looks like 
working, but if I leave empty the recaptcha checkbox my form is sent still.

forms.py
from django import
forms from captcha.fields
import ReCaptchaField
from django.forms import Textarea
from .models import *
class CustomerForm(forms.ModelForm):
captcha = ReCaptchaField( public_key='key', private_key='key', )
class Meta:
model = Customer fields = '__all__'
def __init__(self, *args, **kwargs):
# get 'user' param from kwargs
user = kwargs.pop('user', None)
super().__init__(*args, **kwargs)
self.fields['message'].widget = Textarea(attrs={'rows': 4})
self.fields['i_have_read_rules'].widget.attrs['required'] = 'True'
self.fields['i_agree'].widget.attrs['required'] = 'True'
self.fields['captcha'].widget.attrs['required'] = 'True'
for field in self.fields:
self.fields[field].widget.attrs['class'] = 'form-control'
self.fields['i_have_read_rules'].widget.attrs['class'] = 
'form-check'
self.fields['i_agree'].widget.attrs['class'] = 'form-check'

html

{% csrf_token %}
Выберите услугу
{{form.choice_services}}
{{form.name}}
{{form.telephone_number}}
{{form.email}}
{{form.message}}
{{form.contact_text}}
 {{ 
form.captcha }}


-- 
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/e18dcba2-07e2-44d9-ace6-744a2bb69234n%40googlegroups.com.


Re: Why does my django form with recaptcha send data even empty the recaptcha?

2021-03-11 Thread Gabriel Araya Garcia
Camarada Sokov:
Your code is very difficult to understand at first sight. I did not know
about ReCaptchaField().
But, is interesting to learn something new.

Recards,

Gabriel Araya Garcia
GMI - Desarrollo de Sistemas Informáticos
from Santiago de Chile



El jue, 11 mar 2021 a las 12:40, Sergei Sokov ()
escribió:

> I put the google recaptcha V2 to my django project form. It looks like
> working, but if I leave empty the recaptcha checkbox my form is sent still.
>
> forms.py
> from django import
> forms from captcha.fields
> import ReCaptchaField
> from django.forms import Textarea
> from .models import *
> class CustomerForm(forms.ModelForm):
> captcha = ReCaptchaField( public_key='key', private_key='key', )
> class Meta:
> model = Customer fields = '__all__'
> def __init__(self, *args, **kwargs):
> # get 'user' param from kwargs
> user = kwargs.pop('user', None)
> super().__init__(*args, **kwargs)
> self.fields['message'].widget = Textarea(attrs={'rows': 4})
> self.fields['i_have_read_rules'].widget.attrs['required'] = 'True'
> self.fields['i_agree'].widget.attrs['required'] = 'True'
> self.fields['captcha'].widget.attrs['required'] = 'True'
> for field in self.fields:
> self.fields[field].widget.attrs['class'] = 'form-control'
> self.fields['i_have_read_rules'].widget.attrs['class'] =
> 'form-check'
> self.fields['i_agree'].widget.attrs['class'] = 'form-check'
>
> html
> 
> {% csrf_token %}
> Выберите услугу
> {{form.choice_services}}
> {{form.name}}
> {{form.telephone_number}}
> {{form.email}}
> {{form.message}}
> {{form.contact_text}}
>  {{
> form.captcha }}
> 
>
> --
> 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/e18dcba2-07e2-44d9-ace6-744a2bb69234n%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/CAKVvSDD_HZmL%2BUVgsFVZgQCuyuhCs3Ofe2DkOtne-ydp%2B3joyw%40mail.gmail.com.