Re: Django help| Urgent | how to find the frequency of a string for each word using django admin?

2021-07-09 Thread Tree Chip Net
let suppose I have 2 models:
*class String(models.model):*
*string = models.textarea(null = True, blank = True)*
*user = models.ForeignKey(user, on_delete=models.CASCADE)*
*def __str__(self):*
*return self.string*

and


*class Song_Words_Count(models.model):*
*song = models.ForeignKey(user, on_delete=models.SET_NULL)*
*def __str__(self):*
*return self.song*

now what I want to do at django admin side that the string added in
* "String" *model should be saved in Song_Wors_count model and string
should be splitted in a single word and frequency should be counted this
way:

word word_freq
word1 10
word2 15
word3 20

I need Urgent help please.

Em qui, 8 de jul de 2021 18:51, DJANGO DEVELOPER 
escreveu:

> let suppose I have 2 models:
> *class String(models.model):*
> *string = models.textarea(null = True, blank = True)*
> *user = models.ForeignKey(user, on_delete=models.CASCADE)*
> *def __str__(self):*
> *return self.string*
>
> and
>
>
> *class Song_Words_Count(models.model):*
> *song = models.ForeignKey(user, on_delete=models.SET_NULL)*
> *def __str__(self):*
> *return self.song*
>
> now what I want to do at django admin side that the string added in*
> "String" *model should be saved in Song_Wors_count model and string
> should be splitted in a single word and frequency should be counted this
> way:
>
> word word_freq
> word1 10
> word2 15
> word3 20
>
> I need Urgent 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/f53fc668-ca86-4c51-8d4c-673dee3d180cn%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/CAMMKRYzrKLwfJdz4LpmeRG6%2BWRffdADH%3D4_VRC_rOnuw%3DthYSQ%40mail.gmail.com.


Re: Django help| Urgent | how to find the frequency of a string for each word using django admin?

2021-07-09 Thread DJANGO DEVELOPER
hi Sebastian, do you know how can I resolve my problem? I want to count
same words in a string. after splitting it

On Fri, Jul 9, 2021 at 10:14 PM DJANGO DEVELOPER 
wrote:

> Hi Peter, thanks for your reply. Sorry I have m2m relationship of User
> model with Song model and I am using m2m_changes signal for it but still
> not giving me the desired output.
>
> On Fri, Jul 9, 2021 at 9:20 PM Sebastian Jung 
> wrote:
>
>> Hello Peter,
>>
>> ich would make it with a signal.
>>
>> Here a another example to use a post save signal:
>>
>> from django.db.models.signals import post_savefrom django.dispatch import 
>> receiver
>> class TransactionDetail(models.Model):
>> product = models.ForeignKey(Product)
>> # method for updating@receiver(post_save, sender=TransactionDetail, 
>> dispatch_uid="update_stock_count")def update_stock(sender, instance, 
>> **kwargs):
>> instance.product.stock -= instance.amount
>> instance.product.save()
>>
>>
>> Please write me if you don't understand these example.
>>
>>
>> P.S. i have no idea why you have a foreignkey relation. Why you save words 
>> not in another column in String class?
>>
>> Regards
>>
>>
>> Am Fr., 9. Juli 2021 um 17:30 Uhr schrieb 'Peter van der Does' via Django
>> users :
>>
>>> Overwrite the save method on the String model and when you hit save you
>>> split and save the words in the S_W_C model. This does mean when you update
>>> the String record all the words are added to the S_W_C model as well, as
>>> there is no correlation between the two model you don't know if that String
>>> was already counted.
>>> On 7/8/21 10:26 PM, DJANGO DEVELOPER wrote:
>>>
>>> is there anyone who can help me here?
>>>
>>> On Fri, Jul 9, 2021 at 2:51 AM DJANGO DEVELOPER 
>>> wrote:
>>>
 let suppose I have 2 models:
 *class String(models.model):*
 *string = models.textarea(null = True, blank = True)*
 *user = models.ForeignKey(user, on_delete=models.CASCADE)*
 *def __str__(self):*
 *return self.string*

 and


 *class Song_Words_Count(models.model):*
 *song = models.ForeignKey(user, on_delete=models.SET_NULL)*
 *def __str__(self):*
 *return self.song*

 now what I want to do at django admin side that the string added in*
 "String" *model should be saved in Song_Wors_count model and string
 should be splitted in a single word and frequency should be counted this
 way:

 word word_freq
 word1 10
 word2 15
 word3 20

 I need Urgent 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/f53fc668-ca86-4c51-8d4c-673dee3d180cn%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/CAKPY9pkPqSbN0OoxVyQ%2BYcfqq2fRX1NDWqpdyo-KmOG2X_vYeQ%40mail.gmail.com
>>> 
>>> .
>>>
>>> --
>>>
>>> *Peter van der Does o: **410-584-2500*
>>> * m: 732-425-3102 ONeil Interactive, Inc  oneilinteractive.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/3921f39e-60d9-0e67-87ff-c8684bafc8f4%40oneilinteractive.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/CAKGT9mzRGUFn4%3D29wi%2BZc%2BgosXhpuKMmjXRcefx2ZCnDOoQc4w%40mail.gmail.com
>> 

Re: Django help| Urgent | how to find the frequency of a string for each word using django admin?

2021-07-09 Thread DJANGO DEVELOPER
Hi Peter, thanks for your reply. Sorry I have m2m relationship of User
model with Song model and I am using m2m_changes signal for it but still
not giving me the desired output.

On Fri, Jul 9, 2021 at 9:20 PM Sebastian Jung 
wrote:

> Hello Peter,
>
> ich would make it with a signal.
>
> Here a another example to use a post save signal:
>
> from django.db.models.signals import post_savefrom django.dispatch import 
> receiver
> class TransactionDetail(models.Model):
> product = models.ForeignKey(Product)
> # method for updating@receiver(post_save, sender=TransactionDetail, 
> dispatch_uid="update_stock_count")def update_stock(sender, instance, 
> **kwargs):
> instance.product.stock -= instance.amount
> instance.product.save()
>
>
> Please write me if you don't understand these example.
>
>
> P.S. i have no idea why you have a foreignkey relation. Why you save words 
> not in another column in String class?
>
> Regards
>
>
> Am Fr., 9. Juli 2021 um 17:30 Uhr schrieb 'Peter van der Does' via Django
> users :
>
>> Overwrite the save method on the String model and when you hit save you
>> split and save the words in the S_W_C model. This does mean when you update
>> the String record all the words are added to the S_W_C model as well, as
>> there is no correlation between the two model you don't know if that String
>> was already counted.
>> On 7/8/21 10:26 PM, DJANGO DEVELOPER wrote:
>>
>> is there anyone who can help me here?
>>
>> On Fri, Jul 9, 2021 at 2:51 AM DJANGO DEVELOPER 
>> wrote:
>>
>>> let suppose I have 2 models:
>>> *class String(models.model):*
>>> *string = models.textarea(null = True, blank = True)*
>>> *user = models.ForeignKey(user, on_delete=models.CASCADE)*
>>> *def __str__(self):*
>>> *return self.string*
>>>
>>> and
>>>
>>>
>>> *class Song_Words_Count(models.model):*
>>> *song = models.ForeignKey(user, on_delete=models.SET_NULL)*
>>> *def __str__(self):*
>>> *return self.song*
>>>
>>> now what I want to do at django admin side that the string added in*
>>> "String" *model should be saved in Song_Wors_count model and string
>>> should be splitted in a single word and frequency should be counted this
>>> way:
>>>
>>> word word_freq
>>> word1 10
>>> word2 15
>>> word3 20
>>>
>>> I need Urgent 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/f53fc668-ca86-4c51-8d4c-673dee3d180cn%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/CAKPY9pkPqSbN0OoxVyQ%2BYcfqq2fRX1NDWqpdyo-KmOG2X_vYeQ%40mail.gmail.com
>> 
>> .
>>
>> --
>>
>> *Peter van der Does o: **410-584-2500*
>> * m: 732-425-3102 ONeil Interactive, Inc  oneilinteractive.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/3921f39e-60d9-0e67-87ff-c8684bafc8f4%40oneilinteractive.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/CAKGT9mzRGUFn4%3D29wi%2BZc%2BgosXhpuKMmjXRcefx2ZCnDOoQc4w%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.g

Re: Django help| Urgent | how to find the frequency of a string for each word using django admin?

2021-07-09 Thread Sebastian Jung
Hello Peter,

ich would make it with a signal.

Here a another example to use a post save signal:

from django.db.models.signals import post_savefrom django.dispatch
import receiver
class TransactionDetail(models.Model):
product = models.ForeignKey(Product)
# method for updating@receiver(post_save, sender=TransactionDetail,
dispatch_uid="update_stock_count")def update_stock(sender, instance,
**kwargs):
instance.product.stock -= instance.amount
instance.product.save()


Please write me if you don't understand these example.


P.S. i have no idea why you have a foreignkey relation. Why you save
words not in another column in String class?

Regards


Am Fr., 9. Juli 2021 um 17:30 Uhr schrieb 'Peter van der Does' via Django
users :

> Overwrite the save method on the String model and when you hit save you
> split and save the words in the S_W_C model. This does mean when you update
> the String record all the words are added to the S_W_C model as well, as
> there is no correlation between the two model you don't know if that String
> was already counted.
> On 7/8/21 10:26 PM, DJANGO DEVELOPER wrote:
>
> is there anyone who can help me here?
>
> On Fri, Jul 9, 2021 at 2:51 AM DJANGO DEVELOPER 
> wrote:
>
>> let suppose I have 2 models:
>> *class String(models.model):*
>> *string = models.textarea(null = True, blank = True)*
>> *user = models.ForeignKey(user, on_delete=models.CASCADE)*
>> *def __str__(self):*
>> *return self.string*
>>
>> and
>>
>>
>> *class Song_Words_Count(models.model):*
>> *song = models.ForeignKey(user, on_delete=models.SET_NULL)*
>> *def __str__(self):*
>> *return self.song*
>>
>> now what I want to do at django admin side that the string added in*
>> "String" *model should be saved in Song_Wors_count model and string
>> should be splitted in a single word and frequency should be counted this
>> way:
>>
>> word word_freq
>> word1 10
>> word2 15
>> word3 20
>>
>> I need Urgent 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/f53fc668-ca86-4c51-8d4c-673dee3d180cn%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/CAKPY9pkPqSbN0OoxVyQ%2BYcfqq2fRX1NDWqpdyo-KmOG2X_vYeQ%40mail.gmail.com
> 
> .
>
> --
>
> *Peter van der Does o: **410-584-2500*
> * m: 732-425-3102 ONeil Interactive, Inc  oneilinteractive.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/3921f39e-60d9-0e67-87ff-c8684bafc8f4%40oneilinteractive.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/CAKGT9mzRGUFn4%3D29wi%2BZc%2BgosXhpuKMmjXRcefx2ZCnDOoQc4w%40mail.gmail.com.


Re: Django help| Urgent | how to find the frequency of a string for each word using django admin?

2021-07-09 Thread Tech Cue
 *class String(models.model):*

*string = models.textarea(null = True, blank = True)*
> *user = models.ForeignKey(user, on_delete=models.CASCADE)*
> *def __str__(self):*
> *return self.string*
>
*class Song_Words_Count(models.model):*
> *song = models.ForeignKey(user, on_delete=models.SET_NULL)*
>



> *def __str__(self):*
> *return self.song*
>


https://docs.djangoproject.com/en/3.2/topics/db/queries/

On Fri, Jul 9, 2021 at 4:31 PM 'Peter van der Does' via Django users <
django-users@googlegroups.com> wrote:

> Overwrite the save method on the String model and when you hit save you
> split and save the words in the S_W_C model. This does mean when you update
> the String record all the words are added to the S_W_C model as well, as
> there is no correlation between the two model you don't know if that String
> was already counted.
> On 7/8/21 10:26 PM, DJANGO DEVELOPER wrote:
>
> is there anyone who can help me here?
>
> On Fri, Jul 9, 2021 at 2:51 AM DJANGO DEVELOPER 
> wrote:
>
>> let suppose I have 2 models:
>> *class String(models.model):*
>> *string = models.textarea(null = True, blank = True)*
>> *user = models.ForeignKey(user, on_delete=models.CASCADE)*
>> *def __str__(self):*
>> *return self.string*
>>
>> and
>>
>>
>> *class Song_Words_Count(models.model):*
>> *song = models.ForeignKey(user, on_delete=models.SET_NULL)*
>> *def __str__(self):*
>> *return self.song*
>>
>> now what I want to do at django admin side that the string added in*
>> "String" *model should be saved in Song_Wors_count model and string
>> should be splitted in a single word and frequency should be counted this
>> way:
>>
>> word word_freq
>> word1 10
>> word2 15
>> word3 20
>>
>> I need Urgent 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/f53fc668-ca86-4c51-8d4c-673dee3d180cn%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/CAKPY9pkPqSbN0OoxVyQ%2BYcfqq2fRX1NDWqpdyo-KmOG2X_vYeQ%40mail.gmail.com
> 
> .
>
> --
>
> *Peter van der Does o: **410-584-2500*
> * m: 732-425-3102 ONeil Interactive, Inc  oneilinteractive.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/3921f39e-60d9-0e67-87ff-c8684bafc8f4%40oneilinteractive.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/CACQGpNnOUgSBL1%2BsK6w3cJuyWw8vgAWzJZq%3D6GPGDjSsOnOLdQ%40mail.gmail.com.


Re: Django help| Urgent | how to find the frequency of a string for each word using django admin?

2021-07-09 Thread 'Peter van der Does' via Django users
Overwrite the save method on the String model and when you hit save you
split and save the words in the S_W_C model. This does mean when you
update the String record all the words are added to the S_W_C model as
well, as there is no correlation between the two model you don't know if
that String was already counted.

On 7/8/21 10:26 PM, DJANGO DEVELOPER wrote:
> is there anyone who can help me here?
>
> On Fri, Jul 9, 2021 at 2:51 AM DJANGO DEVELOPER
> mailto:abubakarbr...@gmail.com>> wrote:
>
> let suppose I have 2 models:
> *class String(models.model):*
> *    string = models.textarea(null = True, blank = True)*
> *    user = models.ForeignKey(user, on_delete=models.CASCADE)*
> *    def __str__(self):*
> *        return self.string*
>
> and
>
>
> *class Song_Words_Count(models.model):*
> *    song = models.ForeignKey(user, on_delete=models.SET_NULL)*
> *    def __str__(self):*
> *        return self.song*
>
> now what I want to do at django admin side that the string added
> in*"String" *model should be saved in Song_Wors_count model and
> string should be splitted in a single word and frequency should be
> counted this way:
>
> word word_freq
> word1 10
> word2 15
> word3 20
>
> I need Urgent 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/f53fc668-ca86-4c51-8d4c-673dee3d180cn%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/CAKPY9pkPqSbN0OoxVyQ%2BYcfqq2fRX1NDWqpdyo-KmOG2X_vYeQ%40mail.gmail.com
> .
-- 
*Peter van der Does
o: ***410-584-2500
m: 732-425-3102
*ONeil Interactive, Inc *
oneilinteractive.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/3921f39e-60d9-0e67-87ff-c8684bafc8f4%40oneilinteractive.com.


Re: Django help| Urgent | how to find the frequency of a string for each word using django admin?

2021-07-08 Thread DJANGO DEVELOPER
is there anyone who can help me here?

On Fri, Jul 9, 2021 at 2:51 AM DJANGO DEVELOPER 
wrote:

> let suppose I have 2 models:
> *class String(models.model):*
> *string = models.textarea(null = True, blank = True)*
> *user = models.ForeignKey(user, on_delete=models.CASCADE)*
> *def __str__(self):*
> *return self.string*
>
> and
>
>
> *class Song_Words_Count(models.model):*
> *song = models.ForeignKey(user, on_delete=models.SET_NULL)*
> *def __str__(self):*
> *return self.song*
>
> now what I want to do at django admin side that the string added in*
> "String" *model should be saved in Song_Wors_count model and string
> should be splitted in a single word and frequency should be counted this
> way:
>
> word word_freq
> word1 10
> word2 15
> word3 20
>
> I need Urgent 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/f53fc668-ca86-4c51-8d4c-673dee3d180cn%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/CAKPY9pkPqSbN0OoxVyQ%2BYcfqq2fRX1NDWqpdyo-KmOG2X_vYeQ%40mail.gmail.com.


Django help| Urgent | how to find the frequency of a string for each word using django admin?

2021-07-08 Thread DJANGO DEVELOPER
let suppose I have 2 models:
*class String(models.model):*
*string = models.textarea(null = True, blank = True)*
*user = models.ForeignKey(user, on_delete=models.CASCADE)*
*def __str__(self):*
*return self.string*

and


*class Song_Words_Count(models.model):*
*song = models.ForeignKey(user, on_delete=models.SET_NULL)*
*def __str__(self):*
*return self.song*

now what I want to do at django admin side that the string added in* 
"String" *model should be saved in Song_Wors_count model and string should 
be splitted in a single word and frequency should be counted this way:

word word_freq
word1 10
word2 15
word3 20

I need Urgent 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/f53fc668-ca86-4c51-8d4c-673dee3d180cn%40googlegroups.com.