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.


get_changeform_initial_data with ManyToMany

2021-07-09 Thread Thibault Thomas

Hello,

How can I use admin's get_changeform_initial_data function to prepopulate a 
many to many relationship widget ?

I have the following models in models.py :
___ 
*class Piece(models.Model):*
vehicules = models.ManyToManyField(Vehicule, through=
'AppartenanceVehicule', verbose_name='véhicules')
soustypes_piece = models.ManyToManyField(SousTypePiece, blank=False, 
default=None, verbose_name='sous-types de pièce')

*class AppartenanceVehicule(models.Model):*
vehicule = models.ForeignKey(Vehicule, on_delete=models.CASCADE)
piece = models.ForeignKey(Piece, on_delete=models.CASCADE)
annee = models.PositiveSmallIntegerField('année', blank=True, null=True, 
validators=[MinValueValidator(1900), MaxValueValidator(2100)])

*class SousTypePiece(models.Model):*
# some attributes

*class Vehicule(models.Model):*
   # some attributes
___

I use the following function in admin.py's ModelAdmin for Piece model :

___
*def get_changeform_initial_data(self, request):*
  * if **request.GET.get('vehicule_pk') and 
request.GET.get('soustype_piece_pk'):*
vehicule = get_object_or_404(Vehicule, pk=request.GET.get(
'vehicule_pk'))
soustype_piece = get_object_or_404(SousTypePiece, pk
=request.GET.get('soustype_piece_pk'))
   return {
  'vehicules': vehicule,
  'soustypes_piece': soustype_piece
   }
  * elif request.GET.get('vehicule_pk'):*
   vehicule = get_object_or_404(Vehicule, pk=request.GET.get(
'vehicule_pk'))
   return {
  'vehicules': vehicule,
   }
__

but I can only prepopulate soustypes_piece correctly. I remember I could 
prepopulate vehicules when I didn't use an intermediate model (using 
'through'). This may be why I can still prepopulate soustypes_piece.

Any idea how I can make it work ?

Thanks,

Thibault

-- 
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/f952109d-07bb-4662-87f4-7bcdad275de6n%40googlegroups.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 

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.


django...@googlegroups.com

2021-07-09 Thread saipushpak polepalle
Hi,

I am trying to run a sample test on centos with tsung. But getting the 
following error in the error report.
Can anyone please help me out.

 =ERROR REPORT 9-Jul-2021::15:58:06 === 

** Generic server ts_config_server terminating  

** Last message in was 
{get_client_config,static,"jio-vit-backend-loadgen-10"} 

** When Server state == {state, 

 {config,undefined,0,7,none,text,undefined, 

  [{client,"jio-vit-backend-loadgen-10.novalocal", 

1.0,1,[],undefined}], 

  [{server,"192.168.10.12",1884,ts_tcp,1}], 

  undefined,[], 

  
[{arrivalphase,1,3000,undefined,0.001,1,0,[],false, 

1}], 

  undefined,false,[],[],ts_mqtt, 

  
[{session,2,0,ts_mqtt,"mqtt_subscriber",true,true, 

1, 

{proto_opts,negotiate,negotiate,"/http-bind/", 

 false,false,false,"/chat","binary",[],10,3, 

 
60,infinity,infinity,32768,32768,32768,32768, 

 [],true,true}, 

undefined,5,undefined,undefined,undefined, 

undefined,undefined}, 

   
{session,1,100,ts_mqtt,"mqtt_publisher",true,true, 

1, 

{proto_opts,negotiate,negotiate,"/http-bind/", 

 false,false,false,"/chat","binary",[],10,3, 

 
60,infinity,infinity,32768,32768,32768,32768, 

 [],true,true}, 

undefined,5,undefined,undefined,undefined, 

undefined,undefined}], 

  [{1, 


{session,2,0,ts_mqtt,"mqtt_subscriber",true,true, 

 1, 

 {proto_opts,negotiate,negotiate,"/http-bind/", 

  false,false,false,"/chat","binary",[],10,3, 

  60,infinity,infinity,32768,32768,32768, 

  32768,[],true,true}, 

 undefined,5,undefined,undefined,undefined, 

 undefined,undefined}}], 

  49181,false,undefined,5,5,[],0,1, 

  {proto_opts,negotiate,negotiate,"/http-bind/", 

   false,false,false,"/chat","binary",[],10,3,60, 

   
infinity,infinity,32768,32768,32768,32768,[],true, 

   true}, 

  now,none,none,[],undefined,"d",false,1,undefined,20, 

  []}, 

 "/home/centos/.tsung/log/20210709-1557",0,0, 

 [{1, 

   
{session,2,0,ts_mqtt,"mqtt_subscriber",true,true, 

1, 

{proto_opts,negotiate,negotiate,"/http-bind/", 

 false,false,false,"/chat","binary",[],10,3, 

 
60,infinity,infinity,32768,32768,32768,32768, 

 [],true,true}, 

undefined,5,undefined,undefined,undefined, 

undefined,undefined}}], 

 
undefined,1,undefined,'jio-vit-backend-loadgen-10',1, 

 0,undefined,1.0} 

** Reason for termination ==  

** {{badmatch,false}, 

[{ts_config_server,handle_call,3, 

   [{file,"src/tsung_controller/ts_config_server.erl"}, 

{line,308}]}, 

 {gen_server,handle_msg,5,[{file,"gen_server.erl"},{line,585}]}, 

 {proc_lib,init_p_do_apply,3,[{file,"proc_lib.erl"},{line,239}]}]} 

 

=INFO REPORT 9-Jul-2021::15:58:06 === 

ts_config_server:(5:<0.136.0>) Config server started, logdir is 
"/home/centos/.tsung/log/20210709-1557" 

  

=ERROR REPORT 9-Jul-2021::15:58:06 === 

** Generic server ts_config_server terminating  

** Last message in was {get_client_config,"jio-vit-backend-loadgen-10"} 

** When Server state == {state,undefined, 

   
"/home/centos/.tsung/log/20210709-1557",0,0,0, 

   undefined,1,undefined, 

   'jio-vit-backend-loadgen-10',0,0,undefined, 

   undefined} 

** Reason for termin

Re: counting the same words within a song added by a user using Django

2021-07-09 Thread DJANGO DEVELOPER
https://stackoverflow.com/questions/41689274/split-multiple-selections-into-separate-records-in-a-django-model

I also want the same result as it is mentioned here in the stackoverflow
question

On Fri, Jul 9, 2021 at 10:56 AM DJANGO DEVELOPER 
wrote:

> sum it is giving me error of TextField is not iterable
>
> On Wed, Jul 7, 2021 at 5:30 AM DJANGO DEVELOPER 
> wrote:
>
>> so will it run smoothly?
>> I mean there is no filter function there so will it filter a specific
>> field and will give me count for the words?
>>
>> On Tue, Jul 6, 2021 at 9:40 PM sum abiut  wrote:
>>
>>> You can to something like this
>>>
>>> def count_songs(request):
>>> #get the field that you want to count the words in it
>>> field_name = model._meta.get_field('your_field)
>>>
>>> word_count =Counter(field_name)
>>>
>>> for key, value in word_count.items():
>>>
>>>   key = key
>>>
>>>   value=value
>>>
>>> context={
>>>
>>> 'key':key,
>>>
>>> 'value':value,
>>> }
>>>
>>> return render(request, 'template.html', context)
>>>
>>>
>>>
>>> On Tue, Jul 6, 2021 at 7:09 PM lalit suthar 
>>> wrote:
>>>
 cool :D

 On Tuesday, 6 July 2021 at 10:25:06 UTC+5:30 abubak...@gmail.com wrote:

> I found this as well. and I think  I want the result this way.
>
> On Tue, Jul 6, 2021 at 9:21 AM Lalit Suthar 
> wrote:
>
>> [image: Screen Shot 2021-07-06 at 9.50.12 AM.png]
>> Counter works with words also
>>
>> nice one Simon Charette learned something new :)
>>
>> On Tue, 6 Jul 2021 at 07:56, DJANGO DEVELOPER 
>> wrote:
>>
>>> thanks Simon but I am not using postgresql. I am using sqlite3
>>> database. so I want a global solution, that work in all the databases.
>>>
>>> On Tue, Jul 6, 2021 at 1:54 AM Simon Charette 
>>> wrote:
>>>
 If you're using a PostgreSQL you might want to look at using a tsvector
 column instead which will ignore stop words (the, or, of, ...) and map
 lexemes to their number of occurrence and position in the
 lyrics[0]. Assuming you were to index this column you'd be able to
 efficiently query it for existence of a particular lexeme or multiple 
 of
 them.

 You could then a union of all a user's song lyrics tsvector and
 even apply weights based on their listening frequency or their favorite
 songs.

 Cheers,
 Simon

 [0]
 https://stackoverflow.com/questions/25445670/retrieving-position-and-number-of-lexem-occurrences-from-tsvector
 Le lundi 5 juillet 2021 à 13:51:48 UTC-4, abubak...@gmail.com a
 écrit :

> Thank you Lalit bhai.
> it seems to be a solution.
> but what if I want to get the result for each single word rather
> than single letter?
>
>
> On Mon, Jul 5, 2021 at 5:43 PM Lalit Suthar 
> wrote:
>
>> https://www.guru99.com/python-counter-collections-example.html
>> Counter can be helpful for this situation
>>
>> On Mon, 5 Jul 2021 at 17:07, DJANGO DEVELOPER <
>> abubak...@gmail.com> wrote:
>>
>>> Hi there.
>>> I am developing a project based on adding songs to the user's
>>> library and to the home page.
>>> other users can also purchase the songs like wise people do
>>> shopping on eCommerce stores.
>>> *Problem:(Question)*
>>> The problem that I want to discuss here is that when a user adds
>>> a sing through django forms, and now that song is added to the 
>>> user's
>>> personal library.
>>> now what I want to do is :
>>>
>>>
>>> *When the lyrics of a song are added as a record to the "Song"
>>> table, the individual words in that song should be added to a 2nd 
>>> table
>>> with their frequency of usage within that song (so the words need 
>>> to be
>>> counted and a signal needs to be created).Also, when a user adds 
>>> the song
>>> to his/her personal library, all of the words from the song and 
>>> their
>>> frequencies within that song should be added to another table and
>>> associated with that user.*
>>>
>>> how to count same word within a song?
>>>
>>> can anyone help me here?
>>> your help would be appreciated.
>>>
>>> --
>>> You received this message because you are subscribed to the
>>> Google Groups "Django users" group.
>>> To unsubscribe from this group and stop receiving emails from
>>> it, send an email to django-users...@googlegroups.com.
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/django-users/bc7bc37b-6f26-465c-b330-d275ab86b76an%40googlegroups.com
>>> 

Re: counting the same words within a song added by a user using Django

2021-07-09 Thread DJANGO DEVELOPER
sum it is giving me error of TextField is not iterable

On Wed, Jul 7, 2021 at 5:30 AM DJANGO DEVELOPER 
wrote:

> so will it run smoothly?
> I mean there is no filter function there so will it filter a specific
> field and will give me count for the words?
>
> On Tue, Jul 6, 2021 at 9:40 PM sum abiut  wrote:
>
>> You can to something like this
>>
>> def count_songs(request):
>> #get the field that you want to count the words in it
>> field_name = model._meta.get_field('your_field)
>>
>> word_count =Counter(field_name)
>>
>> for key, value in word_count.items():
>>
>>   key = key
>>
>>   value=value
>>
>> context={
>>
>> 'key':key,
>>
>> 'value':value,
>> }
>>
>> return render(request, 'template.html', context)
>>
>>
>>
>> On Tue, Jul 6, 2021 at 7:09 PM lalit suthar 
>> wrote:
>>
>>> cool :D
>>>
>>> On Tuesday, 6 July 2021 at 10:25:06 UTC+5:30 abubak...@gmail.com wrote:
>>>
 I found this as well. and I think  I want the result this way.

 On Tue, Jul 6, 2021 at 9:21 AM Lalit Suthar 
 wrote:

> [image: Screen Shot 2021-07-06 at 9.50.12 AM.png]
> Counter works with words also
>
> nice one Simon Charette learned something new :)
>
> On Tue, 6 Jul 2021 at 07:56, DJANGO DEVELOPER 
> wrote:
>
>> thanks Simon but I am not using postgresql. I am using sqlite3
>> database. so I want a global solution, that work in all the databases.
>>
>> On Tue, Jul 6, 2021 at 1:54 AM Simon Charette 
>> wrote:
>>
>>> If you're using a PostgreSQL you might want to look at using a tsvector
>>> column instead which will ignore stop words (the, or, of, ...) and map
>>> lexemes to their number of occurrence and position in the
>>> lyrics[0]. Assuming you were to index this column you'd be able to
>>> efficiently query it for existence of a particular lexeme or multiple of
>>> them.
>>>
>>> You could then a union of all a user's song lyrics tsvector and even
>>> apply weights based on their listening frequency or their favorite 
>>> songs.
>>>
>>> Cheers,
>>> Simon
>>>
>>> [0]
>>> https://stackoverflow.com/questions/25445670/retrieving-position-and-number-of-lexem-occurrences-from-tsvector
>>> Le lundi 5 juillet 2021 à 13:51:48 UTC-4, abubak...@gmail.com a
>>> écrit :
>>>
 Thank you Lalit bhai.
 it seems to be a solution.
 but what if I want to get the result for each single word rather
 than single letter?


 On Mon, Jul 5, 2021 at 5:43 PM Lalit Suthar 
 wrote:

> https://www.guru99.com/python-counter-collections-example.html
> Counter can be helpful for this situation
>
> On Mon, 5 Jul 2021 at 17:07, DJANGO DEVELOPER 
> wrote:
>
>> Hi there.
>> I am developing a project based on adding songs to the user's
>> library and to the home page.
>> other users can also purchase the songs like wise people do
>> shopping on eCommerce stores.
>> *Problem:(Question)*
>> The problem that I want to discuss here is that when a user adds
>> a sing through django forms, and now that song is added to the user's
>> personal library.
>> now what I want to do is :
>>
>>
>> *When the lyrics of a song are added as a record to the "Song"
>> table, the individual words in that song should be added to a 2nd 
>> table
>> with their frequency of usage within that song (so the words need to 
>> be
>> counted and a signal needs to be created).Also, when a user adds the 
>> song
>> to his/her personal library, all of the words from the song and their
>> frequencies within that song should be added to another table and
>> associated with that user.*
>>
>> how to count same word within a song?
>>
>> can anyone help me here?
>> your help would be appreciated.
>>
>> --
>> You received this message because you are subscribed to the
>> Google Groups "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it,
>> send an email to django-users...@googlegroups.com.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/bc7bc37b-6f26-465c-b330-d275ab86b76an%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...@googlegroups.com.
>
 To view this discussion on the