problem in reloading project files with UWSGI for Django app

2022-04-22 Thread Agnese Camellini
Good morning, today i am facing some issues with my django app at word-b.com
.
The backend is giving me 404 on a reste resource that i have just fixed.
I have uploaded the files in production just now, thinking that the uwsgi
daemon would reload them on demand due to the interpreted nature of python.
But at th moment the resource is unavailable.
I have set the aureload on on the application.ini file and touched the
files, but i am still getting a 404.
Can someone help me out?
Thanks a lot.
Agnese Camellini

-- 
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/CACXuh-RmOJTGFSgvwJY9M8eoWGten_AHQTJQcAbrtJGTKjhbwA%40mail.gmail.com.


Re: Model Design

2022-05-05 Thread Agnese Camellini
i would decouple the importing of data from the database architecture, and
make a meaningfould structure of the models, but your own, not the one of
the client. In this manner you create a design that is meaningful and can
be scaled from the knowledge expressed in the data without being dependant
from the logic of the client, that can change and is not reliable for an
application architecture..
My 2 cents
Agnese

On Thu, 5 May 2022 at 15:36, 'dtdave' via Django users <
django-users@googlegroups.com> wrote:

> We receive data from various third parties in their proprietary format in
> excel. We then import this into our database and our models have been
> designed around their format.
> There is no option to change the way this data is received.
> However, we now need to add an account manager to this data and under
> normal circumstances this would be a case of adding a foreign key to the
> data.
>
> What would be the best method of dealing with this given that we cannot
> change the format of the data we receive nor the current models given that
> they mirror this structure.
> One suggestion has been to use a generic foreign key but I am not sure how
> this would work.
>
> Thanks in advance
>
>
> --
> 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/97d1988f-b230-46a8-93dc-be583860467an%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/CACXuh-QwWtrT5ndTX4fEN8mAanfg24L1Loq1coKH3p%2BkY4oTfw%40mail.gmail.com.


Re: Need help on reducing cognitive complexity

2022-07-20 Thread Agnese Camellini
The only things that comes into my mind is taking away that first if which
is redundant with the third block.
An other way might be to include all the if in a big switch...
My 2 cents
Agnese

On Thu, 21 Jul 2022 at 07:53, Sencer Hamarat 
wrote:

> Hi everyone,
>
> I have a code block with high cognitive complexity below:
>
> @staticmethod
> def in_circle_check(obj_type, item, uuid, item_is_array=False):
>
> if obj_type not in ['trees', 'flowers']:
> return None
>
> plant = get_plant_with_circles(uuid)
> if not plant:
> return None
>
> if obj_type == 'trees':
> if plant['in_all_tree_types']:
> return True
> circle_objects = plant['tree_circle']['items']
> else:
> if plant['in_all_flower_types']:
> return True
> circle_objects = plant['flower_circle']['items']
>
> if isinstance(circle_objects, list):
> if item_is_array:
> for item in item:
> if item not in circle_objects:
> return -1
> return True
> else:
> if item in circle_objects:
> return True
> else:
> return -1
>
> return -1
>
>
> I try to move the first 3 if statements on the beginning of the block into
> new methods but that maneuver ends up with raising complexity.
>
> Can anybody help me to learn how to reduce cognitive complexity in code
> blocks like this?
>
> Kind regards,
> Sencer HAMARAT
>
> --
> 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/CACp8TZhBa9EbekcT1ApmzdDRVk2vCb64%3DvvXHrSawO2RJSySpQ%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/CACXuh-RWFoxAk1zrtzgH0FAHD-XXMwRiDLGyiUr8ZRkhgnihfg%40mail.gmail.com.


how to serialize default user model in drf serializer

2022-12-08 Thread Agnese Camellini
Good morning, i am doing a simple interface which has a foreign to the
default user model:

I find some difficulties in writing the serializer as there's not
serializer for the User default model.
Any idea of how can i solve this?
Below is my model code.

Regards.
AGnese Camellini

from django.conf import settings

class NovelUser(models.Model):
novel = models.ForeignKey(Novel, on_delete=models.DO_NOTHING)
user = models.ForeignKey(settings.AUTH_USER_MODEL, on_delete=
models.DO_NOTHING)

-- 
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/CACXuh-SR_dgBxAKWmrxtYXgDGCT1a51sDBKgK%3D%3Dz369w%3DL6RRg%40mail.gmail.com.


Re: Can't set static file directory.

2013-01-08 Thread Agnese Camellini
I'm not using apache now, i'm just using the development server into
django.
Why is it so difficult to serve static files?
joy

2013/1/8 Mike Dewhirst 

> On 8/01/2013 10:03pm, joy wrote:
>
>> I have the same problem, the tutorial speaks about a list of things to do:
>>
>>   * Push your code up to the deployment server.
>>   * On the server, run collectstatic
>> > staticfiles/#django-admin-**collectstatic
>> >
>> to copy all the static files into STATIC_ROOT
>> > setting-STATIC_ROOT
>> >.
>>   * Point your web server at STATIC_ROOT
>> > setting-STATIC_ROOT
>> >.
>>
>> I have arrived at the second point. But the static files are not served,
>> i have set up the STATIC ROOT and the STATIC_URL, but what should i add
>> to the template src tag to find the pages? The tutorial speaks about the
>> template context processor, but it doesn't exist in my setting.py file.
>>
>> TEMPLATE_CONTEXT_PROCESSORS  =  (
>>  'django.core.context_**processors.debug',
>>  'django.core.context_**processors.i18n',
>>  'django.core.context_**processors.media',
>>  'django.core.context_**processors.static',
>>  'django.contrib.auth.context_**processors.auth',
>>  'django.contrib.messages.**context_processors.messages',
>> )
>>
>> i cannot make my css and javascript work, please, can you explain me what
>> is happening behind the interface?
>> Agnese
>>
>>
>> Il giorno sabato 5 gennaio 2013 19:38:32 UTC+1, MÄ rtiņš JakuboviÄ s
>> ha scritto:
>>
>> Hello.
>>
>> I try a lot of things and can't understand, why not working
>> STATIC_ROOT and MEDIA_ROOT in settings.py.
>>
>> I want, that all my media and static folders is in different place
>> that python files, so I set media, static and templates to different
>> place. Templates TEMPLATE_DIRS works well, bet MEDIA_ROOT
>> and STATIC_ROOT not.
>>
>> I try setup like this:
>>
>> /home/domain/www/my_proj/ there is project folder and all apps, and
>> there I place my htdocs folder, in which is static, templates and
>> media folders.
>>
>> When i set in STATIC_ROOT = '/home/domain/www/my_proj/**
>> htdocs/static'
>>
>> In apache error log i got:
>>
>> File does not exist: /home/domain/www/my_proj/my_**proj/static
>>
>> I don't get, why django don't want to take new setting...
>>
>> I use django 1.4.
>>
>
> I think you need to set up Apache to serve the static and media files.
> Here is how mine works ...
>
>  # lock the public out
>  
>   AllowOverride None
>   Order deny,allow
>   Deny from all
>  
>
>  # serve uploaded media from here
>  
>   AllowOverride None
>   Order deny,allow
>   Allow from all
>  
>
>  # serve static stuff from here
>  
>   AllowOverride None
>   Order deny,allow
>   Allow from all
>  
>
>  
>   Alias /media/ /var/www/media/my_proj/
>   Alias /static/ /var/www/static/my_proj/
>   Alias /tiny_mce/ /var/www/static/my_proj/js/**tiny_mce/
>   Alias /jquery/ /var/www/static/my_proj/js/**jquery/
>  
>
> Then in your template you can use {{ STATIC_URL }}/whatever
>
> Hope this helps
>
> Mike
>
>
>> Thanks.
>>
>> --
>> You received this message because you are subscribed to the Google
>> Groups "Django users" group.
>> To view this discussion on the web visit
>> https://groups.google.com/d/**msg/django-users/-/**fwNEyOLpFb4J
>> .
>> To post to this group, send email to django-users@googlegroups.com.
>> To unsubscribe from this group, send email to
>> django-users+unsubscribe@**googlegroups.com
>> .
>> For more options, visit this group at
>> http://groups.google.com/**group/django-users?hl=en
>> .
>>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to django-users+unsubscribe@**
> googlegroups.com .
> For more options, visit this group at http://groups.google.com/**
> group/django-users?hl=en
> .
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Can't set static file directory.

2013-01-08 Thread Agnese Camellini
I've foud a tutorial <http://www.youtube.com/watch?v=7dbAIuDVyFc>, finally.


Interesting, but it speaks about an older version of Django.

Thank you all for the answers.

2013/1/8 Jonathan 

>  Assuming that you have settings.STATIC_ROOT configured, you can use the
> following snippet to handle URL routing for static files with the dev
> server:
>
> # urls.py
> if settings.DEBUG:
> urlpatterns += patterns('',
> (r'^static/(?P.*)$', 'django.views.static.serve', {
> 'document_root': settings.STATIC_ROOT,
> }),
> )
>
> Feel free to add a similar pattern for media files as well.
>
> Hope this helps,
> Jonathan
>
>
> On 01/08/2013 04:25 AM, Agnese Camellini wrote:
>
> I'm not using apache now, i'm just using the development server into
> django.
> Why is it so difficult to serve static files?
> joy
>
> 2013/1/8 Mike Dewhirst 
>
>> On 8/01/2013 10:03pm, joy wrote:
>>
>>> I have the same problem, the tutorial speaks about a list of things to
>>> do:
>>>
>>>   * Push your code up to the deployment server.
>>>   * On the server, run collectstatic
>>> <
>>> https://docs.djangoproject.com/en/1.4/ref/contrib/staticfiles/#django-admin-collectstatic
>>> >
>>> to copy all the static files into STATIC_ROOT
>>> <
>>> https://docs.djangoproject.com/en/1.4/ref/settings/#std:setting-STATIC_ROOT
>>> >.
>>>   * Point your web server at STATIC_ROOT
>>> <
>>> https://docs.djangoproject.com/en/1.4/ref/settings/#std:setting-STATIC_ROOT
>>> >.
>>>
>>> I have arrived at the second point. But the static files are not served,
>>> i have set up the STATIC ROOT and the STATIC_URL, but what should i add
>>> to the template src tag to find the pages? The tutorial speaks about the
>>> template context processor, but it doesn't exist in my setting.py file.
>>>
>>> TEMPLATE_CONTEXT_PROCESSORS  =  (
>>>  'django.core.context_processors.debug',
>>>  'django.core.context_processors.i18n',
>>>  'django.core.context_processors.media',
>>>  'django.core.context_processors.static',
>>>  'django.contrib.auth.context_processors.auth',
>>>  'django.contrib.messages.context_processors.messages',
>>> )
>>>
>>> i cannot make my css and javascript work, please, can you explain me
>>> what is happening behind the interface?
>>> Agnese
>>>
>>>
>>> Il giorno sabato 5 gennaio 2013 19:38:32 UTC+1, MÄ rtiņš JakuboviÄ s
>>> ha scritto:
>>>
>>> Hello.
>>>
>>> I try a lot of things and can't understand, why not working
>>> STATIC_ROOT and MEDIA_ROOT in settings.py.
>>>
>>> I want, that all my media and static folders is in different place
>>> that python files, so I set media, static and templates to different
>>> place. Templates TEMPLATE_DIRS works well, bet MEDIA_ROOT
>>> and STATIC_ROOT not.
>>>
>>> I try setup like this:
>>>
>>> /home/domain/www/my_proj/ there is project folder and all apps, and
>>> there I place my htdocs folder, in which is static, templates and
>>> media folders.
>>>
>>> When i set in STATIC_ROOT = '/home/domain/www/my_proj/htdocs/static'
>>>
>>> In apache error log i got:
>>>
>>> File does not exist: /home/domain/www/my_proj/my_proj/static
>>>
>>> I don't get, why django don't want to take new setting...
>>>
>>> I use django 1.4.
>>>
>>
>> I think you need to set up Apache to serve the static and media files.
>> Here is how mine works ...
>>
>>  # lock the public out
>>  
>>   AllowOverride None
>>   Order deny,allow
>>   Deny from all
>>  
>>
>>  # serve uploaded media from here
>>  
>>   AllowOverride None
>>   Order deny,allow
>>   Allow from all
>>  
>>
>>  # serve static stuff from here
>>  
>>   AllowOverride None
>>   Order deny,allow
>>   Allow from all
>>  
>>
>>  
>>   Alias /media/ /var/www/media/my_proj/
>>   Alias /static/ /var/www/static/my_proj/
>>   Alias /tiny_mce/ /var/www/static/my_proj/js/tiny_mce/
>>   Alias /jquery/ /var/www/static/my_proj/js/jquery/
>>  
>&

Re: JSON or YAML?

2013-08-31 Thread Agnese Camellini
I'm using JSON becuase of it's compatibility with javascript and python
both. I never used YAML but i think the compatibility's problem are bigger
with YAML than json.

My 2 cents.
Agnese


2013/8/31 Andre Terra 

> It depends on where your data is coming from. YAML has less cruft in it,
> so if you're writing your own serializer you can consider it to have an
> advantage over JSON.
>
> OTOH, many applications can already export to JSON, so you can leverage
> that if that's the case.
>
> Finally, If you're writing anything by hand, YAML is much faster.
>
>
> Cheers,
> AT
>
>
> On Fri, Aug 30, 2013 at 4:55 PM, Rich Haase  wrote:
>
>> Personal preference.  Python has excellent libraries to support parsing
>> both JSON and YAML.
>>
>> Sent from my iPhone
>>
>> On Aug 30, 2013, at 7:34 AM, Floor Tile  wrote:
>>
>> Helle everybody,
>>
>> Just a short and simple question:
>>
>> It seams that both JSON and YAML can be used for initial data loading.
>> (among other data types but I don't care about them for the moment)
>> But can't figure out what the up and/or downsides of them are.
>> Is it purely a matter of personal preference or there one better to use
>> than the other for initial data loading. And which one would be the most
>> preferred, if this is the case?
>>
>> Many thanks in advance!
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to django-users+unsubscr...@googlegroups.com.
>> To post to this group, send email to django-users@googlegroups.com.
>> Visit this group at http://groups.google.com/group/django-users.
>> For more options, visit https://groups.google.com/groups/opt_out.
>>
>>  --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to django-users+unsubscr...@googlegroups.com.
>> To post to this group, send email to django-users@googlegroups.com.
>> Visit this group at http://groups.google.com/group/django-users.
>> For more options, visit https://groups.google.com/groups/opt_out.
>>
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users.
> For more options, visit https://groups.google.com/groups/opt_out.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Django Talent Needed!

2014-07-17 Thread Agnese Camellini
Hello shawn. I'm a freelance developer in italy. My website is
joy.indivia.net and i have experiences in django even if my community (
www.indivia.net) doesn't support it so i cannot show you any work done with
it.. However i'm searching a job now and i can work as a freelance and even
fulltime. Let me know. Agnese Camellini
Il giorno 16/lug/2014 17:01, "Shawnblue"  ha
scritto:

> Hi Django Community!
> My name is Shawn, and we [Smarter Agent] have just started to migrate our
> platform to Python/Django. We could not be happier with our decision and we
> are excited to get involved with the Django community. We are looking for
> some freelance/full time developers to help us with the transition. If you
> are a freelance/full time Django developer looking for work, or have any
> questions please send me an email!
>
> Some of the technologies we are working with are:
> Python
> Django
> GeoDjango
> Cassandra
> Solr
> Hadoop
> Zato.io
> jQuery
> Bootstrap
>
> Smarter Agent is over 10 years old and is based outside of Philadelphia,
> PA USA. We power more highly rated and downloaded real estate app titles in
> the Android and iPhone marketplaces than any other in the real estate
> vertical. This includes the #1 and #2 downloaded and rated large franchisor
> apps, the most highly downloaded and rated independent brokerage office app
> and many of the top downloaded Multi Service Listings (MLS) apps.
>
> Thank you for your time!
> S.
> http://www.smarteragent.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 post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/173720e8-cad3-425d-8bbe-7ad6371576ea%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/173720e8-cad3-425d-8bbe-7ad6371576ea%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CACXuh-T2ETich1-pPhV%2BFmB81YowK8XTO89yBbJjYi%3D59_s4zw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Suggestions about building new ecommerce website

2014-09-09 Thread Agnese Camellini
Well, i had friends running ecommerce sites in django, they where using
their own developed package, but it was one year ago so probably the
package pointed in the last email is a good choice.
Best
Agnese


On 9 September 2014 01:11, Luca Corti  wrote:

>
> https://www.djangopackages.com/grids/g/ecommerce/
>
> Il 2014-09-08 15:16 Shreyans Jain ha scritto:
>
>> I want some suggestions on building a big eCommerce website . I
>> have a good experience of making website in asp.net [1] ,asp.net [1]
>> Ajax and
>> sql server 2008 . Now I am thinking about moving from Microsoft
>> (because of cost) . Please
>>  help me choose between php(plain),php with mvc framework,django (not
>> rails because of steep learning curve and updating the website after
>> the
>>  host has updated the version).I have no experience on any of the
>> above
>> three.
>>
>> and I will develop alone and I want to cost to be on lower side and
>> site should be fast and scalable too.
>> Any help would be useful
>>
>>  --
>>  You received this message because you are subscribed to the Google
>> Groups "Django users" group.
>>  To unsubscribe from this group and stop receiving emails from it,
>> send an email to django-users+unsubscr...@googlegroups.com.
>>  To post to this group, send email to django-users@googlegroups.com.
>>  Visit this group at http://groups.google.com/group/django-users [2].
>>  To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/f141c8f6-
>> a8ce-4847-b6a4-432575b9a583%40googlegroups.com
>> [3].
>>  For more options, visit https://groups.google.com/d/optout [4].
>>
>>
>> Links:
>> --
>> [1] http://asp.net
>> [2] http://groups.google.com/group/django-users
>> [3]
>> https://groups.google.com/d/msgid/django-users/f141c8f6-
>> a8ce-4847-b6a4-432575b9a583%40googlegroups.com?utm_medium=
>> email&utm_source=footer
>> [4] https://groups.google.com/d/optout
>>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users.
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/django-users/4c4684c22563bac43975064ae55b3b56%40mail.fantacast.it.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CACXuh-RLgp8ceN7%3Dv05Gy%3DqVwhi8kT_uNq9NwYLyqsBoUmUfdg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


reverse function

2014-05-29 Thread Agnese Camellini
Good morning everyone, i was using django as of django 0.9 and now i'm
looking again in the tutorial and i have to say that a lot has changed. I
undestand che basics (even if i cannot understan why in the tutorial they
use the context and doesn'use any more "render_to_response") but however
what i cannot understand is che function "reverse" which is used in the
views, what is its use? San you explain it to me while i'm going through
the tutorial again to understand? Thank you. Agnese

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CACXuh-TCm1vMMvOG9m-vv10%2B-rGK9tRx5rn8u-8JQ2EO%3DEW_zw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Get last instance object per each month and sum per month in Django

2020-02-25 Thread Agnese Camellini
You should search how to make a group by activity and a partition by month
then take each partition and sum the record up, i don't know how to do it
in Django orm but in sql is the most effective way to solve the issue and
it's a lot let expensive than taking all the activities and then search in
the status Table.
my 2 cents
Agnese

On Tue, 25 Feb 2020 at 21:07, Mario Bisiani  wrote:

> I tryed to search for answer but nothing yet can help me.
>
> I have one class model Activity and a class model Status :
>
> class Status(models.Model):
> activity = models.ForeignKey(Activity, on_delete=models.CASCADE, 
> related_name="all_status")
> status_date = models.DateField()
> actual_progress = models.DecimalField(max_digits=3, decimal_places=2)
>
> I need to get last 'status_date' for each activity for each month and sum
> up its actual_progress.
>
> Can't find after many research a way out.
>
> *Update*
>
> I found a way to get latest status per activity helped here Django - get
> latest object in each relation
> 
> :
>
> @classmethod
> def get_latest_by_activity_ids(cls, activity_id):
> found = []
> for aid in Activity.objects.all():
> 
> found.append(cls.objects.filter(activity_id=aid).latest("status_date"))
> return found
>
> This gave me a list of dates. Now I'm blocked to sum them up per month.
>
>
>
> https://stackoverflow.com/questions/60366457/get-last-instance-object-per-each-month-and-sum-per-month-in-django
>
>
> --
> 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/91d43812-6c7a-431d-9117-7a79519564fd%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/CACXuh-Ryg0C6W%2Br7U%2BZqJywcmv9-o1MiwKCarm1dmT%3DK%2B5quHQ%40mail.gmail.com.


problem filtering queryset in Django Rest Framework

2020-06-06 Thread Agnese Camellini
Hello to everyone,
i have a viewset (ModelViewset) for a model in my views.py, and i would
like the list endpoint to list me things matching some parameters (but the
are optional). So i have built this mixin:

class MultipleFieldLookupMixin(object):
"""
Apply this mixin to any view or viewset to get multiple field filtering
based on a `lookup_fields` attribute, instead of the default single
field filtering.
"""
def get_object(self):
queryset = self.get_queryset() # Get the base queryset
queryset = self.filter_queryset(queryset)  # Apply any filter
backends
filter = {}
for field in self.lookup_fields:
if self.kwargs[field] is not None: # Ignore empty fields.
filter[field] = self.kwargs[field]
obj = get_object_or_404(queryset, **filter)  # Lookup the object
return obj


class UserView(MultipleFieldLookupMixin, viewsets.ModelViewSet):
queryset = User.objects.all()
serializer_class = UserSerializer
lookup_fields = ['username', 'pwd', 'token_confirm', 'email',
'token_cng_pwd']

This is what my view.py looks like.
However the list view doesn't filter object at all, so i am missing
something important.

Can anyone help me out or point me in the right direction?

Thanks a lot
Agnese Camellini

-- 
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/CACXuh-Siku2%2BES0RxCDfWe3NVRTnt3%3DBToj2ZFYB%2BbT1sBVCBg%40mail.gmail.com.


Re: How to retrieve dynamically the data ,submitted by a form in an html page, in a python function pointing to another html page in views.py?

2020-06-07 Thread Agnese Camellini
If you bind the form to a model and the you retrieve the model in the other
page everything will be ok

Il Dom 7 Giu 2020, 22:09 Pierre Jutard  ha scritto:

> I have 2 html pages A and B. The user fills the AForm in the 'A' HTML
> page(URL: A) then he will go to the 'B' html page (url: A/B) but i would
> like to keep the AForm data of the 'A'HTML page in the python code in order
> to use it after in the python function pointing to the 'B' HTML page.
>
> My idea was to retrieve the form data in parameter of the function
> pointing to the 'B' HTML page.
>
> First:
> I have tried to point the form data to the 'B' HTML page via this line in
> the 'A' HTML page code:
> 
>
> This is the function pointing to the A HTML page:
>
> def A_HTML_Function_view(request):
> AForm = A_Form()
> if request.method == 'POST':
> AForm_result = A_Form(request.POST)
> BForm
> return render(request, 'AppName/B.html',{'Bform':Bform})
> else:
> AForm = A_Form()
> return render(request, 'AppName/A.html',{'AForm':AForm})
>
> --
> 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/b2d345a6-6d06-4577-a24c-f1233389220fo%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/CACXuh-Syag%3Dm0fWyqED-8pFq0MR9aPTP1XMAL0YxBn%2Bg-VqguA%40mail.gmail.com.


Re: Help me!

2020-06-08 Thread Agnese Camellini
it's enough that you google django chat system that everything will come to
you magically.

On Mon, 8 Jun 2020 at 08:24, Tobi DEGNON  wrote:

> Make research about Django channels
>
> Le lun. 8 juin 2020 07 h 18, meera gangani  a
> écrit :
>
>> I want to create personal chat in django!!
>>
>> What Can I Do?
>> And What are the Libraries I install?
>> Please Help Me Out!!
>>
>> Thanks in advance
>> -Meera Gangani
>>
>> --
>> 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/CANaPPPKWVMZhwmfTndhjVAmPB-cGYK07_ptdp%2BfdsymAe-b3%2BQ%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/CACeK5bn77jdGU%3Dp4gJsn4wzpdjQ72hdfBcC%3DNefCJqLNK0i7iw%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/CACXuh-R7vp-GtAi1MJgg_pA5CiUtsrJXxxW-mH_BsUCMe4%3Dr2g%40mail.gmail.com.


Re: Regarding sending the link to reset the password

2020-06-13 Thread Agnese Camellini
I have set a temporary password when they give me the email. By the update
on the user i check in the password field if there is the temporary
password and if it is there i send the reset link by email.
I have an api with django rest framework and django.
Agnese

Il Sab 13 Giu 2020, 20:44 Devendra reddy  ha
scritto:

> Hi to all
>
>  I am working on the api side using python django.now i have the one
> requirement. i want  to send the link to reset the password while clicking
> on the forgot password link on the ui. from api side  i want to send the
> mail by the link of reset password to the respected user.please help me out
> to complete this.
>
>
> Thanks and regards,
> Devendra.
>
> --
> 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/CABB0Uf1%3Dy0p8%3D%3D65EkdFB4_XRMwhcp84OAeQxem%2Bw94S2aw7LA%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/CACXuh-Q_Tz-qcg9o0B%3DiGvfvVC--3u3vmzu9hiu%3DAAQNWRtVrg%40mail.gmail.com.


Re: Ecommerce website

2020-08-14 Thread Agnese Camellini
If you want to build an ecommerce website with django use "Oscar" an app
that builds the ecommerce for you in django

Il Ven 14 Ago 2020, 11:50  ha scritto:

>
>
>
>
> Any one working on E-commerce website I want
>
> Help to develop my E-cart website...thanks
>
>
>
> --
> 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/5f362d99.1c69fb81.a7522.14c2%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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CACXuh-T9og7mH9u4n56F45juQ_5BAipKJAmdzKz0c1VfAQX%3D6g%40mail.gmail.com.


Re: Django and Vuejs

2020-10-02 Thread Agnese Camellini
I've found a lot on the web, even including VueJs in the page with a CDN
call in the head and then modifying the delimiters to divide the behaviour
ov Vue from the one of the templates, but then i discussed with the front
end part of my open source project and we decided to make everything with
django rest framework and a different domain to serve the front end, auth
is made with cookies and without backend session, but you can make it with
JWT authentication.
I don't remember the url where i took the infos, but it's better to divide
front end from back end.
My 2 cents
Agnese

On Fri, 2 Oct 2020 at 15:08, lada...@gmail.com  wrote:

> what is the best way of joining django and vue. Articles, books will help
> please
>
> --
> 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/7d40ed9e-3b59-4e4e-895c-09d15603c286n%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/CACXuh-RaMs3cj%3D5bwEQnVDCv_okY_i9YyoKCQmSho%3DBPR-QPFg%40mail.gmail.com.


Re: Request for admins

2020-10-11 Thread Agnese Camellini
I full aree with you. This is spamming!

Il Dom 11 Ott 2020, 22:14 o1bigtenor  ha scritto:

> Greetings
>
> The list volume seems to have attracted those that purport to offer
> help or services.
>
> Is it possible that the volume of this has reached a point where there
> is a separate list for just that.
> That would be a separate subscription to a list where if one wanted to
> either use or offer services one was free to do so. The second part of
> that would be that if one overtly did the same on the 'users' list one
> would be either punted or at the very least put on controlled listing.
>
> This request is stemming from the 40 or 50 emails polluted by a listee
> who seems to think that attaching his business card or better its
> written equivalent to every thread is going to get him business. Mine
> - - - - never - - - - I don't do business that way.
>
> Hoping that this request isn't too far off topic!
>
> 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+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAPpdf59qjGznmqJTbpHe6c8t0_GoTn6O8bs6agggPA6Zbx8EMQ%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/CACXuh-RnZj-ejb5hzpMrf9%3DRUte%3Dks15pUHXZJ3DxrzngtarnQ%40mail.gmail.com.