Re: Django Custom User model and making auth api

2021-04-03 Thread 'Ajay Rathore' via Django users
Hey,

Another alternative is to use graph ql.
https://github.com/graphql-python/graphene-django
Regards
*Ajay Rathore*
Python Developer


On Sat, Apr 3, 2021 at 11:43 AM Ayser shuhaib 
wrote:

> django-rest-auth is still supported, it's not currently receiving updates,
> but you can still use it and it has no issues so far.
>
> On Sat, Apr 3, 2021 at 9:39 AM Saad Mrabet 
> wrote:
>
>> Yes it is in fact the bast option possible, thank you  !
>>
>> On Friday, April 2, 2021 at 11:50:55 PM UTC+1 Ryan Nowakowski wrote:
>>
>>> I don't have a ton of experience with it but when a question includes
>>> the term "create an API", the answer usually includes "just use Django Rest
>>> Framework".
>>>
>>>
>>> On April 2, 2021 1:59:10 AM CDT, Saad Mrabet 
>>> wrote:
>>>>
>>>> Hello every i m currently working on a project where had to overwrite
>>>> the  AbstractBaseUser and i did follow some tutorial :
>>>> https://testdriven.io/blog/django-custom-user-model/
>>>>
>>>> But now I need to make a good login API, so later I can log in with my
>>>> React app,  and i m kinda lost any recommendation about any tutorial  ?
>>>>
>>>> --
>> 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/0ddf5bcf-37e1-45e5-8d66-78b29ec58d91n%40googlegroups.com
>> <https://groups.google.com/d/msgid/django-users/0ddf5bcf-37e1-45e5-8d66-78b29ec58d91n%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>>
> --
> 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/CAE0AZG%2BntrE3v4WthPf69bCjDGHH%3D%2Bj%3D%2BEqDUfTF6tyy3yg%2BWA%40mail.gmail.com
> <https://groups.google.com/d/msgid/django-users/CAE0AZG%2BntrE3v4WthPf69bCjDGHH%3D%2Bj%3D%2BEqDUfTF6tyy3yg%2BWA%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
>

-- 
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/CACDrS2p92nrZdX%2BuEJ3cNw%3Di%3DF5yTM562LhuBsbmhsfLu7030g%40mail.gmail.com.


Re: ModuleNotFoundError -- Please help :)

2021-04-01 Thread &#x27;Ajay Rathore' via Django users
try this

*from reporter.models import Counties*

Regards
*Ajay Rathore*
Python Developer


On Thu, Apr 1, 2021 at 4:17 PM Ryan Nowakowski  wrote:

> Since your models aren't in the migrations python package, I would use an
> absolute path in the import statement here rather than the relative path.
>
> On March 31, 2021 9:50:30 PM CDT, 'Dante Costabile' via Django users <
> django-users@googlegroups.com> wrote:
>>
>> Hiya Folks.  Relatively new to django and quite enjoying it.  However
>> working on a geodjango project and I'm getting this error.
>>
>> [image: Screen Shot 2021-03-31 at 10.48.41 PM.png]
>>
>> Here is the file its referencing:[image: Screen Shot 2021-03-31 at
>> 10.49.30 PM.png]
>>
>> and my file structure:
>>
>> [image: Screen Shot 2021-03-31 at 10.50.11 PM.png]
>>
>> Thanks in advance
>>
>> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/B54524CA-E163-4718-8D5F-D956F2D4A69B%40fattuba.com
> <https://groups.google.com/d/msgid/django-users/B54524CA-E163-4718-8D5F-D956F2D4A69B%40fattuba.com?utm_medium=email&utm_source=footer>
> .
>

-- 
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/CACDrS2prNfm7e0GuLuHBMX%2BJfu8ny2Jv881a3OXTYQwwF3z-ow%40mail.gmail.com.


Re: Python Django Training

2020-12-16 Thread Ajay Prajapati
Interested

Regards,
Ajay Prajapati  |*  SDE 2*
Haptik

M: +91 7030308678


On Wed, Dec 16, 2020 at 7:38 PM Chuck  wrote:

> add me also in the training group, thanks.
>
> On Tuesday, December 15, 2020, 05:51:21 AM PST, manishimwe emmanuel <
> manishimweemmanu...@gmail.com> wrote:
>
>
> Hello add me also in training group?
>
> On Tue, Dec 15, 2020 at 8:35 AM Eugene TUYIZERE 
> wrote:
>
> add me please
>
> On Mon, 7 Dec 2020 at 10:10, narendra thapa 
> wrote:
>
> hello please add me also in training group?
>
>
> On Fri, Feb 21, 2020 at 7:27 PM Bharati Nilam 
> wrote:
>
> Hi,
> I also from Hyderabad and I'm also interested in the training. please tell
> me how to join?
>
> Regards,
> Bharati
>
> On Thu, 20 Feb, 2020, 6:19 PM Thiagu Palaniappan, <
> thiagarajan@gmail.com> wrote:
>
> I'm also interested. Please add me in the group.
>
>
> Thanks & Regards,
> Thiagu
>
> On Mon, Feb 17, 2020 at 12:41 AM Akshay Raul 
> wrote:
>
> I am interested also. Please let me know the details.
>
> On Sat 1 Feb, 2020, 2:42 PM Srikanth K,  wrote:
>
> Hi,
>
> I am from Hyderabad. I am Python Developer by Profession. I am eager take
> up any Python , Django Training (online Preferrable or Weekends). Members
> who require can contact me or share me  there idea.
>
> Regards,
> Srikanth.K
>
> --
> 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/CACPyz-gXb7wo9E0Uhs_pnxF9X52uA10__Fq1xt4trjXUaN3ehQ%40mail.gmail.com
> <https://groups.google.com/d/msgid/django-users/CACPyz-gXb7wo9E0Uhs_pnxF9X52uA10__Fq1xt4trjXUaN3ehQ%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
>
> --
> 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/CAEd%2Bv%3D0gE2dEMXKJ0Nm8FcH2ZxUPAdQspkQKB%2Bg5pZbSc_uZnQ%40mail.gmail.com
> <https://groups.google.com/d/msgid/django-users/CAEd%2Bv%3D0gE2dEMXKJ0Nm8FcH2ZxUPAdQspkQKB%2Bg5pZbSc_uZnQ%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
>
>
>
> --
>
> Thanks & Regards,
>
> *Thiagu Palaniappan*
>
> M +91 (0) 9994318799
>
> *DXC Technology*
> 8th Floor, Tower 1 B DLF IT Park, 1/124 - Shivaji Garden, Nandambakkam
> post, Ramapuram, Chennai - 600 089.
>
> dxc.technology <http://www.dxc.technology/> / Twitter
> <https://twitter.com/dxctechnology> / Facebook
> <https://www.facebook.com/DXCTechnology/> / LinkedIn
> <https://www.linkedin.com/company/dxctechnology>
>
> --
> 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/CAK%3DQXNMzH-iL6BQ3_vfrvTpeY%2BSe5%3DbZm9h5wPW_Dw%2BM2BsvQg%40mail.gmail.com
> <https://groups.google.com/d/msgid/django-users/CAK%3DQXNMzH-iL6BQ3_vfrvTpeY%2BSe5%3DbZm9h5wPW_Dw%2BM2BsvQg%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
>
> --
> 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/CAPGVBeOgomb94NXAm347QqGcJ%3D3MzxULU7eQnY-M56EbC2D9vg%40mail.gmail.com
> <https://groups.google.com/d/msgid/django-users/CAPGVBeOgomb94NXAm347QqGcJ%3D3MzxULU7eQnY-M56EbC2D9vg%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
>
> --
> 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/CAEtntjXVaVAyDCJJzS748zfNVm242U%2B6vsFkynevf5ghnPgDhw%40mail.gmail.com
> <https://groups.google.com/d/msgid/django-users/CAEtntjXVaVAyDCJJzS748zfNVm242U%2B6vsFkynevf5ghnPgDhw%40mail.

Re: Django Whats app Group

2020-08-06 Thread salla ajay
i am also interested .pls add me my whatsup number is 7981928765

subject:python dijago
e -mail: sallaaj...@gmail.com

On Wed, Aug 5, 2020 at 8:09 AM Vishnu Bhandari 
wrote:

> Hi Folks,
> Decided to make a whats app group of all django users (aspiring and
> expert) for sharing problem and asnwers.
> Request you all, please ping me om +919561879917...
> Or u can join thru this link -
> https://chat.whatsapp.com/Gmr7QDkNw8YIxobnzNQfbl
>
> If any existing group exists, please add me there. - 9561879917
>
>
> On Wed, 5 Aug, 2020, 8:26 pm neeraj garg,  wrote:
>
>> Hi Guys,
>>
>> Could you please give me a clue what kind of project you are planning to
>> build?
>>
>> On Wed, Aug 5, 2020, 8:23 PM jhabar singh 
>> wrote:
>>
>>> Sapna, Can you tell me something about your project?
>>>
>>> On Wed 5 Aug, 2020, 5:22 PM yammunap...@gmail.com, <
>>> yammunap...@gmail.com> wrote:
>>>
 Dear I am interested to join with your work. Its my WhatsApp number
 +919384402100

 Best regards,

 Yamuna V



 *From: *Mithlesh Kumar 
 *Sent: *Wednesday, 29 July 2020 12:36 AM
 *To: *django-users@googlegroups.com
 *Subject: *Re: Python-django project



 I am also interested. Please add my number 8750641542





 Regards,

 Mithlesh Kumar



 On Tue, Jul 28, 2020, 19:07 BISWAJEET MISHRA <
 biswajeetmishra...@gmail.com> wrote:

 Hii..

 I'm interested to work with you, U can contact me over whatsapp
 +917978330633.

 Thanks



 On Tue, Jul 21, 2020, 08:39 learn code  wrote:

 Hi everyone,

 I am learning python and django, like to work on the projects to
 improve more.If any one interested to join with me to work on the
 projects,plz send me a email.

 --
 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/e7116e9b-9458-4f49-a638-135c4b5874e0o%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/CA%2B917QuPM99qrVYjfVxdrkyuH%3Db4umunS0mgutMM5r-0J%2BNnmA%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/CAP-2mbSt%2B0%2BbaYnOZNvhY0-7T9SKkE9dPJo17BvQp0HKxj0S8Q%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/C785D392-43C0-4832-860C-7BE114D1F726%40hxcore.ol
 
 .

>>> --
>>> 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/CAJ1QTg%3DdUaBXnSD9tYt_c5v430sOoALX_LAyockqXg_LhoL5pg%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/CAGR%2BspcdF-a4PB_CT3YEaEtJE-SB7dYDe1s7Cj%3DMmUgWxjcFgA%40mail.gmail.com
>>

Re: Python-django project

2020-08-06 Thread salla ajay
i am interested


On Wed, Aug 5, 2020 at 8:21 PM Nagaraju Singothu <
nagarajusingoth...@gmail.com> wrote:

> Im also interested.my whatsapp number is 7659965869
>
> On Wed 5 Aug, 2020, 8:24 PM jhabar singh  wrote:
>
>> Sapna, Can you tell me something about your project?
>>
>> On Wed 5 Aug, 2020, 5:22 PM yammunap...@gmail.com, 
>> wrote:
>>
>>> Dear I am interested to join with your work. Its my WhatsApp number
>>> +919384402100
>>>
>>> Best regards,
>>>
>>> Yamuna V
>>>
>>>
>>>
>>> *From: *Mithlesh Kumar 
>>> *Sent: *Wednesday, 29 July 2020 12:36 AM
>>> *To: *django-users@googlegroups.com
>>> *Subject: *Re: Python-django project
>>>
>>>
>>>
>>> I am also interested. Please add my number 8750641542
>>>
>>>
>>>
>>>
>>>
>>> Regards,
>>>
>>> Mithlesh Kumar
>>>
>>>
>>>
>>> On Tue, Jul 28, 2020, 19:07 BISWAJEET MISHRA <
>>> biswajeetmishra...@gmail.com> wrote:
>>>
>>> Hii..
>>>
>>> I'm interested to work with you, U can contact me over whatsapp
>>> +917978330633.
>>>
>>> Thanks
>>>
>>>
>>>
>>> On Tue, Jul 21, 2020, 08:39 learn code  wrote:
>>>
>>> Hi everyone,
>>>
>>> I am learning python and django, like to work on the projects to improve
>>> more.If any one interested to join with me to work on the projects,plz send
>>> me a email.
>>>
>>> --
>>> 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/e7116e9b-9458-4f49-a638-135c4b5874e0o%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/CA%2B917QuPM99qrVYjfVxdrkyuH%3Db4umunS0mgutMM5r-0J%2BNnmA%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/CAP-2mbSt%2B0%2BbaYnOZNvhY0-7T9SKkE9dPJo17BvQp0HKxj0S8Q%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/C785D392-43C0-4832-860C-7BE114D1F726%40hxcore.ol
>>> 
>>> .
>>>
>> --
>> 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/CAJ1QTg%3DdUaBXnSD9tYt_c5v430sOoALX_LAyockqXg_LhoL5pg%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/CAMyGuAbAa8_Ti0XzhazK8hqWEzmWQriYQR5Wm-4qCxuCarkjhQ%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/CAAogeQQWM3gfunmuQn7QNRO5bFZ-0vB13z-H-OZPg333k_EDdA%40mail.gmail.com.


Re: Please help me out!!!!!

2020-06-03 Thread &#x27;Ajay Rathore' via Django users
Hello Meera,

Did you try using urls as



And I think you should check what messages you received on the shell
where you are running ./manage.py runserver command. This might give
more information on the problem.

Regards

Ajay


On Wed, Jun 3, 2020 at 10:21 AM meera gangani 
wrote:

> Hello Django-users
>
> href is not working
> here is my views.py file and my urls.py file
>
> Please Help me out!!
>
> Thank you in advance
> -Meera
>
> --
> 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/CANaPPPLbk6JV8tQjxkKUiN-H%3D_JLHjztMQfGLK6oUx9ootEojg%40mail.gmail.com
> <https://groups.google.com/d/msgid/django-users/CANaPPPLbk6JV8tQjxkKUiN-H%3D_JLHjztMQfGLK6oUx9ootEojg%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
>

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


Re: Change settings value during run-time in migrations

2018-09-27 Thread Ajay Tripathi

Hi Jason,

You can't do it this way, unfortunately.  I would suggest you use 
> https://github.com/jazzband/django-constance instead
>

Thanks, It helped me.

Cordially,
Ajay Tripathi (atb00ker)

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/b8425123-78a8-4eb0-b16d-8ab79ad09411%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Change settings value during run-time in migrations

2018-09-25 Thread Ajay Tripathi
Hi,

I am trying to change a value in `settings.py` during run-time while 
creating migrations.

**settings.py:**

...
magicVar = "initValue"

**0002_init:**

...
def change_magicVar(apps, schema_editor):
settings.magicVar = "newValue"
...

operations = [
migrations.RunPython(change_magicVar),
]
...

**0003_changed_migrations:**

...
def print_magicVar(apps, schema_editor):
   # Yay! It prints the correct value
   print (settings.magicVar) # prints: newValue
...

operations = [
   migrations.RunPython(print_magicVar),
   migrations.CreateModel(
 name='MagicModel',
fields=[
('someMagic', 
   models.ForeignKey(
  # Oops! This still has the old value, i.e *initValue*
  # I want to achieve the *newValue* here!
  default=settings.magicVar,
  ... 
)),


I want the changed value in migrations, but it looks like the value is 
already been cached.
Does django provide an abstraction to refresh the migrations cache and put 
a new value in it? If not, what possible options do i have to achieve that 
value in the defaults?

**Note:** I am trying to avoid this solution[3] because my database might 
give millions of records and iterating over them isn't ideal.

For external reasons i am also trying to avoid django-livesettings[2]

Thank You
Ajay Tripathi

P.S: Find formatted version of the question on stack overflow here[1].

---

[1]: 
https://stackoverflow.com/questions/52459208/django-change-settings-value-during-run-time-in-migrations
[2]: https://django-livesettings.readthedocs.io/en/latest/about.html
[3]: https://stackoverflow.com/a/40601025/6410464

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/ec7e71ac-52c7-459c-9ee9-3b3da64f3fff%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


customise list editable based on user group in django-admin

2016-11-10 Thread Ajay Kumar
I have two types of users - 1 superuser and 2 support user
I need to customise list_editable so that only superuser can edit and 
support user can only view that field in django-admin interface.
Please let me know which function do I need to override and how to do this.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/a207521a-0539-48d1-b1ec-72696265391c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


TypeError: $.get is not a function

2016-07-25 Thread ajay


//In scirpt

$('#suggest').keyup(function ()
{
   var query = $('#suggest').value;

 $.get("/search/", {suggest:query},function( data ){
 $("#list").html( {% for item in search_list %}
''+{{ item }}+ ''
{% endfor %} )


});



In body







am i doing something wrong 

plz help

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/f874db3a-1e19-4cef-9deb-9beed11159d2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Help debugging static files issue

2016-07-22 Thread &#x27;Ajay M' via Django users
Dear developer,
Please try to setup static files directory in your settings.py file.
It should be a list, like below

STATICFILES_DIRS = [os.path.join(BASE_DIR, 'static', 'app'),
os.path.join(BASE_DIR, 'static')
]
Please let me know if you still face this issue.

On Friday, July 22, 2016 at 5:58:57 PM UTC+5:30, jasonwo...@gmail.com wrote:
>
> Hey there!
> Sorry for the bother, but I'm running into some issues dealing with static 
> files for a new site I'm building with Django. I'm new to django, but I 
> swear I went through at least 5 hours of StackOverflow comments and other 
> guides before hitting up this group. Anyway:
>
> # The issue:
> Static files are not being served correctly, even though they are 
> correctly being collected using the `./manage.py collectstatic`, and placed 
> in a `static/` directory under the project root.
>
> # Debugging information
> OS: Ubuntu 16.04 (4.4.0-31-generic)
> Nginx (reverse proxy and serving static file): 1.11.2
> uWSGI (application server): 2.0.13.1
> Django: 1.9.8
>
> # Where my debugging left me
> In my nginx logs I'm finding requests that correctly get through to uWSGI 
> (page returns fine, though without static assets), where going manually to 
> the URI (www.example.com/static/home/global.css) returns a 404 error.
>
> The nginx error log for the request in question:
>
>> [date_stuff] [error] [log_stuff]: *1 open() 
>> "/server/website//static/home/global.css" failed (2: No such 
>> file or directory), client: [redacted], server: [redacted], request: "GET 
>> /static/home/global.css HTTP/2.0", host: "[redacted]", referrer: "
>> https://www.[redacted]";
>>
>
> Some things that I noticed:
> I don't know how, but the request sent to nginx for the global.css asset 
> is trying to get it from 
> `/server/website//static/home/global.css`, instead of 
> `/server/website/static/home/global.css`.
>
> I'm not sure at that point whether it's an nginx problem or a django one, 
> but for some reason the `` is being added, and nginx is 
> trying to fetch the static files from the wrong place.
>
> # Project overview
> Server/<- Located at the root of the machine 
> at /server
>  Vagrantfile
>  db/
>  letsencrypt/
>  nginx/
>  uwsgi/
>  website/<--- Project root
>  /
>  home/   <--- home app
>  manage.py/
>  
>
>  templates/
>  static/
>  admin/
>  home/
>  global.css   <--- collected from the 
> static dir in the `home` app
>
> # /settings.py config:
>
>> BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
>>
>
>> INSTALLED_APPS = [
>> 'django.contrib.admin',
>> 'django.contrib.auth',
>> 'django.contrib.contenttypes',
>> 'django.contrib.sessions',
>> 'django.contrib.messages',
>> 'django.contrib.staticfiles',
>> 'home',
>> ]
>>
>  
>>
> TEMPLATES = [
>> {
>> 'BACKEND': 'django.template.backends.django.DjangoTemplates',
>> 'DIRS': ['templates'],
>> 'APP_DIRS': True,
>> 'OPTIONS': {
>> 'context_processors': [
>> 'django.template.context_processors.debug',
>> 'django.template.context_processors.request',
>> 'django.contrib.auth.context_processors.auth',
>> 'django.contrib.messages.context_processors.messages',
>> 'django.template.context_processors.static',
>> ],
>> },
>> },
>> ]
>>
>  
>>
> STATIC_URL = '/static/'
>> # STATIC_ROOT = os.path.join(BASE_DIR, 'static/')   <-- I've tried 
>> this and just hardcoding
>>
> STATIC_ROOT = '/server/website/static/' 
>>
>
>> # Nginx server config:
>>
> location /static {
> alias /server/website/static; < I've tried this and setting 
> `root /server/website`
>
>
> Cheers and thanks for any help guys (and sorry for the bother on such a 
> beginner question),
> Jason
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/0f959216-6d33-405a-b3e9-c0de03b602a2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Model classes as containers to objects of another model

2016-07-19 Thread Ajay D
Hi All,

I am fairly new to Django and find myself in the need to write to the 
group. 

I have a django model "A", which has an "items" attribute. "items" is a 
list with objects of another django model "B" (there are no relationships 
between A and B). Everytime I create a new instance of "A", I need to make 
the attributes of all of the "B" objects editable via the template/form of 
"A".

What would the obvious/ideal way to achieve this? 

TIA,
Aj

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/00259140-00dc-48b9-ba29-3166e8ae3313%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Django simple Captacha

2016-07-19 Thread Ajay Kumar


hi Guys

I tried django-simple-captcha on refering 
http://django-simple-captcha.readthedocs.io/…/la…/usage.html 
. Every 
thing works well and goes fine, I need few suggestion on it.

1. How efficiency is this?
2. How strong is this?
3. How easy/hard to cark this captcha?
4. Can we use this to high end applications?

Guys please suggest me for above line items or any this else there please 
let me know about django-simple-captcha, please explain me the pros and 
cons of django-simple-captcha. Thanks in advance.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/58b761a7-98eb-4105-a469-2735f49a0be6%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Provide me Links to learn django framework on Linux

2016-02-08 Thread Ajay Sharma
Many Thanks To Rafael and Christian .

:) :)   I am studying the resources now. 


On Wednesday, February 3, 2016 at 7:46:30 PM UTC+5:30, Ajay Sharma wrote:
>
> Hi everyone on the Group. 
>
> I want resources and web links, where i can learn  Django Framework On 
> Linux platform as I 
>
> am using Ubuntu for the development. 
>
> Please help me . 
>
> thank you to every one in Advance. 
>
> From Ajay .  :) 
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/0b8aa632-1ecf-49b7-a381-6dea59919ea8%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Provide me Links to learn django framework on Linux

2016-02-03 Thread Ajay Sharma
Hi everyone on the Group. 

I want resources and web links, where i can learn  Django Framework On 
Linux platform as I 

am using Ubuntu for the development. 

Please help me . 

thank you to every one in Advance. 

>From Ajay .  :) 

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/4386ebcc-6ebd-4689-9f0b-a4496edaa41b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Push notifications in Django

2015-07-07 Thread Ajay M
It is possible. You can send push notifications in django, using 
django-pushnotifications app.

On Sunday, June 28, 2015 at 9:21:36 AM UTC+5:30, harsh.rathore14 wrote:
>
> I am Rails developer and new to Django. I want to build an Webapp which 
> will have push notification on comments, mentions etc. Is it possible in 
> Django or I should move to node.js
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/9c28fcf0-c6c7-4aca-8ec7-7dd43b7dfb3f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Keeping sessions

2015-05-20 Thread Ajay M
Hi,
I've created my own user model for my project and it is like this

from django.db  import models
from webapp.models.groupimport Group 
from webapp.models.userrole import UserRole

class GroupAdmin(models.Model): 
user_name = models.CharField(max_length = 200, blank=True, 
null=True)
first_name= models.CharField(max_length = 50, blank=True, 
null=True)
last_name = models.CharField(max_length = 50, blank=True, 
null=True)
password  = models.CharField(max_length = 200, blank=True, 
null=True)
group = models.ForeignKey(Group)
email = models.EmailField()
phone = models.CharField(max_length = 15, blank=True, 
null=True)
access_code   = models.CharField(max_length = 200)
is_verified   = models.BooleanField(default = False)
created_user_type = models.ForeignKey(UserRole)
created_user_id   = models.IntegerField()
last_login= models.DateTimeField(null=True, blank=True)
user_role = models.IntegerField(default = 0)
 
def __unicode__(self):
return self.user_name

How do I keep and destroy the session of this user on login and logout. 
When logging in I need to store user_id, user_name and user_role in session.
When another user trying to login in the same browser on another tab, I 
also need to log out of the first user. All the views I have written should 
only be accessed by logged in users.
How can I ensure that?
Any 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+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/13536b95-ec15-4b50-8a4f-cdab09d87c39%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Django inline formset(UI) delete/remove

2015-05-11 Thread Ajay Kumar
I'm trying to do a inline formset with UI not with dajngo built in 
inlineformset_factory form.Here i'm done with add_view and edit_view.Here 
in the edit view i can update the existing record for the both parent and 
child model,and can add new record to the child model.But i cant remove the 
existing record from the child model in inline formset.Every thing is fine 
working at client side.When i click remove button from the UI, the record 
is removed by javascript,But in server side, in the edit_view the #Delete 
Existing record block cloud take the delete/remove functionality.I tried in 
many possible ways but i can't make the delete query for the removed items 
form the client side.

*models.py*

from django.db import models
class Category(models.Model):
name=   models.CharField(max_length=128)

def __unicode__(self):
return self.name
class Product(models.Model):
category=   models.ForeignKey(Category)
name=   models.CharField(max_length=128)
price   =   models.CharField(max_length=128)



views.py

def add(request):
context =  RequestContext(request)
if request.method == 'POST':
category = Category.objects.create(name = request.POST['category'])
try:
for n in range(1,7):
product = Product.objects.create(category= 
category,name=request.POST['name_'+str(n)],price=request.POST['price_'+str(n)])
except KeyError:
pass
return HttpResponseRedirect('/')
return render_to_response('add.html',context)
def edit(request,pk):
category = get_object_or_404(Category,id=pk)
product = Product.objects.filter(category=category)
product_count = product.count()
context =  RequestContext(request)
if request.method == 'POST':
for c in Category.objects.filter(id = category.id):
c.name = request.POST['category']
c.save()
try:
#Update Existing record(child)
for p,n in zip(Product.objects.filter(category = c),range(1,7)):
p.name = request.POST['name_'+str(n)]
p.price = request.POST['price_'+str(n)]
p.save()
except KeyError:
#Delete Existing record(child)
try:
for d in range(1,7):
for i in 
Product.objects.all().filter(name=request.POST.get('name_'+str(d)),price=request.POST.get('price_'+str(d))):
print i.name

except KeyError:
pass
else:
#Add new record(child)
try:
for r in range(1,7):
product,created = 
Product.objects.update_or_create(category= 
category,name=request.POST['name_'+str(r)],price=request.POST['price_'+str(r)])
except KeyError:
pass
return HttpResponseRedirect('/')
args = {'category':category,'product':product,'product_count':product_count}
return render_to_response('edit.html',args,context)




add.html

Add
var i = 1;
function addProduct(){
if (i <= 5){
i++;
var div = document.createElement('div');
div.innerHTML = 'Name:Price:';
document.getElementById('products').appendChild(div);
}}

function removeProduct(div) {   
document.getElementById('products').removeChild( div.parentNode );
i--;}
{% csrf_token %}
Category



Product

(limit 6)
Name:Price:









edit.html

Edit
var i = {{product_count}};

function addProduct(){
if (i <= 5){
i++;
var div = document.createElement('div');
div.innerHTML = 'Name:Price:';
document.getElementById('products').appendChild(div);
}}

function removeProduct(div) {   
document.getElementById('products').removeChild( div.parentNode );
i--;}
{% csrf_token %}
Category



Product



(limit 6)
{% for list in product %}

Name:Price:

{% endfor %}









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

The inline foreign key did not match the parent instance primary key.

2015-05-09 Thread Ajay Kumar
I'm trying to set custom id for my model,

*models.py*

from django.db import models
import uuid


def get_ref_id():
 ref_id = str(uuid.uuid4())[:11].replace('-','').lower()
 try:
 id_exists = Sample.objecsts.get(ref_id = ref_id)
 get_ref_id()
 except:
 return ref_id


class Sample(models.Model):
 ref_id = models.CharField(max_length = 128, primary_key = True, default=
get_ref_id)
 email = models.EmailField(max_length=128,unique=True)


 def __unicode__(self):
 return self.email


class MobileNumber(models.Model):
 sample = models.ForeignKey(Sample)
 mobile_number = models.CharField(max_length=128)


*admin.py*
















*from django.contrib import adminfrom sample.models import Sample, 
MobileNumberclass MobileNumberInline(admin.StackedInline): model = 
MobileNumber extra = 1class SampleAdmin(admin.ModelAdmin): inlines = 
[MobileNumberInline]admin.site.register(Sample,SampleAdmin)*





When i try to insert a record from admin it shows the error, But when i 
tried only with parent table it works.When i came to add child table its 
not working.Its just shows "Please correct the error below".And then i 
tried to save through userinterface views(out of admin) it shows the 
following error "The inline foreign key did not match the parent instance 
primary key". 





-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/854f71c8-2b21-4184-a533-497f39b236d6%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Can't perform Querying using Q objects

2015-03-11 Thread Ajay M
Hi Vijay,
The search text is okay.. I think when  using the state__state_name and 
city__city_name relations Django INNER JOIN removes the shop without 
existing relation from the result.
   
   On Wednesday, March 11, 2015 at 8:22:55 PM UTC+5:30, Vijay Khemlani 
wrote:
>
> At least when using Postgres that query makes a LEFT OUTER JOIN so it 
> shouldn't discard Shops just because they don't have a state or city.
>
> So your query seems to be OK
>
> are you sure your search text is fine? the orm will not automatically 
> strip the search_text into a list of keywords or things like that. For 
> example, searching for "ski shop" will not match a Shop with name "ski 
> super shop".
>
> On Wed, Mar 11, 2015 at 11:30 AM, Ajay M  > wrote:
>
>> Hi I'm a newbie to Django. I'm trying to implement a search feature like 
>> this.
>>
>> query_results = Shops.objects.filter\
>> (Q(shop_name__icontains=search_text)\
>> |Q(state__state_name__icontains=search_text)\
>> 
>> |Q(city__city_name__icontains=search_text)).distinct()
>>
>> I would like to search Shops based on the shop_name, state_name and 
>> city_name. State and city fields are foreign keys. For some 'Shops' state
>> andcity are null. However, shop_name contains the search_text. So I'm 
>> not getting those 'Shops' by running this query. Any help on this is 
>> 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 post to this group, send email to django...@googlegroups.com 
>> .
>> Visit this group at http://groups.google.com/group/django-users.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/django-users/0c156715-b2fb-46ab-ad3d-d25235e7c4ca%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/django-users/0c156715-b2fb-46ab-ad3d-d25235e7c4ca%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/a312dafe-8def-47fd-89a7-33bec42c5ba3%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Can't perform Querying using Q objects

2015-03-11 Thread Ajay M
 

Hi I'm a newbie to Django. I'm trying to implement a search feature like 
this.

query_results = Shops.objects.filter\
(Q(shop_name__icontains=search_text)\
|Q(state__state_name__icontains=search_text)\

|Q(city__city_name__icontains=search_text)).distinct()

I would like to search Shops based on the shop_name, state_name and 
city_name. State and city fields are foreign keys. For some 'Shops' stateand
city are null. However, shop_name contains the search_text. So I'm not 
getting those 'Shops' by running this query. Any help on this is 
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+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/0c156715-b2fb-46ab-ad3d-d25235e7c4ca%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Using class based views.

2015-02-23 Thread Ajay M
Hi all,
I'm on a Django project, and I have written the following functions in my 
views.py.

def my_view_function_1(request):
#Some code
return HttpResponse(--)


def my_view_function_2(request):
#Some code
return HttpResponse(--)


def my_view_function_3(request):
#Some code
return HttpResponse(--)


Some of them are POST requests and some of them are GET.
I need to switch to class based views. Is there any ways to include 
multiple GET requests and POST requests in class based views?

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/9ea40ca1-387e-4234-be01-504886d7de07%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Django Inline formset with jquery

2015-02-16 Thread Ajay Kumar


Hello all,

I'm trying to build this following link feature in django, 
http://demo.smarttutorials.net/jquery-autocomplete/

Here by choosing serial_no and the rest of the fields name and author 
should be auto populate. Auto populate works for first inline formset and 
able to save it but when I add another inline formset auto populate is not 
working plus I'm unable to delete it or save it.

models.py
from django.db import models
class Book(models.Model):
serial_no = models.IntegerField(max_length = 100, unique = True)
name = models.CharField(max_length = 50)
author = models.CharField(max_length = 50)

def __unicode__(self):
return self.name

class CustomerOrder(models.Model):
name = models.CharField(max_length=256)

def __unicode__(self):
return self.name

class Order(models.Model):
customer  =  models.ForeignKey(CustomerOrder)
serial_no = models.IntegerField(max_length = 100, unique = True)
name = models.CharField(max_length = 50)
author = models.CharField(max_length = 50)
quantity = models.IntegerField(max_length = 100)

def __unicode__(self):
return self.name


forms.py

from django import forms
from bookapp.models import CustomerOrder


class CustomerOrderForm(forms.ModelForm):
class Meta:
model = CustomerOrder
exclude = ('customer',)


views.py

from django.http import HttpResponse
from django.shortcuts import render
from bookapp.models import *
from bookapp.forms import CustomerOrderForm
import json
from django.core.exceptions import ObjectDoesNotExist
from django.http import HttpResponseRedirect
from django.template import RequestContext
from django.core.context_processors import csrf
from django.shortcuts import render_to_response, get_object_or_404
from django.forms.models import inlineformset_factory


def home(request):
context =  RequestContext(request)
OrderFormSet =   inlineformset_factory(CustomerOrder, Order  ,extra=1, 
exclude=('customer',))
if request.method == "POST":
customerorderform = CustomerOrderForm(request.POST)
orderformset = OrderFormSet(request.POST)
if customerorderform.is_valid() and orderformset.is_valid():
a = customerorderform.save()
orderformset.save(commit=False)
orderformset.instance = a
orderformset.save()
return HttpResponse('Added')
else:
customerorderform = CustomerOrderForm()
orderformset = OrderFormSet()
for orderform in orderformset:
orderform.fields['serial_no'].widget.attrs = {'id' : 'sno', 
'onkeydown':"myFunction()"}
orderform.fields['name'].widget.attrs = {'id' : 'bname'}
orderform.fields['author'].widget.attrs = {'id' : 'bauthor'}

args = {}
args.update(csrf(request))
args = {'customerorderform':customerorderform, 'orderformset':orderformset}
return render_to_response('home.html',args,context)

def fetch_serial_nos(request):
serial_nos = map(lambda x: str(x.serial_no), Book.objects.all())
return HttpResponse(content = json.dumps({'serial_nos': serial_nos}), 
content_type = "application/json; charset=UTF-8")

def get_entry_corresponds_to_serial_no(request):
serial_no = request.GET['serial_no']
try: 
entry = Book.objects.get(serial_no=int(serial_no))
data = {'name': entry.name, 'author': entry.author}
except (ObjectDoesNotExist, ValueError):
data = {'name': '', 'author': ''}
return HttpResponse(content = json.dumps(data), content_type = 
"application/json; charset=UTF-8")


home.html




Enter S.NO

$(function() {
$(".inline.{{ orderformset.prefix }}").formset({
prefix: "{{ orderformset.prefix }}",
})
})



Orders
{% csrf_token %}

Customer
{{customerorderform}}

   
Order
{{ orderformset.management_form }}
{{ orderformset.non_form_errors }}
{% for form in orderformset %}
{{ form.id }}

{{form}}

{% endfor %}









$(function(){
$.ajax({
type: "GET",
url: '/serial_nos/',
success: function (response) {
serial_nos = response['serial_nos'];
$( "#sno" ).autocomplete({
source: serial_nos
 });
},
});   
});
function myFunction(){ 
var sno = document.getElementById("sno").value;
console.log(sno)
document.getElementById("demo").innerHTML = "You selected: " + sno;
$.ajax({
type: "GET",
url: '/entry/',
data : {
serial_no : sno,
},
success: function (response) {
console.log('success') 
bname.value = response['name'];
bauthor.value = respo

Django inlineformset autocomplete and autopopulate by ajax

2015-02-12 Thread Ajay Kumar


I'm trying to do this following link feature in django,
http://demo.smarttutorials.net/jquery-autocomplete/

Here by choosing country the rest of the fields will be auto populated, 
like this i'm trying to achieve in django, If any idea pls tell me it will 
be very great for me


This is Product table,by this i will add many products
*models.py*
class Product(models.Model):
 store = models.ForeignKey(Store)
 code = models.CharField(verbose_name='Product Code', max_length=128, 
blank=False)
 name = models.CharField(verbose_name='Product Name', max_length=128, 
blank=False)
 unit_price = models.FloatField(verbose_name='Unit Price', blank=False)
 in_stock = models.IntegerField(verbose_name='In Stock', default=0, 
blank=False)


This is Invoice order table, in this i will get customer details
class Invoice(models.Model):
 customer = models.ForeignKey(Customer)
 date = models.DateTimeField(auto_now=True, blank=False)


This in Invoice Item order table which is in inline formset 
class InvoiceItem(models.Model):
 invoice = models.ForeignKey(Invoice)
 product = models.ForeignKey(Product)
 particular = models.CharField(verbose_name='Particular', max_length=128
, blank=False)
 quantity = models.IntegerField(verbose_name='Quantity', default=0)
 unit_price = models.FloatField(verbose_name='Unit Price', blank=False)
 tax_rate_percentage = models.FloatField(verbose_name='Tax Rate 
Percentage', blank=False)

*views.py*
I'm trying to raise invoice by autopopulate feature.
def add_invoice(request):
  store = Store.objects.get(id=pk)
  product = Product.objects.filter(store=store)
  context =  RequestContext(request)
  InvoiceItemInlineFormSet = inlineformset_factory(Invoice, InvoiceItem, 
extra = 1,exclude=('invoice',))
  if request.method == 'POST':
invoiceform = InvoiceForm(request.POST)
invoiceformset =  InvoiceItemInlineFormSet(request.POST)
if invoiceform.is_valid() and invoiceformset.is_valid():
   invoice = invoiceform.save(commit=False)
   invoice.store = store
   invoice.save()
   invoiceformset.save(commit=False)
   invoiceformset.instance = invoice
   invoiceformset.save()
   return HttpResponseRedirect('/store_invoice/%s/invoice/'% pk)
   else:
  invoiceform = InvoiceForm()
  invoiceformset =  InvoiceItemInlineFormSet()
   args = {}
   args.update(csrf(request))
  args = {'email':email,'store':store,'invoiceform':invoiceform, 
'invoiceformset':invoiceformset}
  return render_to_response('invoice/invoice_add.html',args,context)


*invoice_add.html*

{% extends "base_site.html" %}
{% load staticfiles %}
{% block title %}Add New Order | Finvoicez{% endblock %}
{% block page-heading %}Add New Order{% endblock %}
{% block content %}


$(function() {
$(".inline.{{ invoiceformset.prefix }}").formset({
prefix: "{{ invoiceformset.prefix }}",
})
})


{% 
csrf_token %}


Customer
{{invoiceform}}



Order Items
{{ invoiceformset.management_form }}
{{ invoiceformset.non_form_errors }}
{% for form in invoiceformset %}
{{ form.id }}

{{form}}

{% endfor %}

Add Order


{% endblock %}


Here i'm trying to bring when i'm adding Invoice Item , by selecting the 
product code the rest of fields want to be autopopulate by corresponding 
Product details(Particular,unit price and tax) and it must be in 
inlineformset, for every 'add another' it must be autopopulate, like above 
reference link.
thanks in advance



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


Django Query Set

2015-02-11 Thread Ajay M
I'm on a Django Project, I'm stuck with this situation. I've 3 Models, 
records,users and towns. Records are posted by users who belongs to towns. 
User may be a mobile user or a web user. Primary key of users is a foreign 
key in records, primary key of towns is a foreign key in users. I need to 
find the total number of posts made by web users and mobile users, who 
belongs to the top 5 towns by numbers of records. Can any one help me to 
find that?

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


Django Auth\Auth

2015-02-01 Thread Ajay M
Hi,
I'm a new bee to Django, I need to use signup/login facilities in my project
How do I customize and use django Auth/Auth feature? On sign up I have to 
store many details than just first_name, last_name, email and password. Can 
any one help me :) ?

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


Custom Model Field in Django

2011-06-06 Thread Ajay
I have a model lets say, MyModel which has a foreign key to another
model say Tag.

class MyModel(models.Model):
id=models.AutoField(primary_key=True)
name=models.CharField(max_length=200)
tag = models.ManyToMany(Tag)

I have approximately 50,000 instances of MyModel and each MyModel can
have 100 Tags.

If I use the above model I will get 5Million entries in a table,
mymodel_tag but I can use all the features of ORM.

However If I write custom methods and treat above field as an array of
integers and write custom code to retrieve/save ids of tags associated
with MyModel, I will have just 50K entries but I will have to write
custom code for retrieval etc.

My Question is :
a) Which one should be used in this case?
b) If I want to write above only using an extra column in mymodel
table which will be the array of ids of all the tags associated with
each MyModel, how do i do that?

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



Re: Newbie Problem with Django reverse()

2011-03-28 Thread Ajay
Hi Alendit,

Thanks for explanation. I understand its not necessary but want to
understand how reverse() works-checked source but did not understand
much. my doubt is if I use something like :

reverse('django.contrib.auth.views.password_change_done'),

and have url entry like as follows.

 url(r'^change-password-done/$', 'profile.views.password_change_done',
name='django.contrib.auth.views.password_change_done'),

now I do not have any entry with "function string" with
'django.contrib.auth.views.password_change_done', but I have an entry
with name='django.contrib.auth.views.password_change_done', so django
should pick this. But it complains it can not find reverse for this.
It should either pick it from
django.contrib.auth.views.password_change_done or should pick the name
entry from my urlconf.

Is it because my name is separated with '.' ? Is there any such
constraints on the name entry or is it the problem because a view with
this name already exists in auth app.

Thanks for the help.


On Mar 27, 7:09 pm, Alendit  wrote:
> Hi,
>
> if only one url is bound to a controller there is no need for a name
> argument. When you are specifying a name for an expression and it have
> got the same name as the controller a conflict arise. Just drop the
> name argument and it should work.
>
> Alendit.
>
> On 27 Mrz., 09:54, Ajay  wrote:
>
> > I am missing something really basic here.
>
> > I am trying to reuse django's change password views. I have following
> > in urls.py:
>
> > (r'^change-password/$', 'profile.views.change_password',
> > {},'change_password'),
> > url(r'^change-password-done/$', 'profile.views.password_change_done',
> > name='django.contrib.auth.views.password_change_done'),
>
> > and in corresponding views.py:
>
> > from django.contrib.auth.views import password_change,
> > password_change_done
>
> > def
> > change_password(request,template_name="password_change_form.html"):
> >     """Change Password"""
> >     return password_change(request,template_name=template_name)
>
> > def password_change_done(request,
> > template_name="password_change_done.html"):
> >     return render_to_response(template_name,(),context_instance=
> > RequestContext(request))
>
> > but I am getting following error:
>
> >     Reverse for 'django.contrib.auth.views.password_change_done' with
> > arguments '()' and keyword arguments '{}' not found.
>
> > looked at the source and saw this line:
>
> > post_change_redirect =
> > reverse('django.contrib.auth.views.password_change_done')
>
> > If I change my urls.py entry to following , I do not get the above
> > error:
>
> > url(r'^change-password-done/$',
> > 'django.contrib.auth.views.password_change_done', name='anything'),
>
> > but I am confused as reverse() should look-up using the "name"
> > parameter? What am I missing here?
>
> > I am using django 1.2.3

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



Newbie Problem with Django reverse()

2011-03-27 Thread Ajay
I am missing something really basic here.

I am trying to reuse django's change password views. I have following
in urls.py:

(r'^change-password/$', 'profile.views.change_password',
{},'change_password'),
url(r'^change-password-done/$', 'profile.views.password_change_done',
name='django.contrib.auth.views.password_change_done'),

and in corresponding views.py:

from django.contrib.auth.views import password_change,
password_change_done

def
change_password(request,template_name="password_change_form.html"):
"""Change Password"""
return password_change(request,template_name=template_name)

def password_change_done(request,
template_name="password_change_done.html"):
return render_to_response(template_name,(),context_instance=
RequestContext(request))

but I am getting following error:

Reverse for 'django.contrib.auth.views.password_change_done' with
arguments '()' and keyword arguments '{}' not found.

looked at the source and saw this line:

post_change_redirect =
reverse('django.contrib.auth.views.password_change_done')

If I change my urls.py entry to following , I do not get the above
error:

url(r'^change-password-done/$',
'django.contrib.auth.views.password_change_done', name='anything'),

but I am confused as reverse() should look-up using the "name"
parameter? What am I missing here?

I am using django 1.2.3

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



Design help

2011-03-23 Thread Ajay
Hi all,

I have a flow which I am not sure how to design with maximum reuse of
existing apps/features.

Flow :-
1) A non registered user comes and uploads his profile - (NOTE - there
is no user sign up form,only profile upload form).
2) Admin comes , approves the profile, edits it if he wants and then
assign it a profile id. Activates the profile.
3) Upon activation a mail is sent to the user (email id is provided in
the profile), with his profile id(which will be his username) and a
random password which he can change from site.


Additional Requirement :-
a) User wants to change his profile information, he edits it and saves
it but his profile information is not yet changed.
b) Changes should go to admin, if he approves the changes then new
profile information is saved, else he can reject the changes.


I am not sure how to do this especially the editing profile part.

My first attempt is like this:
a) create profile model and use generic create_update view to upload
the profile. Add a field of is_active.
b) Admin filters on basis of is_active and assigns them a profile_id.
c) Admin then goes on to create a user with that profile id as the
username and a FIXED password e.g. "changeit".
d) Admin then goes to the profile and then associates the profile with
the user.

Things that I am trying to figure are :
a) how to send the mail with credentials ? Can I use signals ?
b) how to make sure that in this process some user is not missing his
profile and some profile is not activated and still missing user? Can
I make some sort of filter in admin for this?
c) How to allow the editing of profile to be monitored by admin?


I am open for completely new flow :- only unchangeable requirements
are:
1. user can login only after admin has approved his profile and he
must be sent a mail once approved.
2. new profile of user can be saved only after approval by admin.

Sorry for the long mail.

Regards
Ajay

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



Configuring Django-Sentry to send error mails

2011-03-04 Thread Ajay
am using django-sentry for logging errors. I also want to enable
throttled error mails to be sent to admins whenever an error occurs.
But I can not get it working.

a) Normal django error mailing is working. b) but on removing ADMINS
and adding SENTRY_ADMINS(like below) it stops working:

   DEBUG = False
TEMPLATE_DEBUG = DEBUG

SENTRY_TESTING = True

ADMINS = ()
SENTRY_ADMINS = ('my.n...@domain.com',)

MANAGERS = ADMINS



MIDDLEWARE_CLASSES = (
'sentry.client.middleware.SentryResponseErrorIdMiddleware',

)

EMAIL_USE_TLS = True
EMAIL_HOST = 'smtp.gmail.com'
EMAIL_HOST_USER = 'n...@gmail.com'
EMAIL_HOST_PASSWORD = 'password'
EMAIL_PORT = 587

Though entries are correctly being made and shown in panel. I mark all
errors as resolved before testing(to satisfy throttle condition of
sentry) but it is still not working.

Can anyone point to what I am doing wrong here?

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



django models/ sqlalchemy

2009-08-26 Thread ajay

HI,
I have used sqlalchemy for database model creation instead django
default ORM.
Now i need to use fixture to load the initial data as i run test
cases.
This is error message "DeserializationError: Invalid model
identifier:"
The models are not defined in models.py file as i am using
alchemy .
Is there any way i can use fixture to load initial data in my
database .

my structure of app look like this
 models.py
 views.py
  alchemy.py - database models are defined here .
  tests.py


   I am using json as serialized data.

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



Django model register for admin section

2009-08-18 Thread ajay

Hi ,
   To register model in admin section we need to Register individual
class
   Example:
  admin.site.register(Poll)
  admin.site.register(Choice)
 admin.site.register(Vote)

Is there other way to register all class by single register call  like
this
admin.site.register(Poll,Choice,Vote)

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



problem in executing sqlflush option in windows

2009-08-04 Thread ajay

Hi,
   Am trying to run sqlflush command on windows OS. Below is what i
tried

  C:\>Python26\Scripts\django-admin.py sqlflush
   Error: Settings cannot be imported, because environment
variable DJANGO_SETTINGS_MODULE is undefined.

My site is in folder c:\src\mysite is my project site
 I have set python environment to c:\src\mysite ;
 I set DJANGO_SETTINGS_MODULE =  mysite.settings


C:\>Python26\Scripts\django-admin.py sqlflush  --
settings=SETTINGS
 I get a message sqlflush has not option –settings

Can some one  help me to sort out this problem

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