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

2021-07-06 Thread lalit suthar
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 web visit 
>> https://groups.google.com/d/msgid/django-users/CAGp2JVHuos6d4%3D-_S%3DR-q8hq48Yzf%3D-xgmPziKEA2a3DYXAzbg%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...@googlegroups.com.
 To view this discussion on the web visit 
 https://groups.google.com/d/msgid/django-users/c77799f3-1492-459a-8187-8d62985407b6n%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 t

Re: looking for mobile developers

2021-07-06 Thread Balaji K S
Hello,
Am a flutter developer. Am interested

On Mon, 5 Jul, 2021, 2:07 am Theresa Taye,  wrote:

> Hello guys,
>
> I need flutter users for a project urgently if you are interested, please
> contact me.
>
> Best 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/CAENBRfMdOTe4NTJNONwZaD-U78wsQ%2BG4wU9W_gKFwRab1PuPVw%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/CADPGG3oiwaXG0ONEEtmO8Hn04rj0Z3nBytDaka3i3%2BbKs-aNmw%40mail.gmail.com.


No reverse match at /

2021-07-06 Thread Bhanu prasad Ch
I had a problem in passing special characters in Charfield in DB of Django.
Is that possible to pass special characters in CharField DB?
GitHub Issue 

-- 
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/b57636e3-35c4-4798-abe3-b6f97576a53fn%40googlegroups.com.


Re: No reverse match at /

2021-07-06 Thread DJANGO DEVELOPER
you have to provide id in your urls and in subject.html as well. share you
views and url as well.


On Tue, Jul 6, 2021 at 6:08 PM Bhanu prasad Ch  wrote:

> I had a problem in passing special characters in Charfield in DB of Django.
> Is that possible to pass special characters in CharField DB?
> GitHub Issue 
>
> --
> 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/b57636e3-35c4-4798-abe3-b6f97576a53fn%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/CAKPY9p%3DeBKaDSk8PsnmHXaPAmM9rbPhrvpyc6om85QPV7vXxyg%40mail.gmail.com.


Re: No reverse match at /

2021-07-06 Thread Julio Cojom
For what I can see in the issue, you're passing 2 values to the url (id ,
topic)

Maybe the error its for the topic because of the value (/Subject/Django)
try to sanitize the value after store it in the database, because it try to
get the url example.com/3//Subject/Django where 3 its the id or pk and
/Subject/Django its the topic, for the web server it may be confusing. You
can sanitize the value for something like slug field (django slug field docs
). Even
better, I suggest add slug field to the model and leave the topic off the
url.

Regards

El mar, 6 jul 2021 a las 7:12, DJANGO DEVELOPER ()
escribió:

> you have to provide id in your urls and in subject.html as well. share you
> views and url as well.
>
>
> On Tue, Jul 6, 2021 at 6:08 PM Bhanu prasad Ch 
> wrote:
>
>> I had a problem in passing special characters in Charfield in DB of
>> Django.
>> Is that possible to pass special characters in CharField DB?
>> GitHub Issue 
>>
>> --
>> 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/b57636e3-35c4-4798-abe3-b6f97576a53fn%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/CAKPY9p%3DeBKaDSk8PsnmHXaPAmM9rbPhrvpyc6om85QPV7vXxyg%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/CAHRQUH%3DFea-RkH4xanb%3DL_dVNk3%3DWj44Gfdnb0iXx34c1dWZ4g%40mail.gmail.com.


Re: looking for mobile developers

2021-07-06 Thread Eva Kemo
Hello am a flutter dev am interested

On Tue, 6 Jul 2021, 16:08 Balaji K S,  wrote:

> Hello,
> Am a flutter developer. Am interested
>
> On Mon, 5 Jul, 2021, 2:07 am Theresa Taye, 
> wrote:
>
>> Hello guys,
>>
>> I need flutter users for a project urgently if you are interested, please
>> contact me.
>>
>> Best 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/CAENBRfMdOTe4NTJNONwZaD-U78wsQ%2BG4wU9W_gKFwRab1PuPVw%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/CADPGG3oiwaXG0ONEEtmO8Hn04rj0Z3nBytDaka3i3%2BbKs-aNmw%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/CAH8JXBBqhRkZ6rxBMJp5LirsSqW69Kzu8hD_z-QazUMO2yBV7w%40mail.gmail.com.


Django Unit-test

2021-07-06 Thread Yonatan Girma
Greetings,

We are looking for Django app unit tester for small business project. Any
person with professional experience please send resume to
support-...@adulis.com

Respectfully,
Yonatan G.

-- 
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/CAAbCZeDPEjuL-0tHJmAHv%3DUi%3DQRxcaQkjm6OBAFR_WdGXYxJFA%40mail.gmail.com.


Re: Django Unit-test

2021-07-06 Thread Veera Raj
I am fresher In django wanna have a opportunity.can anyone help me ?

On Tue, Jul 6, 2021, 9:29 PM Yonatan Girma 
wrote:

> Greetings,
>
> We are looking for Django app unit tester for small business project. Any
> person with professional experience please send resume to
> support-...@adulis.com
>
> Respectfully,
> Yonatan G.
>
> --
> 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/CAAbCZeDPEjuL-0tHJmAHv%3DUi%3DQRxcaQkjm6OBAFR_WdGXYxJFA%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/CACg7y8Q9SNGQHV%3DvyXgGdRAXBH5wnVVc4XF_9OuXiDNXMs8okQ%40mail.gmail.com.


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

2021-07-06 Thread sum abiut
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 web visit
>>> https://groups.google.com/d/msgid/django-users/CAGp2JVHuos6d4%3D-_S%3DR-q8hq48Yzf%3D-xgmPziKEA2a3DYXAzbg%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...@googlegroups.com.
> To view this discussion on the web visit

Re: Authentication with Multiple User

2021-07-06 Thread Joel Tanko
If what you're trying to do is have two types of user accounts, then you'd
have to create a base user model and have personal and business inherit
from it - and it being a subclass of AbstractBaseUser

class BaseAccount(AbstractBaseUser):
…
# all public fields

class PersonalAccount(BaseAccount):
…
# personal account only fields

class BusinessAccount(BaseAccount):
...
# business account only fields

# settings.py

AUTH_USER_MODEL = 'app_name.BaseAccount'

you should avoid use of the BaseAccount directly
On Jun 29, 2021 6:05 PM, "Ridwan Adeyemo" 
wrote:

Hello,
How do I implement a multiple users registration/signup form. For example
the user needs to have (username, name password,  and confirm password )
while the seller is going to have (Business Name, Business Email, address,
tax id,  phone number and password,  and confirm password)
Best 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/30ae9b3c-6b0d-42eb-9804-92a2fb29b26bn%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/CAJ4Kmg4TWcEMptdOinqjyqhu%2B-tiVQdwXCg2_9N5%3DG0z_%3DRgvg%40mail.gmail.com.


Unit testing migrations [Was: Related model 'company.user' cannot be resolved]

2021-07-06 Thread Mike Dewhirst
It seems I have to meddle with history and persuade the testing harness 
that my custom user model has been in the company app from the beginning 
of time. See story below.


Upside is that testing will (might) start working again. Downside is 
I'll go mad.


Any ideas?

Thanks

Mike

On 6/07/2021 11:40 am, Mike Dewhirst wrote:
I moved my custom user and userprofile models from my 'common' app 
into my 'company' app by way of locking the model tables first 
(db_table = "common_user" and so on) and just plain refactoring.


That has all worked sort of as expected in that Company and User 
models now appear in the company app space in the Admin which was my 
original motivation.


makemigrations wanted to destroy data with delete/create models in 
order to move them and of course I couldn't let that happen. migrate 
--fake and migrate --fake-initial wouldn't work due to lots of other 
models looking for settings.AUTH_USER_MODEL which Django couldn't find 
in the company app so I finessed my own fake migrations. That also 
seemed to work and the job seemed done.


BUT manage.py test now fails with "Related model 'company.user' cannot 
be resolved"


StackOverflow seems to indicate my finessed migrations are at fault. I 
have tried to tweak the dependencies with no luck as follows ...


# company.migrations.0005_user_userprofile.py
...
    dependencies = [
    ('auth', '0012_alter_user_first_name_max_length'),
    ('company', '0004_auto_20210510_1431'),       # older pre move 
migration

    ('common', '0008_auto_20210705_1740'),        # see below
    ]

    operations = [
    migrations.CreateModel(
    name='User',
    fields=[
    ('id', models.BigAutoField(auto_created=True, 
primary_key=True, serialize=False, verbose_name='ID')),
    ('password', models.CharField(max_length=128, 
verbose_name='password')),

... etc for creating both User and UserProfile models

# common.migrations.0008_auto_20210705_1740.py
...
    dependencies = [
    ('common', '0007_userprofile_job_title'),    # older pre-move 
migration

    ]

    operations = [
    migrations.RemoveField(
    model_name='userprofile',
    name='company',
    ),
    migrations.RemoveField(
    model_name='userprofile',
    name='user',
    ),
    migrations.DeleteModel(
    name='User',
    ),
    migrations.DeleteModel(
    name='UserProfile',
    ),
    ]


Django 3.2.5, Python 3.8

I feel I should have zigged when I should've zagged. Thanks for any 
suggestions


Mike

Traceback (most recent call last):
  File "manage.py", line 21, in 
    main()
  File "manage.py", line 17, in main
    execute_from_command_line(sys.argv)
  File 
"D:\Users\mike\envs\xxai\lib\site-packages\django\core\management\__init__.py", 
line 419, in execute_from_command_line

    utility.execute()
  File 
"D:\Users\mike\envs\xxai\lib\site-packages\django\core\management\__init__.py", 
line 413, in execute

    self.fetch_command(subcommand).run_from_argv(self.argv)
  File 
"D:\Users\mike\envs\xxai\lib\site-packages\django\core\management\commands\test.py", 
line 23, in run_from_argv

    super().run_from_argv(argv)
  File 
"D:\Users\mike\envs\xxai\lib\site-packages\django\core\management\base.py", 
line 354, in run_from_argv

    self.execute(*args, **cmd_options)
  File 
"D:\Users\mike\envs\xxai\lib\site-packages\django\core\management\base.py", 
line 398, in execute

    output = self.handle(*args, **options)
  File 
"D:\Users\mike\envs\xxai\lib\site-packages\django\core\management\commands\test.py", 
line 55, in handle

    failures = test_runner.run_tests(test_labels)
  File 
"D:\Users\mike\envs\xxai\lib\site-packages\django\test\runner.py", 
line 725, in run_tests

    old_config = self.setup_databases(aliases=databases)
  File 
"D:\Users\mike\envs\xxai\lib\site-packages\django\test\runner.py", 
line 643, in setup_databases

    return _setup_databases(
  File 
"D:\Users\mike\envs\xxai\lib\site-packages\django\test\utils.py", line 
179, in setup_databases

    connection.creation.create_test_db(
  File 
"D:\Users\mike\envs\xxai\lib\site-packages\django\db\backends\base\creation.py", 
line 74, in create_test_db

    call_command(
  File 
"D:\Users\mike\envs\xxai\lib\site-packages\django\core\management\__init__.py", 
line 181, in call_command

    return command.execute(*args, **defaults)
  File 
"D:\Users\mike\envs\xxai\lib\site-packages\django\core\management\base.py", 
line 398, in execute

    output = self.handle(*args, **options)
  File 
"D:\Users\mike\envs\xxai\lib\site-packages\django\core\management\base.py", 
line 89, in wrapped

    res = handle_func(*args, **kwargs)
  File 
"D:\Users\mike\envs\xxai\lib\site-packages\django\core\management\commands\migrate.py", 
line 244, in handle

    post_migrate_state = executor.migrate(
  File 
"D:\Users\mike\envs\xxai\lib\site-packages\django\db\migrations\executor.py", 
line 117, i

ProgrammingError - relationship does not exist

2021-07-06 Thread Stathis Angelou
Good evening all, i have created a new app and added a model. Added the app 
under installed apps, and run python manage.py makemigrations and migrate 
and everything worked as expected.

But i believe there is an issue with the admin.py file

from django.contrib import admin

# Register your models here.
from django.contrib.gis.admin import OSMGeoAdmin
from .models import Shop

@admin.register(Shop)
class ShopAdmin(OSMGeoAdmin):
list_display = ('name', 'location')

Error message:
"ProgrammingError at /admin/shops/shop/relation "shops_shop" does not exist 
LINE 1: SELECT COUNT(*) AS "__count" FROM "shops_shop" "

Any advice or hint would be really appreciated 
Kind Regards

Stathis 

-- 
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/60ca7670-d423-49e1-9d4a-ea978e193dd4n%40googlegroups.com.


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

2021-07-06 Thread DJANGO DEVELOPER
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 web visit
 https://groups.google.com/d/msgid/django-users/CAGp2JVHuos6d4%3D-_S%3DR-q8hq48Yzf%3D-xgmPziKEA2a3DYXAzbg%40mail.gmail.com
 

Django Help | Counting word frequency in Django using dictionary.

2021-07-06 Thread DJANGO DEVELOPER
Hi
 I am developing a django project and I want to count word frequency at the 
django admin side.
Means a word is repeating in a string should be counted and be saved in the 
database only.
I have managed to do it on front-end side but now I also want to do it on 
django admin side.
example: any_string = {'word1': 12,'word2': 29}
this the example because I want to get the data this way. word1 is there 
for 12 times in a string and same is the case for word2.
so I need help and your help would be appreciated.
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/672d9b02-382e-4b79-bcaf-6b618b514c28n%40googlegroups.com.


Re: ProgrammingError - relationship does not exist

2021-07-06 Thread Jacob Greene
The issue is with the model not the admin page. I suspect you haven't ran
migrations for the "Shop" model. You defined a "shop" field in the model,
but the database doesn't know anything about it.



On Tue, Jul 6, 2021, 7:16 PM Stathis Angelou  wrote:

> Good evening all, i have created a new app and added a model. Added the
> app under installed apps, and run python manage.py makemigrations and
> migrate and everything worked as expected.
>
> But i believe there is an issue with the admin.py file
>
> from django.contrib import admin
>
> # Register your models here.
> from django.contrib.gis.admin import OSMGeoAdmin
> from .models import Shop
>
> @admin.register(Shop)
> class ShopAdmin(OSMGeoAdmin):
> list_display = ('name', 'location')
>
> Error message:
> "ProgrammingError at /admin/shops/shop/relation "shops_shop" does not
> exist LINE 1: SELECT COUNT(*) AS "__count" FROM "shops_shop" "
>
> Any advice or hint would be really appreciated
> Kind Regards
>
> Stathis
>
> --
> 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/60ca7670-d423-49e1-9d4a-ea978e193dd4n%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/CAF-Y%3De4VFKtEZ7xqmmAp8POv35qqmGoVecArA%2BYToq4_HO9iRg%40mail.gmail.com.


hardware required to use django?

2021-07-06 Thread Rusty
We are planning the development using django.

Could I know the minimum specifications of hardware required to use django?

I would appreciate it if you could let me know based on Windows and Linux.

-- 
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/fdb37212-03a4-4d58-8b5e-070c2a2ddd67n%40googlegroups.com.


Re: hardware required to use django?

2021-07-06 Thread DJANGO DEVELOPER
you can use linux as well and I am using windows 10 right now and it is
working fine with django development.
I also used windows8 and it worked.

On Wed, Jul 7, 2021 at 6:39 AM Rusty  wrote:

> We are planning the development using django.
>
> Could I know the minimum specifications of hardware required to use django?
>
> I would appreciate it if you could let me know based on Windows and Linux.
>
> --
> 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/fdb37212-03a4-4d58-8b5e-070c2a2ddd67n%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/CAKPY9pk30qjeSS75ctZW8oE6s1si%3DLr5%2BuCP--YMLmA4A1ZN_Q%40mail.gmail.com.


Re: Django Help | Counting word frequency in Django using dictionary.

2021-07-06 Thread Lalit Suthar
you can use postgres JsonField
https://docs.djangoproject.com/en/3.2/ref/contrib/postgres/fields/#jsonfield

On Wed, 7 Jul 2021 at 06:05, DJANGO DEVELOPER 
wrote:

> Hi
>  I am developing a django project and I want to count word frequency at
> the django admin side.
> Means a word is repeating in a string should be counted and be saved in
> the database only.
> I have managed to do it on front-end side but now I also want to do it on
> django admin side.
> example: any_string = {'word1': 12,'word2': 29}
> this the example because I want to get the data this way. word1 is there
> for 12 times in a string and same is the case for word2.
> so I need help and your help would be appreciated.
> 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/672d9b02-382e-4b79-bcaf-6b618b514c28n%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/CAGp2JVEM2mq8EPokL9KwU3OGz%2BgaJf%3DgMALZbVa%3DdsEeW1WGiw%40mail.gmail.com.


Re: Django Help | Counting word frequency in Django using dictionary.

2021-07-06 Thread DJANGO DEVELOPER
I am using sqlite3. so only needs to store the data in django
admin/database but in the form of dictionary or in the form of counted
words.

On Wed, Jul 7, 2021 at 9:09 AM Lalit Suthar 
wrote:

> you can use postgres JsonField
> https://docs.djangoproject.com/en/3.2/ref/contrib/postgres/fields/#jsonfield
>
> On Wed, 7 Jul 2021 at 06:05, DJANGO DEVELOPER 
> wrote:
>
>> Hi
>>  I am developing a django project and I want to count word frequency at
>> the django admin side.
>> Means a word is repeating in a string should be counted and be saved in
>> the database only.
>> I have managed to do it on front-end side but now I also want to do it on
>> django admin side.
>> example: any_string = {'word1': 12,'word2': 29}
>> this the example because I want to get the data this way. word1 is there
>> for 12 times in a string and same is the case for word2.
>> so I need help and your help would be appreciated.
>> 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/672d9b02-382e-4b79-bcaf-6b618b514c28n%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/CAGp2JVEM2mq8EPokL9KwU3OGz%2BgaJf%3DgMALZbVa%3DdsEeW1WGiw%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/CAKPY9pmAPnbeEvgL1%3DHdid7yZ_BgF-b34AVKr-n3-bDvcTmgjw%40mail.gmail.com.


Re: hello i need a help

2021-07-06 Thread Richard Dushime
thank you but i wanted to send all the 4 fields and the "to" arguments  how
can i do it? .. its submission form data i tried to loook into the
documentation everywhere they used 3 fields only

On Mon, Jul 5, 2021 at 10:04 PM sum abiut  wrote:

> The error message is very clear send_mass_mail only expect  4 values but
> you are passing in more than four.
> You should only pass in four values.
>
> datatuple = (
> ('f_subject', 'f_message','f_email',
> ['mygm...@gmail.com']),
> # second person
> ('f_subject', 'f_message','f_email',
> ['sec...@gmail.com'])
> )
>
>
> send_mass_mail(datatuple)
>
>
> refer to the documentations
> 
>
>
> On Tue, Jul 6, 2021 at 3:14 AM Richard Dushime 
> wrote:
>
>> i am getting this error down  when trying to submit  my form data to
>> email {{ ValueError at /contact
>>
>> too many values to unpack (expected 4)
>>
>> Request Method: POST
>> Request URL: http://localhost:8000/contact
>> Django Version: 3.2.4
>> Exception Type: ValueError
>> Exception Value:
>>
>> too many values to unpack (expected 4)
>>
>> Exception Location:
>> C:\Users\RDM\Envs\env\lib\site-packages\django\core\mail\__init__.py,
>> line 83, in 
>> Python Executable: C:\Users\RDM\Envs\env\Scripts\python.exe
>> Python Version: 3.9.6
>> Python Path:
>>
>> ['C:\\Users\\RDM\\Desktop\\Web\\KVC\\KVC',
>>  'c:\\users\\rdm\\appdata\\local\\programs\\python\\python39\\python39.zip',
>>  'c:\\users\\rdm\\appdata\\local\\programs\\python\\python39\\DLLs',
>>  'c:\\users\\rdm\\appdata\\local\\programs\\python\\python39\\lib',
>>  'c:\\users\\rdm\\appdata\\local\\programs\\python\\python39',
>>  'C:\\Users\\RDM\\Envs\\env',
>>  'C:\\Users\\RDM\\Envs\\env\\lib\\site-packages']
>>
>>
>>
>> Mon, 05 Jul 2021 15:04:30 +00
>> }}}
>>
>>
>> my settings
>> EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
>> EMAIL_HOST = 'smtp.gmail.com'
>> EMAIL_PORT = '587'
>> EMAIL_HOST_USER = 'myacco...@gmail.com'
>> EMAIL_HOST_PASSWORD = 'almxfemqayldytab'
>> EMAIL_USE_TLS = True
>>
>> here is my views.py
>>
>> def contact(request):
>> if request.method == 'POST':
>> f_name = request.POST['name']
>> f_email = request.POST['email']
>> f_subject = request.POST['subject']
>> f_message = request.POST['message']
>>
>> # send mail function
>> datatuple = (
>> ('f_name','f_subject', 'f_message','f_email',
>> ['mygm...@gmail.com']),
>> # second person
>> ('f_name','f_subject', 'f_message','f_email',
>> ['sec...@gmail.com'])
>> )
>> send_mass_mail(datatuple)
>>
>> if send_mass_mail(datatuple):
>> messages.info(request,'thank you for contacting us')
>> return redirect('contact')
>> else:
>> messages.info(request, 'try again sorry for inconveniency')
>> return redirect('contact')
>> else:
>> messages.info(request, 'try again sorry for inconveniency')
>> return redirect('contact')
>>
>>
>>
>>
>> here down urls.py
>>
>> path("contact", views.contact, name="contact"),
>>
>> then my form html
>>
>>
>>  > "php-email-form" data-aos="fade-left">
>>   {% csrf_token %}
>>   
>> 
>>   > "name" placeholder="Your Name" data-rule="minlen:4" data-msg=
>> "Please enter at least 4 chars" />
>>   
>> 
>> 
>>   > id="email" placeholder="Your Email" data-rule="email" data-msg=
>> "Please enter a valid email" />
>>   
>> 
>>   
>>   
>> > ="subject" placeholder="Subject" data-rule="minlen:4" data-msg=
>> "Please enter at least 8 chars of subject" />
>> 
>>   
>>   
>> > data-rule="required" data-msg="Please write something for us" placeholder
>> ="Message">
>> 
>>   
>>   
>> {% for fmessage in messages %}
>> {{fmessage}}> >
>> {% endfor %}
>>   
>>   > >Send Message
>> 
>>
>>   
>>
>>
>>
>>
>>
>>
>>
>>
>>
>> --
>> 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/CAJCm56LAbJHrbNFworRZsuD-hP5Gok6wH%2BvQw1NgQuwAJ9_S4w%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, se