Re: View "functions" that are callables?

2024-05-16 Thread Anthony Flury
I can't see why not - as far as Python is concerned a callable is a
callable.

There is a deep in the weeds way for a caller to determine if a callable is
a __call__ method on a class, but I really doubt Django does anything close
to that - what would be the benefit.

On Wed, May 15, 2024 at 8:39 PM Christophe Pettus  wrote:

> Hi,
>
> I'm surprised I don't know this, but: Can a view "function" in a urlconf
> be a callable that is not actually a function, such as a class with a
> __call__ method?
>
> --
> 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/F70DCB4E-1307-42C2-AC62-CA2DC98DCD5B%40thebuild.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/CAN0Bb7fx5t1FC5WKRwkE31%3DYvnTVRoSi_hYqDB%2B%3DZG2-7zonzg%40mail.gmail.com.


Re: Account verification

2024-05-13 Thread Anthony Flury
Your register view is setting is_active to True - regardless of email
verification.

Remember that the email confirmation will happen asynchronously to the
registration.

What I do is have a separate table that records that a user needs to
complete the verification process.
So registration sends the email (with a link) to the user and adds a record
to the verification pending table.

I then have the verification view which sets the user to be Active and
deleted the record in the pending table.



On Mon, May 13, 2024 at 1:27 PM Kennedy Akogo 
wrote:

> I'm attempting to implement a registration system with email verification.
> While the email verification functionality is working - sending an email to
> the user for verification - I'm encountering an issue where users are able
> to log in even without verifying their email addresses.
>
> My goal is to restrict login functionality for users who haven't verified
> their email addresses. In other words, users should only be able to log in
> if they have completed the email verification process.
>
> Please advise ,I have attached images of the login and register view
>
>
> --
> 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/CAJBDwusqGZXgHHg55uOvh_9h1VB8D3o1pxfLPcaJTJHViXrwZg%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/CAN0Bb7eQQ76s_VL2z%2BSc%3DEfHH%3DxqRePsp9Ph8teC2KN2ZqjF2w%40mail.gmail.com.


Re: Exciting Opportunity: Join Our Django WhatsApp Bulk Messaging Project!

2024-02-19 Thread Delsan Anthony Soliva
I would love to contribute on this project
My account is github.com/delsananthony

On Mon, Feb 19, 2024, 12:48 AM SURAJ TIWARI  wrote:

>  Join Our Django WhatsApp Bulk Messaging Project!
>
>  Hello everyone,
>
> Are you looking for an exciting opportunity to gain hands-on experience in
> Django development? Do you want to work on a meaningful project that
> leverages WhatsApp for bulk messaging? We're thrilled to invite you to join
> our dynamic team!
>
>  Benefits:
>
>- Get hands-on experience working on a real-world Django project.
>- Learn how to leverage WhatsApp for bulk messaging, a valuable skill
>in today's digital landscape.
>- Opportunities for hybrid work, allowing flexibility in your schedule.
>- Collaborate with experienced developers and gain valuable mentorship.
>- Access to cutting-edge tools and technologies.
>
>  Opportunities Available:
>
>- Django developers
>- Frontend developers
>- UI/UX designers
>- Quality assurance testers
>
> 欄 How to Join: Simply reply to this message expressing your interest,
> and we'll provide you with all the necessary details to get started on our
> project.
>
> Let's work together to create something amazing and gain valuable
> experience along the way! ✨
>
> Best regards,
>
> Suraj Tiwari
>
>
> --
> 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/e8a705fd-10d9-4c1a-b4ba-0a7b896dbfean%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/CAGrbgsjXTNFfvNG6HH2mXtAjUv3Hg4HD1cOdPbLZ85G5jnThMg%40mail.gmail.com.


Re: Looking for collaborators for an online marketplace project with Python, Django, React.js and Next.js

2024-02-11 Thread Anthony Blake
Hey I’m interested

On Sat, Feb 10, 2024 at 11:54 AM Jorge Bueno 
wrote:

> The project:
>
> I am working on an exciting project that I think you might be interested
> in. It's about an online marketplace similar to the US farmers and
> livestock markets, but with an online focus. The project is already half
> done, with a well-defined requirements list and backlog that will allow you
> to learn a lot while contributing to a real project.
>
> Technologies:
>
> We are using Python and Django for the backend, Next.js and React for the
> frontend.
>
> What we are looking for:
>
> We need help to get django working making python manage.py runserver and
> also all the procedures to check it works well as unit tests right now we
> have the following functionalities programmed the MVP:
> 1.User Registration
> User Profiles
> Product Listing
> 4.Search and Filters
>  5.Shopping Cart
>  6.Payment System
> 7.Ratings and Reviews
> 8.Messaging
>  Notification system
> 10.User management
> Why collaborate:
>
> You will learn a lot: The project is well organized and will allow you to
> work with modern and relevant technologies.
> You will contribute to a real project: Your work will have a direct impact
> on the success of the project.
> You will be part of a community: We are a passionate team committed to the
> success of the project.
> How can you participate?
>  You can access my public GitHub repository here:
> https://github.com/Programacionpuntera/Marketplace-Supremo
>
> --
> 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/153e4e9d-4453-4280-8b06-27c8cbd1f72fn%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/CAJvYBs36mTKHMQVAm3NdiQPrt-EJFPf6rLOTsXxv%2BTAwUJbwLQ%40mail.gmail.com.


Re: Internship and job in python and Django related

2023-06-07 Thread Anthony Allen
Hello Brother.
Please am currently learning python/Django. Please I will need your help
wherever necessary please my brother;


On Wed, Jun 7, 2023 at 3:17 PM Shubham DJ  wrote:

> Hello, I’m Shubhang Jori from Nerul Navi Mumbai. I have been learning web
> development for a few months now and have gained familiarity with Django,
> python , MySQL, HTML  and CSS. Also I have completed 3 months internship in
> trivia software as a python intern. As a student , I am actively seeking
> Full-time job opportunities as well as internship opportunities that will
> provide me with hands on experience in Django , python and contribute to my
> professional growth.  I look forward anyone who can accept me as a full
> time employee as well as an intern
>
>
> Also I attached resume for your reference.
> [image: PDF file]
> shubham cv-1-2.pdf
> 
>
> --
> 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%2B1KL_nGkLuktOc_3GEfDB1yzHCrovb_-rKJgT2trhsqnzn2rg%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/CA%2B2yem6E5Q1xREywH1P37PBHFCqi5pjnUhqgkvZ_MrgJ5d1AEQ%40mail.gmail.com.


django site using allauth in an iframe inside a wiki

2020-07-24 Thread Anthony Petrillo


We have a django site that we have created, which requires authentication 
(using allauth).  We would love to have that django site in an iframe 
inside a wiki.  We can get other things to show up in the iframe (google 
docs, etc), but our site refuses to run.

Is there a secret we should know, or is this just an impossible thing to do?

-- 
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/e22b8a37-dfdb-4015-8616-53978b7f33b1o%40googlegroups.com.


RE: Open Source IDE to start with Django Web development

2019-11-07 Thread Anthony Winner
Himanshu,

I agree, IDE’s are a really personal choice, everyone as you can see has a 
different view of what is good, I for instance Love Eclipse, mainly as I have 
used it for 10+ years, I know it quirks(all IDE’s have them) and as I work with 
c , Python, embedded code, SQL and others, it simply fills the bill of a one 
stop shop for me.  Currently I have one setup with PyDev (the python plugin), 
the c developers plugin, a SQL admin app (DBeaver) , and many other plugins to 
simply make things easy for me. Using it for Django / Python is a breeze, 
especially when it come to debugging, one button to start the system in regular 
or debugging mode, understands the python threads created in Django,  and 
allows me to find bugs and strange interactions easily.

So my suggestion is, . to figure out what makes a “good” IDE to you, shop 
through the suggestions from the replies, and choose a top two or three that 
seem to fit the bill for you, and then spend some time with them, I think 
following that path will lead you to what works for you. Remember an IDE is not 
just an editor, it an environment, so it should cover all the bases you need, 
for Django work, you need the editor (for Python, CSS, strait text, …) , a 
debugger, DB admin and management, some web admin,…

Cheers
Anthony


From: django-users@googlegroups.com  On Behalf 
Of Siratim Mustaquim
Sent: Thursday, November 7, 2019 5:39 AM
To: django-users@googlegroups.com
Subject: Re: Open Source IDE to start with Django Web development


** External Email **
Why don't you just try a few IDE's and text editors, IDK how much OSS or NonOSS 
IDE will affect your project, but if 'you' don't feel comfortable with it, I 
can guarantee, that will affect your project.

Assuming u are not in a limited internet connection package, download a few of 
the available ones, and start using them.

PyCharm IDE is a great tool. But it may feel big and bulky sometimes,
while VSCode editor is faster in terms of opening projects.

I tried Geanny, didn't like it, because it made some weird behavior I terms of 
indentation and tabs, I couldn't figure how I could make "tab=4spaces" instead 
of "tab=1tab".

Vim and Vim like ones are too difficult for me, so I skipped.

I saw people developing python in Visual Studio. Again, amazing IDE, might feel 
a bit heavy at one point.

And last but not least, The one and Only IDLE.
I still like it, and for quick scripting and quick checks, amazing.

So, pick one that is comfortable for you. What is easy to me might not be the 
same for u. Try a few, find what u like.

Happy Coding

On Thu, Nov 7, 2019, 7:03 PM vineet daniel 
mailto:vineetdan...@gmail.com>> wrote:
VSCode.

On Thu, 7 Nov 2019, 16:39 John McClain, 
mailto:jmcclain0...@gmail.com>> wrote:
agreed, but...

pycharm is dedicated to python and vs code is generally suitable for any others 
assuming the person operating can configure their environments.

the person was asking for an IDE suitable for python specifically which is why 
I throughout pycharm

ultimately, I would go with vs code but it takes a bit more knowledge than 
pycharm does

On Thu, 7 Nov 2019 at 11:00, Parth Joshi 
mailto:joshipart...@gmail.com>> wrote:
VS Code works like a Charm. (Pun intended :-) )

There are lint, autocomplete and git extensions which you can use for setting 
up dev environment.

Regards,

Parth Joshi




On 06-Nov-2019, at 4:22 PM, himanshu goyal 
mailto:hgoyal1...@gmail.com>> wrote:

To Community,

Greetings!

Could you suggest a good open source IDE for Django? URL to download will be 
helpful.

Thanks,
Himanshu
India

--
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<mailto:django-users+unsubscr...@googlegroups.com>.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/767f5e59-20b7-4a3a-989a-dedb0e40ceff%40googlegroups.com<https://nam05.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgroups.google.com%2Fd%2Fmsgid%2Fdjango-users%2F767f5e59-20b7-4a3a-989a-dedb0e40ceff%2540googlegroups.com%3Futm_medium%3Demail%26utm_source%3Dfooter=02%7C01%7C%7C512551119b0c4401dbfe08d76387e225%7C994c3e8bb42845fb8640593ef0303f7f%7C0%7C0%7C637087307586356711=WmGYhJcyLaRJSo7Ei608ZQhvclnOcbEE59Q1z7Q3ep0%3D=0>.

--
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<mailto:django-users+unsubscr...@googlegroups.com>.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/37EB9045-4C0B-465E-BDF8-C90A73956A45%40gmail.com<https://nam05.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgroups.google.com%2Fd%2Fm

Re: Django bootstrap calendar

2019-10-04 Thread Anthony Goslar
Simpleisbetterthancomplex.com


Kind Regards



On Fri, 4 Oct 2019, 09:32 lemme smash,  wrote:

> it's more about client, so you probably want to look for calendar
> libraries and then JUST make an api for it.
>
> On Tuesday, September 24, 2019 at 12:47:37 AM UTC+3, Perceval Maturure
> wrote:
>>
>> Is there anyone with a step by step procedure of doing this app in a
>> Django 2.1 environment For newbies like some of us in Django
>> Regards
>> Perceval
>> --
>> Sent from Gmail Mobile
>>
> --
> 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/61987203-8111-48ea-8214-df1a4cdbc157%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/CAM9cxca5tQcQVoX3GB_OpcCWLKAC6XPgBYuVhm1QfPty_eq5RQ%40mail.gmail.com.


Re: Staticfiles on S3

2019-09-16 Thread Anthony Goslar
Try using Django-storages and follow the tutorial on
simpleisbetterthancomplex.com

This looks like a permissions issue.

I had similar issues with Google Buckets and sorted it out by reading the
django-storages methods for Google buckets in the source code and then
making sure all the settings were correct.

Anthony


On Mon, 16 Sep 2019, 22:01 Elias Coutinho,  wrote:

> It seems that one of the problems is occurring while downloading the files.
>
> See this error image:
>
> [image: image.png]
>
> If I go to Direct Link it usually downloads:
>
>
> https://gsm-gervas.s3.amazonaws.com/static/material/fonts/roboto/fonts/Roboto-Medium.woff2
>
> Em qua, 4 de set de 2019 às 23:35, sachinbg sachin <
> sachinbgsach...@gmail.com> escreveu:
>
>> Mention aws key value in setting
>>
>> On Thu, Sep 5, 2019, 2:06 AM mohammed habib  wrote:
>>
>>> Did you run python manage.py collectstatic
>>>
>>> Are you using static template tags to heed your html link href fields
>>>
>>> Sent from my iPhone
>>>
>>> On 4 Sep 2019, at 23:06, Elias Coutinho 
>>> wrote:
>>>
>>> Guys good afternoon,
>>>
>>> I managed to put my static folder in s3, the problem is that my effects
>>> already lost power. lol
>>>
>>> The staticfiles folder where the auxiliary applications are installed
>>> stop working, in my case it was django-material, select2 and others.
>>>
>>>
>>>
>>> If I comment this code
>>> <https://github.com/CoutinhoElias/gsm/blob/master/gsm/settings.py#L34-L51>
>>> that is in the settings of my project it works but does not send anything
>>> to Amazon s3.
>>>
>>>
>>>
>>> Any suggestion?
>>>
>>> --
>>> 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/70f224ee-f7a4-468f-9609-db2f8a0be161%40googlegroups.com
>>> <https://groups.google.com/d/msgid/django-users/70f224ee-f7a4-468f-9609-db2f8a0be161%40googlegroups.com?utm_medium=email_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/D42D2706-9340-4450-BC92-35AB0D2C47DB%40gmail.com
>>> <https://groups.google.com/d/msgid/django-users/D42D2706-9340-4450-BC92-35AB0D2C47DB%40gmail.com?utm_medium=email_source=footer>
>>> .
>>>
>> --
>> You received this message because you are subscribed to a topic in the
>> Google Groups "Django users" group.
>> To unsubscribe from this topic, visit
>> https://groups.google.com/d/topic/django-users/ainBAyaKDCc/unsubscribe.
>> To unsubscribe from this group and all its topics, 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/CAOs61rziOACLNEH8jhT95zOcJWX6uomoxSLiQAVuU6eb43rNkQ%40mail.gmail.com
>> <https://groups.google.com/d/msgid/django-users/CAOs61rziOACLNEH8jhT95zOcJWX6uomoxSLiQAVuU6eb43rNkQ%40mail.gmail.com?utm_medium=email_source=footer>
>> .
>>
>
>
> --
> Elias Coutinho.
> Aprender sobre alguns assuntos é fundamental.
> Aprender sobre Deus é indiscutivelmente o melhor conteúdo.
>
> --
> 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/CALgom8pTgON%2B%3D0CJi_Pg%3D9ay-wJ%2B%3Db4SmWGb36Y-GuLQxGx75A%40mail.gmail.com
> <https://groups.google.com/d/msgid/django-users/CALgom8pTgON%2B%3D0CJi_Pg%3D9ay-wJ%2B%3Db4SmWGb36Y-GuLQxGx75A%40mail.gmail.com?utm_medium=email_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/CAM9cxcZbHUJNbcAk%2BysXRGgdvRsiEZi-OkjcE-0LURH-G8EjZA%40mail.gmail.com.


Sticky keyboard creating multiple objects from a create form

2019-09-16 Thread Anthony Goslar
Hey guys

I have a user who has a problem with his keyboard. When he's captured an 
expense from my form, it seems like his key was sticking and it created 
~50x objects in the database. Is there a post validation function I can use 
to raise an error with this type of problem?  Obviously *fix the keyboard* 
is a good idea but I'd prefer the server to throw an error and not create 
50 or 100 records that I have to manually delete from the shell.

Gunicorn log file readout is below. I'm not certain what the "Ignoring 
EPIPE" is referring in this context as I'm not sure where the piping is but 
I do note that the id numbers for the log [11242] and [11243] are repeated 
which makes me suspect its catching some type of exception but also 
creating the object in the database. Hopefully the exception could stop the 
save() method, throw a 500 error and re-route to the previous page? I'm 
using a class based view which is also provided below.



[2019-09-16 13:09:36 +0200] [11242] [DEBUG] GET 
/finances/student/uuid-replace-1/finances/profile/
[2019-09-16 13:09:59 +0200] [11243] [DEBUG] GET 
/finances/uuid-replace-1/expense_student/uuid-replace-2/create/
[2019-09-16 13:10:09 +0200] [11243] [DEBUG] POST 
/finances/uuid-replace-1/expense_student/uuid-replace-2/create/
[2019-09-16 13:10:09 +0200] [11242] [DEBUG] POST 
/finances/uuid-replace-1/expense_student/uuid-replace-2/create/
[2019-09-16 13:10:09 +0200] [11243] [DEBUG] Ignoring EPIPE
[2019-09-16 13:10:09 +0200] [11242] [DEBUG] Ignoring EPIPE
[2019-09-16 13:10:09 +0200] [11243] [DEBUG] POST 
/finances/uuid-replace-1/expense_student/uuid-replace-2/create/
[2019-09-16 13:10:09 +0200] [11243] [DEBUG] Ignoring EPIPE
[2019-09-16 13:10:09 +0200] [11242] [DEBUG] POST 
/finances/uuid-replace-1/expense_student/uuid-replace-2/create/
[2019-09-16 13:10:09 +0200] [11242] [DEBUG] Ignoring EPIPE
[2019-09-16 13:10:09 +0200] [11243] [DEBUG] POST 
/finances/uuid-replace-1/expense_student/uuid-replace-2/create/
[2019-09-16 13:10:09 +0200] [11243] [DEBUG] Ignoring EPIPE
[2019-09-16 13:10:09 +0200] [11242] [DEBUG] POST 
/finances/uuid-replace-1/expense_student/uuid-replace-2/create/
[2019-09-16 13:10:09 +0200] [11243] [DEBUG] POST 
/finances/uuid-replace-1/expense_student/uuid-replace-2/create/
[2019-09-16 13:10:09 +0200] [11242] [DEBUG] Ignoring EPIPE
[2019-09-16 13:10:09 +0200] [11243] [DEBUG] Ignoring EPIPE
[2019-09-16 13:10:09 +0200] [11242] [DEBUG] POST 
/finances/uuid-replace-1/expense_student/uuid-replace-2/create/
[2019-09-16 13:10:09 +0200] [11242] [DEBUG] Ignoring EPIPE
[2019-09-16 13:10:09 +0200] [11243] [DEBUG] POST 
/finances/uuid-replace-1/expense_student/uuid-replace-2/create/
[2019-09-16 13:10:09 +0200] [11243] [DEBUG] Ignoring EPIPE
[2019-09-16 13:10:10 +0200] [11242] [DEBUG] POST 
/finances/uuid-replace-1/expense_student/uuid-replace-2/create/
[2019-09-16 13:10:10 +0200] [11242] [DEBUG] Ignoring EPIPE
[2019-09-16 13:10:10 +0200] [11243] [DEBUG] POST 
/finances/uuid-replace-1/expense_student/uuid-replace-2/create/
[2019-09-16 13:10:10 +0200] [11243] [DEBUG] Ignoring EPIPE
[2019-09-16 13:10:10 +0200] [11242] [DEBUG] POST 
/finances/uuid-replace-1/expense_student/uuid-replace-2/create/
[2019-09-16 13:10:10 +0200] [11242] [DEBUG] Ignoring EPIPE
[2019-09-16 13:10:10 +0200] [11243] [DEBUG] POST 
/finances/uuid-replace-1/expense_student/uuid-replace-2/create/
[2019-09-16 13:10:10 +0200] [11243] [DEBUG] Ignoring EPIPE
[2019-09-16 13:10:10 +0200] [11242] [DEBUG] POST 
/finances/uuid-replace-1/expense_student/uuid-replace-2/create/
[2019-09-16 13:10:10 +0200] [11242] [DEBUG] Ignoring EPIPE
[2019-09-16 13:10:10 +0200] [11243] [DEBUG] POST 
/finances/uuid-replace-1/expense_student/uuid-replace-2/create/
[2019-09-16 13:10:10 +0200] [11243] [DEBUG] Ignoring EPIPE
[2019-09-16 13:10:10 +0200] [11242] [DEBUG] POST 
/finances/uuid-replace-1/expense_student/uuid-replace-2/create/
[2019-09-16 13:10:10 +0200] [11242] [DEBUG] Ignoring EPIPE
[2019-09-16 13:10:10 +0200] [11243] [DEBUG] POST 
/finances/uuid-replace-1/expense_student/uuid-replace-2/create/
[2019-09-16 13:10:10 +0200] [11243] [DEBUG] Ignoring EPIPE
[2019-09-16 13:10:10 +0200] [11242] [DEBUG] POST 
/finances/uuid-replace-1/expense_student/uuid-replace-2/create/
[2019-09-16 13:10:10 +0200] [11242] [DEBUG] Ignoring EPIPE
[2019-09-16 13:10:10 +0200] [11243] [DEBUG] POST 
/finances/uuid-replace-1/expense_student/uuid-replace-2/create/
[2019-09-16 13:10:10 +0200] [11242] [DEBUG] POST 
/finances/uuid-replace-1/expense_student/uuid-replace-2/create/
[2019-09-16 13:10:10 +0200] [11243] [DEBUG] Ignoring EPIPE
[2019-09-16 13:10:10 +0200] [11242] [DEBUG] Ignoring EPIPE
[2019-09-16 13:10:11 +0200] [11243] [DEBUG] POST 
/finances/uuid-replace-1/expense_student/uuid-replace-2/create/
[2019-09-16 13:10:11 +0200] [11243] [DEBUG] Ignoring EPIPE
[2019-09-16 13:10:11 +0200] [11242] [DEBUG] POST 
/finances/uuid-replace-1/expense_student/uuid-replace-2/create/
[2019-09-16 13:10:11 +0200] [11242] [DEBUG] Ignoring EPIPE
[2019-09-16 13:10:11 

Re: Django how to print pstree in a webpage?

2019-02-26 Thread anthony . tedde . 85
Hi,

I suppose that it depends on the form and type of your pstree variable 
(tuple, list, dict...) and also if you put it as a context variable.
Could you send us the related view ?

Thx 

Le lundi 25 février 2019 13:18:19 UTC+1, Eswar Dileep a écrit :
>
> I have created a django project and now when I click on a button I have to 
> show the output of pstree in the webpage. How do I do that? 
>
> Your help 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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/bbb3f7c7-9802-4b18-bee7-ee19e7247bc6%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Tag block and endblock

2019-02-26 Thread anthony . tedde . 85
Hi Nexx

Simply put, and as explained by Motaz, *block *is a django special purpose 
function called *template tag *which help to organize hierarchically your 
templates.

Short better than long, see the following documentation:
https://docs.djangoproject.com/en/2.2/ref/templates/builtins/#block

'hope it helps.

Le lundi 25 février 2019 23:21:28 UTC+1, Nexx a écrit :
>
> Wht is the purpose of the tag 
> {% block myBlock %} 
> I red the document but i don't underatand.

-- 
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/dba490c9-6d6c-46a3-a7d4-974d016e1d7f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: 'URLPattern' Object is not a mapping

2019-02-26 Thread anthony . tedde . 85
Hello,

Don't you have another urls.py file inside the directory that have the same 
name as your project.
Probably something like that:

+ yourproject
 + yourproject
  - __init__.py
  - settings.py
  - 
  -* urls.py*
  - 

If yes, what does it contain ? 
Furthermore, could you send us the full trace ? 

Thx

Le mardi 26 février 2019 13:21:20 UTC+1, Tina Upadhyay a écrit :
>
> Getting this error and the urls.py of my model is as shown below:
>
>
> from django.conf.urls import url
> from new import views
> app_name = 'new'
>
>
> urlpatterns = [
> url(r'^export/csv/$', views.export_users_csv, name='export_users_csv'),
> # url(r'^$', views.upload, name='uplink'),
> url(r'^download/(.*)', views.download, name="download"),
> url(r'^download_attachment/(.*)/(.*)', views.download_as_attachment,
> name="download_attachment"),
> url(r'^exchange/(.*)', views.exchange, name="exchange"),
> url(r'^parse/(.*)', views.parse, name="parse"),
> url(r'^import/', views.import_data, name="import"),
> url(r'^import_sheet/', views.import_sheet, name="import_sheet"),
> url(r'^export/(.*)', views.export_data, name="export"),
> url(r'^handson_view/', views.handson_table, name="handson_view"),
>
> # handson table view
> url(r'^embedded_handson_view/',
> views.embed_handson_table, name="embed_handson_view"),
> url(r'^embedded_handson_view_single/',
> views.embed_handson_table_from_a_single_table,
> name="embed_handson_view"),
> # survey_result
> # url('^survey_result/',
> # views.survey_result, name='survey_result'),
>
> # testing purpose
> url(r'^import_using_isave/',
> views.import_data_using_isave_book_as),
> url(r'^import_sheet_using_isave/',
> views.import_sheet_using_isave_to_database),
> url(r'^import_without_bulk_save/',
> views.import_without_bulk_save, name="import_no_bulk_save")
> ]
>

-- 
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/1f653d1a-1d64-415a-bdae-60ff39f81c79%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: 'URLPattern' Object is not a mapping

2019-02-26 Thread anthony . tedde . 85
Hi,

Django's version is in the screenshot (2.1.4)

Le mardi 26 février 2019 13:38:24 UTC+1, ANIL UMARANE a écrit :
>
> which version django you have used
>
>
> On Tue, Feb 26, 2019 at 5:51 PM Tina Upadhyay  > wrote:
>
>> Getting this error and the urls.py of my model is as shown below:
>>
>>
>> from django.conf.urls import url
>> from new import views
>> app_name = 'new'
>>
>>
>> urlpatterns = [
>> url(r'^export/csv/$', views.export_users_csv, name='export_users_csv'),
>> # url(r'^$', views.upload, name='uplink'),
>> url(r'^download/(.*)', views.download, name="download"),
>> url(r'^download_attachment/(.*)/(.*)', views.download_as_attachment,
>> name="download_attachment"),
>> url(r'^exchange/(.*)', views.exchange, name="exchange"),
>> url(r'^parse/(.*)', views.parse, name="parse"),
>> url(r'^import/', views.import_data, name="import"),
>> url(r'^import_sheet/', views.import_sheet, name="import_sheet"),
>> url(r'^export/(.*)', views.export_data, name="export"),
>> url(r'^handson_view/', views.handson_table, name="handson_view"),
>>
>> # handson table view
>> url(r'^embedded_handson_view/',
>> views.embed_handson_table, name="embed_handson_view"),
>> url(r'^embedded_handson_view_single/',
>> views.embed_handson_table_from_a_single_table,
>> name="embed_handson_view"),
>> # survey_result
>> # url('^survey_result/',
>> # views.survey_result, name='survey_result'),
>>
>> # testing purpose
>> url(r'^import_using_isave/',
>> views.import_data_using_isave_book_as),
>> url(r'^import_sheet_using_isave/',
>> views.import_sheet_using_isave_to_database),
>> url(r'^import_without_bulk_save/',
>> views.import_without_bulk_save, name="import_no_bulk_save")
>> ]
>>
>> -- 
>> 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 https://groups.google.com/group/django-users.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/django-users/0f17d0d5-3823-4fd1-a90f-5f2f96bdbbc6%40googlegroups.com
>>  
>> 
>> .
>> 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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/7f348205-74fc-4673-b1ef-497ab05c19db%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Invalid pk \"1\" - object does not exist.

2019-02-26 Thread anthony . tedde . 85
Hello,

What if you use kind of the following as json data:
nb: The following model is a simplified version with only two fields (name 
and manager which is a FK to itself such as in yours).

[
  {
"model": "YourApp.YourModelName",
"pk": 1,
"fields": {
  "name": "toto",
  "manager": null
}
  },
  {
"model": "YourApp.YourModelName",
"pk": 2,
"fields": {
  "name": "tata",
  "manager": 1
}
  }
]

In that case you ensure that a manager object with pk equals to 1 already 
exists and therefore can be referred to .

'Hope it helps.

Le lundi 25 février 2019 14:36:05 UTC+1, optvi...@gmail.com a écrit :
>
> getting error
>
>
> {"manager":["Invalid pk \"1\" - object does not exist."]}
>
>
> here is my model class
>
> class Employee(models.Model):
>
> MANAGER = 'MGR'
> STANDARD = 'STD'
>
>
> EMPLOYEE_TYPES = (
>
> (MANAGER, 'manager'),
> (STANDARD, 'employee')
>
> )
>
>
> role = models.CharField(max_length=25, choices=EMPLOYEE_TYPES)
> name = models.CharField(max_length=100, null=True, blank=True)
> employee_id = models.CharField(max_length=100, null=True, blank=True)
> manager = models.ForeignKey('self', null=True, 
> related_name='employee',on_delete=models.CASCADE)
>
>
> and json data which i am using to save in table
>
> {
>   "role":"MGR",
>   "name":"John",
>   "employee_id" :"IN",
>   "manager":1
>   
>   }
>
>
>
>
>

-- 
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/bcac16dc-e8d3-4044-ab69-eac06cbdc586%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: How to save multiple model form in one template?

2018-09-07 Thread Anthony Petrillo
Here is an example. I've cut out some of the code, but I this will give you 
the general idea. Note, I move the data from the Day form in to the Classes 
table. But you could just save both sets of data to their respective tables 
if desired.

in views.py

class ClassesAddView(LoginRequiredMixin,View):
classesFormClass = ClassesRegForm
daysFormClass = DaysForm
template_name = 'qing/classes.html'

def get(self,request,role='NoRole'):
classesForm = self.classesFormClass()
context['form'] = classesForm
daysForm = self.daysFormClass()
context['daysform'] = daysForm
return render(request,self.template_name, context)

def post(self, request, *args, **kwargs):
classesForm = self.classesFormClass(request.POST)
daysForm = self.daysFormClass(request.POST)
if classesForm.is_valid() and daysForm.is_valid():
days = str(request.POST.getlist('days'))
reference = request.POST['reference']
classes = classesForm.save()
classes = Classes.objects.get(reference=reference)
classes.days = days
classes.save()
else:
classesForm = self.classesFormClass(request.POST)
context['form'] = classesForm
daysForm = self.daysFormClass(request.POST)
context['daysform'] = daysForm
context['datavalid'] = False
return render(request, self.template_name, context)
return HttpResponseRedirect(reverse('classesadd',args=(role,)))

in forms.py

class ClassesForm(ModelForm):
class Meta:
model = Classes
fields = ['reference','course','teachers',etc...]

class DaysForm(forms.Form):
OPTIONS = (
("Sunday", "Sunday"),
("Monday", "Monday"),
("Tuesday", "Tuesday"),
("Wednesday", "Wednesday"),
("Thursday", "Thursday"),
("Friday", "Friday"),
("Saturday", "Saturday"),
)
days = forms.MultipleChoiceField(widget=forms.CheckboxSelectMultiple,
 choices=OPTIONS)


On Friday, September 7, 2018 at 9:47:51 AM UTC-4, Akshay Gaur wrote:
>
> I think it would be easier to write out a custom form (without using your 
> model classes, just the fields that you will need for all the models) and 
> then in the save method for that form's view, you create model objects 
> using the fields in the POST request.
>
> On Friday, September 7, 2018 at 5:43:11 AM UTC-5, Django Lover wrote:
>>
>>
>> I have one page, which I have to show three model form and three 
>> different submit button for each.
>>
>> My question is how I can save these three form individually?
>>
>> FOLLOWING IS CODE:-
>>
>> **form.py**
>>
>>
>> class UserTaxesMultiForm(MultiModelForm):
>>form_classes = {
>>'user_tax_form': MyForm,
>>'user_discount_form': DiscountForm,
>>'user_shiping_form': ShipmentForm,
>>}
>>
>> *Note- myForm, DiscountForm, ShipmentForm are model forms. like 
>> following-*
>>
>> class MyForm(forms.ModelForm):
>>prefix = 'tax'
>>class Meta:
>>model = StUserTaxDetails
>>fields = ('tax_name', 'tax_rate')
>>  
>>tax_name = forms.CharField(max_length=10,
>> widget=forms.TextInput(),
>> required=True, label="tax name")
>>
>> tax_rate = forms.FloatField(required=True,  label="tax rate")
>>
>>
>> error_messages  = {
>>'required': _('fields are required.'),
>>}
>>
>> def clean_title(self):
>>return self.cleaned_data['tax_name']
>>
>> def clean(self):
>>tax_name = self.cleaned_data.get('tax_name')
>>tax_rate = self.cleaned_data.get('tax_rate')
>> 
>> if not tax_name and not tax_rate:
>>raise forms.ValidationError(
>>self.error_messages['required'],
>>code='required',
>>)
>>return self.cleaned_data
>>
>> **view.py**
>> class AddTaxView(LoginRequiredMixin, CreateView):
>>template_name = 'invoices/add_tax.html'
>>form_class = UserTaxesMultiForm
>>success_url = '/add/tax/'
>>
>>*{WHAT IS THE CODE HERE FOR THE POST METHOD TO SAVE DATA ACORDING 
>> DIFFRENT FORM SUBMIT} *
>> 
>>
>>
>>
>> **HTML**
>>
>>
>>
>> 
>> {% form.user_tax_form%}
>>
>> 
>> 
>>
>> 
>> {% form.user_discount_form%}
>>
>> 
>> 
>>
>> 
>> {% form.user_shiping_form%}
>>
>> 
>> 
>>
>> PLEASE 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 

Re: DEBUG_TOOLBAR

2018-07-16 Thread robert anthony perez araujo
listo solo coloque en el settings de mi proyecto la siguiente configuración.

DEBUG_TOOLBAR_CONFIG = {
'JQUERY_URL': '',
}


El 16 de julio de 2018, 9:36, robert anthony perez araujo <
io.perez.rob...@gmail.com> escribió:

> Buenas amigos, alguien me puede ayudar con algo de DEBUG_TOOLBAR necesito
> que no utilice el Jquery que trae por defecto...
>
> Espero me puedan ayudar con eso, he leido sobre una configuracion pero
> donde debo hacerla?
>
>

-- 
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/CAKqgjisw9gMDQHwwgpmz%2BKXrGrCVtQW_ZJpi7yMJiH7HthWTfQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


DEBUG_TOOLBAR

2018-07-16 Thread robert anthony perez araujo
Buenas amigos, alguien me puede ayudar con algo de DEBUG_TOOLBAR necesito
que no utilice el Jquery que trae por defecto...

Espero me puedan ayudar con eso, he leido sobre una configuracion pero
donde debo hacerla?

-- 
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/CAKqgjiuN4To27vGDZO1tZT%2Ba21ANm_%3D_DzAZ7siHfr44K1t%2Bnw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: App structure : "One file - One object" - Is there a better way ?

2018-07-14 Thread 'Anthony Flury' via Django users

On 14/07/18 15:59, Mickael Barbo wrote:

Hi Anthony 


Michael



Thanks for sharing your experience.

"1 file one object doesn't mean what you think it means."

I hope you get the meaning I described 


I understand what you mean - I just don't agree with your analysis of 
one file one object means in practice.


"it normally means (for instance) defining one class (and ALL of it's 
methods' in one file) - not importing methods into class definitions - 
I have never seen anyone suggest that."


A method is a function ? a function an object ? right ?
Strictly speaking a function is an object - but that is a python 
implementation detail. Remember that one object one file originated well 
before python was created. It came from the original OOP days with 
languages such as C++ - where methods are not objects in the OOP sense - 
the normal accepted meaning of 'One file - One Object' is (in terms of 
Python)  'One file - one class'.




My purpose is that *I prefer working on several "small" files 
containing 1 small function/object* and _*NOT*_ *dealing with a "big" 
file* containing all methods of class (for example). It's 
straightforward to find what I look for.


Mixins and inheritance don't really help here - unless you are reusing 
the same method in multiple classes - in which case you might have a 
mixin, or an inheritance situation.

Agree 

If you have one or more methods that provide a useful extra behavior 
to one or many classes (say that you have a set of methods that 
provide extra formatting on some fields, then that would be a mixin

Ok

If you can identify one of your classes being an extension to another 
in some way - so for instance you have a model for Customers, and you 
have a model for your Gold Customers then you might well have an 
inheritance situation - anywhere you can say Model A is a type of 
Model B that is inheritance: Gold Customers are a type of Customer.

Ok

So, for you, *if you would reduce the size of files you are working 
on, how would you do that ?*
If you implement your classes and all of it's methods you can't reduce 
the file size - you can though work to reduce the amount of code on 
screen. Typically you will work on one method at a time, and most good 
code editors have what they call code-folding; code folding allows you 
to collapse individual methods to a few lines (the function signature 
and the doc string), and many good editors will also allow you to fold 
loops, if/else blocks, try/except blocks, and with blocks such that the 
amount of code on screen are reduced. Most good editors will also 
provide a 'contents' type view of your code - so that you can see a list 
of the functions/methods in your file, and jump to them - without 
needing to scroll through your code.


I do understand it doesn't solve your immediate problem as you see it, 
but I think with good quality tools your 'problem' wont actually be a 
problem.


Personally I use PyCharm, which is a very good quality code editor, and 
also entirely free.




For example, let's say you have a Customer class with 15 methods and 
the file is about 1000 lines of code.

How to split this file in smaller files with 1 method per file ?


I wouldn't split it - at all - if you split the methods into files as 
you suggest- you are loosing at least some of the advantages of OOP - it 
is a considerable benefit to have all your code in one place - to be 
able check-in and revert your changes to a single class.


If you do really wish to go down the one function/method one file route, 
then the scheme that you already use is probably the best one(in terms 
of ensuring your code works as you expect); If you do use that strategy 
I would stron





Thanks for your help Anthony, hoping to be as clear as possible.
Regards


2018-07-14 10:56 GMT+02:00 Anthony Flury <mailto:anthony.fl...@btinternet.com>>:


On 13/07/18 12:44, Mickael Barbo wrote:

Hi !
*
I like working with " 1 file - 1 object " (Object could be
class, function...).*
It simplify visibility, debug etc... and it's easy for me to
*don't pollute my brain* :-)


1 file one object doesn't mean what you think it means.

it normally means (for instance) defining one class (and ALL of
it's methods' in one file) - not importing methods into class
definitions - I have never seen anyone suggest that.

Mixins and inheritance don't really help here - unless you are
reusing the same method in multiple classes - in which case you
might have a mixin, or an inheritance situation.

If you have one or more methods that provide a useful extra
behavior to one or many classes (say that you have a set of
methods that provide extra formatting on some fields, then that
would be a mixin

If you can identify one of your classes being an extension to
another in some way - so for instance you have a model for

Re: App structure : "One file - One object" - Is there a better way ?

2018-07-14 Thread 'Anthony Flury' via Django users

On 14/07/18 15:59, Mickael Barbo wrote:

Hi Anthony 


Michael



Thanks for sharing your experience.

"1 file one object doesn't mean what you think it means."

I hope you get the meaning I described 


I understand what you mean - I just don't agree with your analysis of 
one file one object means in practice.


"it normally means (for instance) defining one class (and ALL of it's 
methods' in one file) - not importing methods into class definitions - 
I have never seen anyone suggest that."


A method is a function ? a function an object ? right ?
Strictly speaking a function is an object - but that is a python 
implementation detail. Remember that one object one file originated well 
before python was created. It came from the original OOP days with 
languages such as C++ - where methods are not objects in the OOP sense - 
the normal accepted meaning of 'One file - One Object' is (in terms of 
Python)  'One file - one class'.




My purpose is that *I prefer working on several "small" files 
containing 1 small function/object* and _*NOT*_ *dealing with a "big" 
file* containing all methods of class (for example). It's 
straightforward to find what I look for.


Mixins and inheritance don't really help here - unless you are reusing 
the same method in multiple classes - in which case you might have a 
mixin, or an inheritance situation.

Agree 

If you have one or more methods that provide a useful extra behavior 
to one or many classes (say that you have a set of methods that 
provide extra formatting on some fields, then that would be a mixin

Ok

If you can identify one of your classes being an extension to another 
in some way - so for instance you have a model for Customers, and you 
have a model for your Gold Customers then you might well have an 
inheritance situation - anywhere you can say Model A is a type of 
Model B that is inheritance: Gold Customers are a type of Customer.

Ok

So, for you, *if you would reduce the size of files you are working 
on, how would you do that ?*
If you implement your classes and all of it's methods you can't reduce 
the file size - you can though work to reduce the amount of code on 
screen. Typically you will work on one method at a time, and most good 
code editors have what they call code-folding; code folding allows you 
to collapse individual methods to a few lines (the function signature 
and the doc string), and many good editors will also allow you to fold 
loops, if/else blocks, try/except blocks, and with blocks such that the 
amount of code on screen are reduced. Most good editors will also 
provide a 'contents' type view of your code - so that you can see a list 
of the functions/methods in your file, and jump to them - without 
needing to scroll through your code.


I do understand it doesn't solve your immediate problem as you see it, 
but I think with good quality tools your 'problem' wont actually be a 
problem.


Personally I use PyCharm, which is a very good quality code editor, and 
also entirely free.




For example, let's say you have a Customer class with 15 methods and 
the file is about 1000 lines of code.

How to split this file in smaller files with 1 method per file ?


I wouldn't split it - at all - if you split the methods into files as 
you suggest- you are loosing at least some of the advantages of OOP - it 
is a considerable benefit to have all your code in one place - to be 
able check-in and revert your changes to a single class.


If you do really wish to go down the one function/method one file route, 
then the scheme that you already use is probably the best one(in terms 
of ensuring your code works as you expect); If you do use that strategy 
I would strongly suggest that you keep your dunder_init, and any factory 
methods with your class definition - these are the most important to be 
honest, since they establish the basis of all of your functionality.





Thanks for your help Anthony, hoping to be as clear as possible.
Regards


2018-07-14 10:56 GMT+02:00 Anthony Flury <mailto:anthony.fl...@btinternet.com>>:


On 13/07/18 12:44, Mickael Barbo wrote:

Hi !
*
I like working with " 1 file - 1 object " (Object could be
class, function...).*
It simplify visibility, debug etc... and it's easy for me to
*don't pollute my brain* :-)


1 file one object doesn't mean what you think it means.

it normally means (for instance) defining one class (and ALL of
it's methods' in one file) - not importing methods into class
definitions - I have never seen anyone suggest that.

Mixins and inheritance don't really help here - unless you are
reusing the same method in multiple classes - in which case you
might have a mixin, or an inheritance situation.

If you have one or more methods that provide a useful extra
behavior to one or many classes (say that you have a set of
methods that p

Re: Beginner

2018-07-14 Thread 'Anthony Flury' via Django users

On 12/07/18 10:28, Harsh Rawat wrote:
So basically I need to write the documentation regarding what should 
be the apt name for the feature and what packages come installed with 
django initially .


I think the bug report suggests discussing possible options regarding 
new names and packages collections with the python developers.


Documentation of the existing feature sets would be useful too.




On Thu, Jul 12, 2018, 11:41 AM Harsh Rawat <mailto:harsh.rawa...@gmail.com>> wrote:


Thanks a lot .

On Thu, Jul 12, 2018, 3:11 AM 'Anthony Flury' via Django users
mailto:django-users@googlegroups.com>> wrote:

On 10/07/18 14:06, Harsh Rawat wrote:
> Identifying a useful name means ?
>
Let's say you have identified a great group of packages which
you can
install and provides Django friendly Shopping cart.

It would be better for that group of packages to be installed by :

     pip install Django['shopping-cart']

rather than say :

     pip install Django[anthony]


    while 'anthony' is a perfectly fine name (my parents
definitely liked
it), it isn't particularly useful in this case; if you saw
that in an
installation script you would wonder why Django was being
installed
using that option, but 'shopping-cart' is at least helpful in
terms for
describing the functionality you might get.



> --
> 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
<mailto:django-users%2bunsubscr...@googlegroups.com>
> <mailto:django-users+unsubscr...@googlegroups.com
<mailto:django-users%2bunsubscr...@googlegroups.com>>.
> To post to this group, send email to
django-users@googlegroups.com
<mailto:django-users@googlegroups.com>
> <mailto:django-users@googlegroups.com
<mailto: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/785cb34c-4099-4213-9aef-2c81a5a21ef7%40googlegroups.com

>

<https://groups.google.com/d/msgid/django-users/785cb34c-4099-4213-9aef-2c81a5a21ef7%40googlegroups.com?utm_medium=email_source=footer>.
    > For more options, visit https://groups.google.com/d/optout.


-- 
-- 
Anthony Flury

email : *anthony.fl...@btinternet.com
<mailto:anthony.fl...@btinternet.com>*
Twitter : *@TonyFlury <https://twitter.com/TonyFlury/>*

-- 
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
<mailto:django-users%2bunsubscr...@googlegroups.com>.
To post to this group, send email to
django-users@googlegroups.com
<mailto: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/11a73dce-a6ad-e16e-eec4-8551f088ee54%40btinternet.com.
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 
<mailto:django-users+unsubscr...@googlegroups.com>.
To post to this group, send email to django-users@googlegroups.com 
<mailto: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/CALd6sVMQr7M9_UuZM28c9McObDiSUv51hugk816KncHxvt6Q_A%40mail.gmail.com 
<https://groups.google.com/d/msgid/django-users/CALd6sVMQr7M9_UuZM28c9McObDiSUv51hugk816KncHxvt6Q_A%40mail.gmail.com?utm_medium=email_source=footer>.

For more options, visit https://groups.google.com/d/optout.



--
--
Anthony Flury
email : *anthony.fl...@btinternet.com*
Twitter : *@TonyFlury <https://twitter.com/TonyFlury/>*

--
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...@googlegro

Re: How start django server automatically using pytest-django

2018-07-11 Thread 'Anthony Flury' via Django users

On 07/07/18 13:16, prakash sharma wrote:

RE:'do you want to test on development server'
NO, Drone is running the test cases.I don't want to run the runserver 
command.


But why do you need the server running - the Django Test client is able 
to test views and responses without having to have the server running.


If running the Server gives an error, then so will the Test client.

There is no benefit in attempting to run the server within your test cases.




On Saturday, July 7, 2018 at 5:12:51 PM UTC+5:30, Kamal Sharma wrote:

do you want to test on development server??


On Sat, Jul 7, 2018 at 1:17 PM, prakash sharma
> wrote:

Hi there,
I am facing issue that my django server is not started .
I want to run the pytest-django  for test cases without manual
runserver.

Here is my test file:

|importrequests deftest_demo():response
=requests.get('http://0.0.0.0:8000/
<http://0.0.0.0:8000/>'+"demo")assert(response.status_code ==200)|

|
|
|
|
|Here is the cmd:|
|
|
pytest .tests/test_demo.py --ds=my_project.settings
|


|
|
|
|I am getting :|


  Failed to establish a new connection: [Errno 111] Connection
  refused



Is there is  a way that my django server will start
automatically with pytest.
-- 
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
https://groups.google.com/group/django-users
<https://groups.google.com/group/django-users>.
To view this discussion on the web visit

https://groups.google.com/d/msgid/django-users/2c166097-9635-4dd0-828c-5b1f3006cf1e%40googlegroups.com

<https://groups.google.com/d/msgid/django-users/2c166097-9635-4dd0-828c-5b1f3006cf1e%40googlegroups.com?utm_medium=email_source=footer>.
For more options, visit https://groups.google.com/d/optout
<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 
<mailto:django-users+unsubscr...@googlegroups.com>.
To post to this group, send email to django-users@googlegroups.com 
<mailto: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/d18ca5b1-6426-405b-8348-91c13ace1bb9%40googlegroups.com 
<https://groups.google.com/d/msgid/django-users/d18ca5b1-6426-405b-8348-91c13ace1bb9%40googlegroups.com?utm_medium=email_source=footer>.

For more options, visit https://groups.google.com/d/optout.



--
--
Anthony Flury
email : *anthony.fl...@btinternet.com*
Twitter : *@TonyFlury <https://twitter.com/TonyFlury/>*

--
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/26733bab-8e19-49e3-8cba-54f1fb4aca80%40btinternet.com.
For more options, visit https://groups.google.com/d/optout.


Re: Beginner

2018-07-11 Thread 'Anthony Flury' via Django users

On 10/07/18 14:06, Harsh Rawat wrote:

Identifying a useful name means ?

Let's say you have identified a great group of packages which you can 
install and provides Django friendly Shopping cart.


It would be better for that group of packages to be installed by :

        pip install Django['shopping-cart']

rather than say :

        pip install Django[anthony]


while 'anthony' is a perfectly fine name (my parents definitely liked 
it), it isn't particularly useful in this case; if you saw that in an 
installation script you would wonder why Django was being installed 
using that option, but 'shopping-cart' is at least helpful in terms for 
describing the functionality you might get.





--
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 
<mailto:django-users+unsubscr...@googlegroups.com>.
To post to this group, send email to django-users@googlegroups.com 
<mailto: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/785cb34c-4099-4213-9aef-2c81a5a21ef7%40googlegroups.com 
<https://groups.google.com/d/msgid/django-users/785cb34c-4099-4213-9aef-2c81a5a21ef7%40googlegroups.com?utm_medium=email_source=footer>.

For more options, visit https://groups.google.com/d/optout.



--
--
Anthony Flury
email : *anthony.fl...@btinternet.com*
Twitter : *@TonyFlury <https://twitter.com/TonyFlury/>*

--
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/11a73dce-a6ad-e16e-eec4-8551f088ee54%40btinternet.com.
For more options, visit https://groups.google.com/d/optout.


Re: Beginner

2018-07-11 Thread 'Anthony Flury' via Django users

On 10/07/18 14:06, Harsh Rawat wrote:

Identifying a useful name means ?

Well - say you have a set of packages which is useful as a Django 
friendly shopping cart.


Would it be better to type :

            pip install Django[shopping-cart]

or
            pip install Django[frooble]

Clearly '/frooble/' is an entirely valid name - but it is isn't useful, 
as it doesn't tell the user anything about what they might be installing.




--
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 
<mailto:django-users+unsubscr...@googlegroups.com>.
To post to this group, send email to django-users@googlegroups.com 
<mailto: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/785cb34c-4099-4213-9aef-2c81a5a21ef7%40googlegroups.com 
<https://groups.google.com/d/msgid/django-users/785cb34c-4099-4213-9aef-2c81a5a21ef7%40googlegroups.com?utm_medium=email_source=footer>.

For more options, visit https://groups.google.com/d/optout.



--
--
Anthony Flury
email : *anthony.fl...@btinternet.com*
Twitter : *@TonyFlury <https://twitter.com/TonyFlury/>*

--
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/e6783037-8241-6917-b05f-d84c2b33fbf9%40btinternet.com.
For more options, visit https://groups.google.com/d/optout.


Re: help

2018-07-09 Thread 'Anthony Flury' via Django users
ps://groups.google.com/d/optout
<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
<mailto:django-users+unsubscr...@googlegroups.com>.
To post to this group, send email to
django-users@googlegroups.com
<mailto:django-users@googlegroups.com>.
Visit this group at
https://groups.google.com/group/django-users
<https://groups.google.com/group/django-users>.
To view this discussion on the web visit

https://groups.google.com/d/msgid/django-users/C04E4BEF-E8FF-4EF0-936A-69F04E1DD061%40gmail.com

<https://groups.google.com/d/msgid/django-users/C04E4BEF-E8FF-4EF0-936A-69F04E1DD061%40gmail.com?utm_medium=email_source=footer>.
For more options, visit https://groups.google.com/d/optout
<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
<mailto:django-users+unsubscr...@googlegroups.com>.
To post to this group, send email to
django-users@googlegroups.com <mailto:django-users@googlegroups.com>.
Visit this group at https://groups.google.com/group/django-users
<https://groups.google.com/group/django-users>.
To view this discussion on the web visit

https://groups.google.com/d/msgid/django-users/CAPkbFbbQ2ufECP6emgND2LD_fKKk%2BNHuF_KoyWP7c6EN-z3QZw%40mail.gmail.com

<https://groups.google.com/d/msgid/django-users/CAPkbFbbQ2ufECP6emgND2LD_fKKk%2BNHuF_KoyWP7c6EN-z3QZw%40mail.gmail.com?utm_medium=email_source=footer>.


For more options, visit https://groups.google.com/d/optout
<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
<mailto:django-users+unsubscr...@googlegroups.com>.
To post to this group, send email to django-users@googlegroups.com
<mailto:django-users@googlegroups.com>.
Visit this group at https://groups.google.com/group/django-users
<https://groups.google.com/group/django-users>.
To view this discussion on the web visit

https://groups.google.com/d/msgid/django-users/34C036D9-E62B-4441-919B-D9CC2F53F784%40gmail.com

<https://groups.google.com/d/msgid/django-users/34C036D9-E62B-4441-919B-D9CC2F53F784%40gmail.com?utm_medium=email_source=footer>.


For more options, visit https://groups.google.com/d/optout
<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 
<mailto:django-users+unsubscr...@googlegroups.com>.
To post to this group, send email to django-users@googlegroups.com 
<mailto: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/CAPkbFbbjYhT0joH%2BFxQNuxzaggU9m%3DNN7meTyvC2t7dbMrVLGA%40mail.gmail.com 
<https://groups.google.com/d/msgid/django-users/CAPkbFbbjYhT0joH%2BFxQNuxzaggU9m%3DNN7meTyvC2t7dbMrVLGA%40mail.gmail.com?utm_medium=email_source=footer>.

For more options, visit https://groups.google.com/d/optout.



--
--
Anthony Flury
email : *anthony.fl...@btinternet.com*
Twitter : *@TonyFlury <https://twitter.com/TonyFlury/>*

--
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/9b35877e-2be5-189c-782f-cad17985bf89%40btinternet.com.
For more options, visit https://groups.google.com/d/optout.


Re: help

2018-07-09 Thread 'Anthony Flury' via Django users

On 06/07/18 13:43, Umar Kambala wrote:
  File 
"C:\Users\Admin\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\core\management\__init__.py", 
line 347, in execute


YOU need to add an on_delete argument to every ForeignKey definition - 
such as the one in line 13.


Learning to read tracebacks really does help - the error you posted 
contains the information you need :


  File "C:\Users\Admin\Desktop\Django Web\myproject\boards\models.py", 
line 13, in Topic

    board = models.ForeignKey(Board, related_name='topics')
TypeError: __init__() missing 1 required positional argument: 'on_delete'

Quite often the very last few lines of the error message will tell you 
exactly what the error is and which line - in this case :


The error is on line 13 of boards/models.py
The error is in the Topic class
the error is on the line that is : "board = models.ForeignKey(Board, 
related_name='topics')"
the actual error is that the line is missing the on_delete argument - it 
really is that simple.

--
--
Anthony Flury
email : *anthony.fl...@btinternet.com*
Twitter : *@TonyFlury <https://twitter.com/TonyFlury/>*

--
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/bd827f41-6db2-a73a-c959-c322d5471901%40btinternet.com.
For more options, visit https://groups.google.com/d/optout.


Re: Beginner

2018-06-28 Thread 'Anthony Flury' via Django users

On 27/06/18 21:23, Harsh Rawat wrote:
I have learnt Django a little bit. I need help regarding the ticket 
https://code.djangoproject.com/ticket/28905 .What should I learn in 
Django to be able to contribute via this ticket.


It looks like this doesn't actually require any knowledge of Django 
particularly;  this feature is actually a feature of pip and Python 
setuptools.


What you need to do is identify a set of packages that are often 
installed with Django - and then identify a useful name for them.


As commented on the fault, you should probably agree any new set of 
packages on the developer mailing list, and also make sure that you 
clearly document which package sets are now supported.



--
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 
<mailto:django-users+unsubscr...@googlegroups.com>.
To post to this group, send email to django-users@googlegroups.com 
<mailto: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/1d490e7d-424f-421f-9278-2b326d95b397%40googlegroups.com 
<https://groups.google.com/d/msgid/django-users/1d490e7d-424f-421f-9278-2b326d95b397%40googlegroups.com?utm_medium=email_source=footer>.

For more options, visit https://groups.google.com/d/optout.



--
--
Anthony Flury
email : *anthony.fl...@btinternet.com*
Twitter : *@TonyFlury <https://twitter.com/TonyFlury/>*

--
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/bc94a651-1c5c-419d-8202-458ba9eb50b2%40btinternet.com.
For more options, visit https://groups.google.com/d/optout.


Re: simple django application since im a beginner I'm unable to doit..

2018-06-27 Thread 'Anthony Flury' via Django users

On 25/06/18 15:57, mr.sathee...@gmail.com wrote:
I want to know the IP is malicious or not by simple web application 
since I'm a beginner I unable to do it. help me
Define malicious ? You would need to look  at how it is normally defined 
(normally companies use blacklists of IP address ranges - mainly based 
on those ranges being used in spam attacks) - those blacklists will be 
updated often.


Without a blacklist of some form you can't just look at an IP address 
and decide that it is 'malicious' - when you register for an IP-range 
they don't ask if you plan to use the range for hacking.



--
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 
<mailto:django-users+unsubscr...@googlegroups.com>.
To post to this group, send email to django-users@googlegroups.com 
<mailto: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/40926567-952b-449b-85b2-e7e91ab86b82%40googlegroups.com 
<https://groups.google.com/d/msgid/django-users/40926567-952b-449b-85b2-e7e91ab86b82%40googlegroups.com?utm_medium=email_source=footer>.

For more options, visit https://groups.google.com/d/optout.



--
--
Anthony Flury
email : *anthony.fl...@btinternet.com*
Twitter : *@TonyFlury <https://twitter.com/TonyFlury/>*

--
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/6cdecd4b-1efc-1405-9fc6-0a9f33797ee2%40btinternet.com.
For more options, visit https://groups.google.com/d/optout.


Re: how to pass the ID of a slected item in a list to ORM

2018-06-15 Thread Anthony Anonde
Sorry your question is a bit complicated, you have a form that contains a list 
of names and id, what data types are they contain in? Understand how the list 
box is structured will help to give you a better ans

-- 
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/b4131227-2319-4cb7-973c-40e8ae41b46f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django Admin verification

2018-06-15 Thread Anthony Anonde
I will suggest to have a field with active set to false, so when the use signs 
in you cleaned the data send a notice to the admin, mean while the user info is 
save to the database but user account is not active because the field active is 
set to false. When the admin sees the user data he can choose to activate the 
user.
Hope that make sense 

-- 
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/a8efe997-b84f-448d-a595-3496de1e6f7a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: saving django session data for anonymous user

2018-06-15 Thread 'Anthony Flury' via Django users

How are you authenticating them ?

Assuming you call :

        authenicate( username, password)

then before that call - store the sesssion key

after that call - identify the new session key

with the old and new session keys - now update the database - so that 
the cart gets associated with the new session key.



On 13/06/18 13:40, Siddharth Srivastava wrote:
Thanks  Anthony for your prompt reply. current implementation is that 
i am using django orm query to pull the user cart details and cart 
id(session key) is the key so when user switch from anonymous

user to actual user then i loses the data came from the query.

so when user gets authenticated then it create new session id then 
previous session data we lose. I am not finding much help in google:(.


Thanks,

Siddharth



On Tue, Jun 12, 2018 at 8:37 AM, Anthony Flury 
mailto:anthony.fl...@btinternet.com>> 
wrote:


The only way I can think of is when your user goes to log in -
check if their session id is already recorded.

When they login - I assume that they get an new Session Id - and
remap the data from their old session id to their new session Id.

Would that work ?

On 12/06/18 11:01, Siddharth Srivastava wrote:

Hi ,

i was writing small ecommerce application in django framework.
so i was trying to implement add to cart functionality like
that if user is anonymous user then selected products should
be mapped to it's session id which is act. cart id in models.
so the scenario is that whenever anonymous user check out and
mapped data against that session id is purged. Is there any
mechanism to save anonymous user session data even after user
logs in. kindly provide easy possible solution as i am bit new
to django:)

Thanks,

Siddharth


-- 
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
<mailto:django-users%2bunsubscr...@googlegroups.com>
<mailto:django-users+unsubscr...@googlegroups.com
<mailto:django-users%2bunsubscr...@googlegroups.com>>.
To post to this group, send email to
django-users@googlegroups.com
<mailto:django-users@googlegroups.com>
<mailto:django-users@googlegroups.com
<mailto:django-users@googlegroups.com>>.
Visit this group at
https://groups.google.com/group/django-users
<https://groups.google.com/group/django-users>.
To view this discussion on the web visit

https://groups.google.com/d/msgid/django-users/d17bbc16-4c0b-4d06-bfa5-af814a20cbc6%40googlegroups.com

<https://groups.google.com/d/msgid/django-users/d17bbc16-4c0b-4d06-bfa5-af814a20cbc6%40googlegroups.com>

<https://groups.google.com/d/msgid/django-users/d17bbc16-4c0b-4d06-bfa5-af814a20cbc6%40googlegroups.com?utm_medium=email_source=footer

<https://groups.google.com/d/msgid/django-users/d17bbc16-4c0b-4d06-bfa5-af814a20cbc6%40googlegroups.com?utm_medium=email_source=footer>>.
For more options, visit https://groups.google.com/d/optout
<https://groups.google.com/d/optout>.



-- 
-- 
Anthony Flury

email : *anthony.fl...@btinternet.com
<mailto:anthony.fl...@btinternet.com>*
Twitter : *@TonyFlury <https://twitter.com/TonyFlury/
<https://twitter.com/TonyFlury/>>*




--
--
Anthony Flury
email : *anthony.fl...@btinternet.com*
Twitter : *@TonyFlury <https://twitter.com/TonyFlury/>*

--
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/e341aaeb-62b8-9071-181c-32305a9f08cf%40btinternet.com.
For more options, visit https://groups.google.com/d/optout.


Re: saving django session data for anonymous user

2018-06-12 Thread 'Anthony Flury' via Django users
The only way I can think of is when your user goes to log in - check if 
their session id is already recorded.


When they login - I assume that they get an new Session Id - and remap 
the data from their old session id to their new session Id.


Would that work ?

On 12/06/18 11:01, Siddharth Srivastava wrote:

Hi ,

i was writing small ecommerce application in django framework. so i 
was trying to implement add to cart functionality like that if user is 
anonymous user then selected products should be mapped to it's session 
id which is act. cart id in models. so the scenario is that whenever 
anonymous user check out and mapped data against that session id is 
purged. Is there any mechanism to save anonymous user session data 
even after user logs in. kindly provide easy possible solution as i am 
bit new to django:)


Thanks,

Siddharth


--
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 
<mailto:django-users+unsubscr...@googlegroups.com>.
To post to this group, send email to django-users@googlegroups.com 
<mailto: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/d17bbc16-4c0b-4d06-bfa5-af814a20cbc6%40googlegroups.com 
<https://groups.google.com/d/msgid/django-users/d17bbc16-4c0b-4d06-bfa5-af814a20cbc6%40googlegroups.com?utm_medium=email_source=footer>.

For more options, visit https://groups.google.com/d/optout.



--
--
Anthony Flury
email : *anthony.fl...@btinternet.com*
Twitter : *@TonyFlury <https://twitter.com/TonyFlury/>*

--
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/afd880e5-38ee-e2db-6491-b53e9c69d40f%40btinternet.com.
For more options, visit https://groups.google.com/d/optout.


Re: Reusable Code like Helper OR Component.

2018-06-12 Thread 'Anthony Flury' via Django users
Reusable components are exactly what separate apps are for; Give your 
resuable code a nice API - whether it adds new field types,

new models, new templates etc, and then put that all in an app.

Writing an entirely reusable app takes a lot of skill and thought in my 
experience; extra fields, model mixins, new tags and even new 
middle-ware components are relatively straightforward; providing 
reusable templates that another project can extend easily can be 
challenging.


The key in my experience is to document it all - make sure you write 
down exactly how you re-use your components.


On 11/06/18 15:23, Pravin Yadav wrote:


Hello,

I have created the websites in Python 3.6 and Django 2.0.6. I have 
created separate the header.html, footer.html, index.html & 
base.html.  I want to create the reusable code like Helper OR 
Component. I have no idea about this how to create the helper or 
component. if any one know abut this kindly let me know.



Thanks,

Pravin Yadav

--
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 
<mailto:django-users+unsubscr...@googlegroups.com>.
To post to this group, send email to django-users@googlegroups.com 
<mailto: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/a920009c-ca15-4fe4-a146-26cfddef809b%40googlegroups.com 
<https://groups.google.com/d/msgid/django-users/a920009c-ca15-4fe4-a146-26cfddef809b%40googlegroups.com?utm_medium=email_source=footer>.

For more options, visit https://groups.google.com/d/optout.



--
--
Anthony Flury
email : *anthony.fl...@btinternet.com*
Twitter : *@TonyFlury <https://twitter.com/TonyFlury/>*

--
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/0fd2e8e9-d2d2-6326-dc2f-25297e614f85%40btinternet.com.
For more options, visit https://groups.google.com/d/optout.


Re: Problem with get_absolute_url() in admin

2018-06-10 Thread Anthony Anonde
the example.com is am example django give for Site. Which means there is a 
way for you to manage more than one site at a time, basically using the 
site_id.
To you Questions, i don't understand why you want to hard code your uri 
routing like that when you can easily use the app_name and name convention 
which is more dynamic then hard coding it like that: 
for example at the model Transaction urls.py 
app_name = "trans"
url(r'(?P-/d+)$', views.func, name='account_trans'),

def get_absolute_url(self):
return reverse("trans:account_trans",  kwargs={"pk":self.pk})


and you will be just fine hope this help



On Sunday, June 10, 2018 at 12:30:51 PM UTC+1, Joakim Hove wrote:
>
> Hello,
>
> I have a model `Transaction` which can be viewed at the url: 
> /transaction/view/$ID/ - if I just enter that url in the browser, or in 
> template everything works. But when I have the following get_abolute_url() 
> method:
>
> def get_absolute_url(self):
>  return "/transaction/view/{}/".format( self.id )
>
> things do not work from the Admin. When I click on the "View on Site" link 
> i am redirected to "http://example.com/transaction/view/23635/; and I get 
> an error message about failed XML parsing. I have no clue where the "
> example.com" address comes from - that string is not in my codebase. If I 
> hardcode the get_absolute_url to:
>
> def get_absolute_url(self):
>  return "http://127.0.0.1:8000/transaction/view{}/".format(self.id)
>
> That works in development, but needless to say that is not a very good 
> approach.
>
> I am on Django 1.10
>
>
> Regard Joakim
>
>
>

-- 
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/5678b297-2693-4ae8-b249-08e42713ebf7%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: what does the below mentioned error means and how do i resolve this error.something is wrong with my admin.py file.Please comment:

2018-06-08 Thread 'Anthony Flury' via Django users

The errors are relatively obvious to be frank - see the responses below ...


On 08/06/18 14:56, Avitab Ayan Sarmah wrote:
Can you tell me what is wrong in my admin.py file because from 
exception it seems that list_display() is having something wrong which 
I am not able to find out


On Fri 8 Jun, 2018, 7:23 PM Mario R. Osorio, <mailto:nimbiot...@gmail.com>> wrote:


Looks like you skiped a huge part of the tutorial. you might to go
back...

On Thursday, June 7, 2018 at 11:08:15 AM UTC-4, Avitab Ayan Sarmah
wrote:

In windows powershell:

ERRORS:
: (admin.E108) The value of
'list_display[0]' refers to 'question_text', which is not a
callable, an attribute of 'QuestionAdmin', or an attribute or
method on 'polls.Question'.



In your list_display field (on your QuestionAdmin)  refers to a field 
'question_text' which doesn't exist on either the QuestionAdmin or the 
Question model; i.e. that field does not exist in either model.



: (admin.E108) The value of
'list_display[1]' refers to 'pub_date', which is not a
callable, an attribute of 'QuestionAdmin', or an attribute or
method on 'polls.Question'.

In your list_display field (on your QuestionAdmin)  refers to a field 
'pub_date' which doesn't exist on either the QuestionAdmin or the 
Question model; i.e. that field does not exist in either model.


: (admin.E116) The value of
'list_filter[0]' refers to 'pub_date', which does not refer to
a Field.

In your list_filter field (on your QuestionAdmin)  refers to a field 
'pub_date' which doesn't exist on either the QuestionAdmin or the 
Question model; i.e. that field does not exist in either model.


To be honest the error message you got says exactly what the problem is 
- the fields that you think exist don't exist. You need to check your 
models, and check the field names, spellings etc.




-- 
You received this message because you are subscribed to a topic in

the Google Groups "Django users" group.
To unsubscribe from this topic, visit
https://groups.google.com/d/topic/django-users/444q_hv6-aA/unsubscribe.
To unsubscribe from this group and all its topics, send an email
to django-users+unsubscr...@googlegroups.com
<mailto:django-users+unsubscr...@googlegroups.com>.
To post to this group, send email to django-users@googlegroups.com
<mailto: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/8c65b7f0-9ca7-4e07-8167-fb29274710e1%40googlegroups.com

<https://groups.google.com/d/msgid/django-users/8c65b7f0-9ca7-4e07-8167-fb29274710e1%40googlegroups.com?utm_medium=email_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 
<mailto:django-users+unsubscr...@googlegroups.com>.
To post to this group, send email to django-users@googlegroups.com 
<mailto: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/CAEx5wm7JH77g9JfU%3DzHY3%2BCiDbnD3vDnaXLy%3DV1mE8E2wCrd2g%40mail.gmail.com 
<https://groups.google.com/d/msgid/django-users/CAEx5wm7JH77g9JfU%3DzHY3%2BCiDbnD3vDnaXLy%3DV1mE8E2wCrd2g%40mail.gmail.com?utm_medium=email_source=footer>.

For more options, visit https://groups.google.com/d/optout.



--
--
Anthony Flury
email : *anthony.fl...@btinternet.com*
Twitter : *@TonyFlury <https://twitter.com/TonyFlury/>*

--
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/d887e00e-6f3c-b7d9-ded0-898c0e8b5f1d%40btinternet.com.
For more options, visit https://groups.google.com/d/optout.


Re: is this my correct results.html and detail.html code?i am only a beginer, please check

2018-06-06 Thread 'Anthony Flury' via Django users
I can't see anything necessarily wrong in terms of most browsers but it 
isn't strictly compliant with the HTML standards.


To be strict HTML, your html files should be including *html* and *body* 
tags as a minimum.


The *html* tag starts and end the html file - in theory browsers are 
entitled to ignore content sent to it that doesn't start with *html* tags;


The *body* tag is used to wrap the content of the data which needs to be 
displayed by the browser.


So in theory - a better results.html would be

   
   
   {{ question.question_text }}

   
   {% for choice in question.choice_set.all %}
 {{ choice.choice_text }} -- {{ choice.votes }} vote{{
   choice.votes|pluralize }}
   {% endfor %}
   

   vote again?
   
   

At the end of the day though - it really does depend on what correct 
means to you.


1. Do you want to make sure that your pages are closer to strict HTML - 
which means that in complex pages, the browser will stand a better 
chance of displaying what you want


or

2. Do you simply want to ensure that the browser you use displays what 
you expect - if so - strict HTML isn't necessary; so long as it works 
for you.



On 06/06/18 18:01, Avitab Ayan Sarmah wrote:

results.html:

{{ question.question_text }}


{% for choice in question.choice_set.all %}
  {{ choice.choice_text }} -- {{ choice.votes }} vote{{
choice.votes|pluralize }}
{% endfor %}


vote again?


detail.html:

{{ question.question_text }}

{% if error_message %}{{ error_message }}{% 
endif %}



{% csrf_token %}
{% for choice in question.choice_set.all %}
  
  {{ choice.choice_text }}

{% 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 
<mailto:django-users+unsubscr...@googlegroups.com>.
To post to this group, send email to django-users@googlegroups.com 
<mailto: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/6b6eb6ac-7152-474e-88eb-2da9eb473d3f%40googlegroups.com 
<https://groups.google.com/d/msgid/django-users/6b6eb6ac-7152-474e-88eb-2da9eb473d3f%40googlegroups.com?utm_medium=email_source=footer>.

For more options, visit https://groups.google.com/d/optout.



--
--
Anthony Flury
email : *anthony.fl...@btinternet.com*
Twitter : *@TonyFlury <https://twitter.com/TonyFlury/>*

--
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/2c13b6c5-1ed5-9758-694c-6b880a63103b%40btinternet.com.
For more options, visit https://groups.google.com/d/optout.


Re: Generating server-side off-line HTML of Django pages ...

2018-06-06 Thread 'Anthony Flury' via Django users

Does the test client execute javascript as well ? I can't remember.

On 05/06/18 00:14, Bernd Wechner wrote:
Thanks Melvyn, looks exactly like what I wanted! Will investigate. I 
had a feeling this could not be a novel or unique use case.


Regards,

Bernd.

On Monday, 4 June 2018 20:09:25 UTC+10, Melvyn Sopacua wrote:

On maandag 4 juni 2018 08:00:08 CEST Bernd Wechner wrote:

> Say I have a page on my Django website (because I do) that I
would like to

> take a snapshot of on an automated basis on the server itself with a

> crontab say. I imagine writing a small python script that I
could run, that

> loads Django, a settings file, knows a URL and has a way of
saying "give me

> the rendered page for that URL please" and save it in a file.

...

> a) there's a canonical way to do this already that can be
recommended

Yep. The test client

<https://docs.djangoproject.com/en/2.0/topics/testing/tools/#the-test-client>...
if your template uses request related information (like logged in
user). The cheaper method is something like this code

<https://github.com/melvyn-sopacua/django_xtc/blob/master/xtc/__init__.py#L49>,
but this only renders the template and you'd have to provide a
context so view code is bypassed.

-- 


Melvyn Sopacua

--
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 
<mailto:django-users+unsubscr...@googlegroups.com>.
To post to this group, send email to django-users@googlegroups.com 
<mailto: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/850bfcaa-0518-48ef-a827-087100efda92%40googlegroups.com 
<https://groups.google.com/d/msgid/django-users/850bfcaa-0518-48ef-a827-087100efda92%40googlegroups.com?utm_medium=email_source=footer>.

For more options, visit https://groups.google.com/d/optout.



--
--
Anthony Flury
email : *anthony.fl...@btinternet.com*
Twitter : *@TonyFlury <https://twitter.com/TonyFlury/>*

--
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/03b51b49-d1b8-b7f4-9ff4-5d8d8ff3b54a%40btinternet.com.
For more options, visit https://groups.google.com/d/optout.


Fwd: Re: relation “” does not exist in django for app name with mixed-case

2018-06-06 Thread 'Anthony Flury' via Django users





 Forwarded Message 
Subject: 	Re: relation “” does not exist in django for app name with 
mixed-case

Date:   Wed, 6 Jun 2018 17:22:13 +0100
From:   Anthony Flury 
To: Majid Hojati 



The problem isn't the name of the model. I doubt Django is going to have
an issue with standard named Python Classes.

The error is saying that Django can't find the Model in the data based.

In the Django console, and you enter this :

|selected=Riser.objects.get(id=id)|

Do you get an error ?

Have you confirmed that your Django app is pointing to the right database.

BTW - why do you think it has anything to do with the Model name being
mixed case ? The fact that you can add objects to the table suggest to
me that DJango has no problem with the table name at all ?


On 05/06/18 11:28, Majid Hojati wrote:


I have faced a problem while working with django models. lets say my 
apps name is |GasNet| and my models name is |Riser| well the generated 
table name is |GasNet.riser|, I can successfully generate table and 
add objects to table and even delete all of the objects of a table. 
But when I try to delete an object I face this error


|The above exception (relation "GasNet_riser"does notexist LINE 
1:..."."createDateTime", "GasNet_riser"."deleted" FROM 
"GasNet_ri...^)was the direct cause ofthe followingexception:|


in debug window the sql query is as

|sql ('SELECT "GasNet_riser"."id", "GasNet_riser"."city_code", 
''"GasNet_riser"."geom"::bytea, "GasNet_riser"."node_code", 
''"GasNet_riser"."pipe", "GasNet_riser"."parcel_code", 
''"GasNet_riser"."Number", "GasNet_riser"."hack", 
"GasNet_riser"."multi_code", ''"GasNet_riser"."gis_code", 
"GasNet_riser"."angle", "GasNet_riser"."size", 
''"GasNet_riser"."direction", "GasNet_riser"."instalation_date", 
''"GasNet_riser"."description", "GasNet_riser"."type", 
''"GasNet_riser"."status", "GasNet_riser"."instalation_type", 
''"GasNet_riser"."material", "GasNet_riser"."zone_id", 
''"GasNet_riser"."prejenti_id", 
"GasNet_riser"."emergency_sub_zone_id", 
''"GasNet_riser"."updateDateTime", "GasNet_riser"."createDateTime", 
''"GasNet_riser"."deleted" FROM "GasNet_riser" WHERE 
"GasNet_riser"."id" = %s')|


this is my model

|class 
Riser(models.Model):id=models.AutoField(primary_key=True)city_code 
=models.CharField(max_length=10)geom 
=models.PointField(srid=4326)node_code 
=models.IntegerField(default=-1,blank=True)#شمارهگرهجهتاعمالمصرفآنبررویگرهدرطراحیpipe 
=models.IntegerField(default=-1,blank=True)parcel_code 
=models.IntegerField(default=-1,blank=True)Number 
=models.CharField(max_length=20)#کدعلمکhack 
=models.IntegerField(default=-1,blank=True)multi_code 
=models.CharField(max_length=10,blank=True)gis_code 
=models.CharField(max_length=20,blank=True)angle 
=models.FloatField(default=-1,blank=True)size 
=models.IntegerField(default=-1,blank=True)direction 
=models.TextField(max_length=500,blank=True)instalation_date 
=models.DateField(null=True,blank=True)#تاریخنصبdescription 
=models.TextField(blank=True)type 
=models.CharField(max_length=20,blank=True)#همانفیلدkind هست#choises 
status 
=models.CharField(max_length=5,default=ModelChoiseFields.NAN,choices=ModelChoiseFields.RISER_STATUS,blank=True)instalation_type 
=models.CharField(max_length=5,default=ModelChoiseFields.NAN,choices=ModelChoiseFields.RISER_INSTALATION_TYPE,blank=True)material 
=models.CharField(max_length=5,default=ModelChoiseFields.NAN,choices=ModelChoiseFields.RISER_MATERIAL,blank=True)#relations 
zone 
=models.ForeignKey(Zone,on_delete=models.CASCADE,null=True)prejenti 
=models.ForeignKey(pt,models.CASCADE,null=True,blank=True)emergency_sub_zone 
=models.ForeignKey(EmergencySubZone,models.CASCADE,null=True)#زیرناحیهامداد#Auto 
fields updateDateTime =models.DateTimeField('update 
date',auto_now_add=True,auto_now=False)createDateTime 
=models.DateTimeField('create 
date',auto_now_add=False,auto_now=True)deleted 
=models.BooleanField(default=False)|


I tried |makemigrations| and |migrate| and I know that table is fine 
but I have no idea why this happens.


I try to delete object using this method.

|selected=Riser.objects.get(id=id)selected.delete()|

I think the problem is with app name and upper case |G| and |N| but I 
do not know how to fix this problem.




I also tried to delete using filter and the same error happens. it says

|rel

Re: python manage.py (anything) NOT WORKING ANYMORE

2018-06-04 Thread 'Anthony Flury' via Django users

On 04/06/18 12:01, Gerald Brown wrote:



On Monday, June 4, 2018 at 6:58:39 PM UTC+8, Gerald Brown wrote:

I have been using ./manage.py shell for awhile and now all of a
sudden it has stopped working with the error "AttributeError:
'property' object has no attribute '__dict__'".  I get the same
error with anything I enter after the ./manage.py (i.e. runserver,
dbshell, etc)

I think it might have to do with something I added to my
requirements.txt file.

Does anyone know of a way other than committing out the
requirements.txt one-by-one on how to solve this problem?


By the way it is running in a pyvenvwrapper virtual environment .


if everything is running in your virtual enviornment, do a `pip freeze` 
in both environments - and then do a diff between them - that at least 
will tell you which packages you have in the non-working environment 
which might be different from the working environment; there might be a 
lot though.


Have you possibly upgraded your django installation in the non-working 
environment - I can't image any 3rd Party non django installations 
breaking the Django such that the manage.py now doesn't work.


the other possibility is that your default python is different between 
the two environment.



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 
<mailto:django-users+unsubscr...@googlegroups.com>.
To post to this group, send email to django-users@googlegroups.com 
<mailto: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/b0b8631b-990b-4123-bc14-e10cf9b1406a%40googlegroups.com 
<https://groups.google.com/d/msgid/django-users/b0b8631b-990b-4123-bc14-e10cf9b1406a%40googlegroups.com?utm_medium=email_source=footer>.

For more options, visit https://groups.google.com/d/optout.



--
--
Anthony Flury
email : *anthony.fl...@btinternet.com*
Twitter : *@TonyFlury <https://twitter.com/TonyFlury/>*

--
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/1c00d406-ddc7-b4ff-dfe3-efbab446a07e%40btinternet.com.
For more options, visit https://groups.google.com/d/optout.


Re: Updating django database

2018-06-02 Thread 'Anthony Flury' via Django users

Is this a new or a update from the front end ?

If new :
 1 Extract json using : data = json.load( request.POST['json'] - 
this converts data to a dictionary (assuming that the json is in the 
'json' field in the message.

 2 Validate as necessary
 3 Create instance : instance = Patient.create(**data),
    instance.save()

if an update to an existing instance :
 1 Extract json using : data = json.load( request.POST['json'] - 
this converts data to a dictionary (assuming that the json is in the 
'json' field in the message.

 2 Validate as necessary
 3 Update :
            for field, value in data.items():
  setattr(instance, field, value)

   instance.save()

        Assuming that instance


On 29/05/18 12:37, Albin Antony wrote:

Hello guys,
Sorry about the above no subject mail
I am getting a json string(json_string) from frontend. How can we 
update the django database in views.py. Below is my models.py.

models.py

class Patient(models.Model):
    patient_id = models.CharField(primary_key=True, max_length=200)
    patient_age = models.CharField(max_length=200)
    patient_name = models.CharField(max_length=200)
    patient_refby = models.CharField(max_length=200)
    patient_gender = models.CharField(max_length=20,
default=Gender.UNKNOWN.value)


--
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 
<mailto:django-users+unsubscr...@googlegroups.com>.
To post to this group, send email to django-users@googlegroups.com 
<mailto: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/CAEohp0dkVzwRZWe9ig8cWWVyXq08K_qndfVmSpj8AM9Zxgaf-Q%40mail.gmail.com 
<https://groups.google.com/d/msgid/django-users/CAEohp0dkVzwRZWe9ig8cWWVyXq08K_qndfVmSpj8AM9Zxgaf-Q%40mail.gmail.com?utm_medium=email_source=footer>.

For more options, visit https://groups.google.com/d/optout.



--
--
Anthony Flury
email : *anthony.fl...@btinternet.com*
Twitter : *@TonyFlury <https://twitter.com/TonyFlury/>*

--
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/efdb4d8e-ece2-2d95-9210-277fcdac9c9e%40btinternet.com.
For more options, visit https://groups.google.com/d/optout.


Re: Updating django database

2018-06-02 Thread 'Anthony Flury' via Django users

Is this a new or a update from the front end ?

If new :
 1 Extract json using : data = json.load( request.POST['json'] - 
this converts data to a dictionary (assuming that the json is in the 
'json' field in the message.

 2 Validate as necessary
 3 Create instance : instance = Patient.create(**data),
    instance.save()

if an update to an existing instance :
 1 Extract json using : data = json.load( request.POST['json'] - 
this converts data to a dictionary (assuming that the json is in the 
'json' field in the message.

 2 Validate as necessary
 3 Update :
            for field, value in data.items():
  setattr(instance, field, value)

   instance.save()

        Assuming that instances is the Patient record to be updated.

I hope this helps.


On 29/05/18 12:37, Albin Antony wrote:

Hello guys,
Sorry about the above no subject mail
I am getting a json string(json_string) from frontend. How can we 
update the django database in views.py. Below is my models.py.

models.py

class Patient(models.Model):
    patient_id = models.CharField(primary_key=True, max_length=200)
    patient_age = models.CharField(max_length=200)
    patient_name = models.CharField(max_length=200)
    patient_refby = models.CharField(max_length=200)
    patient_gender = models.CharField(max_length=20,
default=Gender.UNKNOWN.value)


--
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 
<mailto:django-users+unsubscr...@googlegroups.com>.
To post to this group, send email to django-users@googlegroups.com 
<mailto: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/CAEohp0dkVzwRZWe9ig8cWWVyXq08K_qndfVmSpj8AM9Zxgaf-Q%40mail.gmail.com 
<https://groups.google.com/d/msgid/django-users/CAEohp0dkVzwRZWe9ig8cWWVyXq08K_qndfVmSpj8AM9Zxgaf-Q%40mail.gmail.com?utm_medium=email_source=footer>.

For more options, visit https://groups.google.com/d/optout.



--
--
Anthony Flury
email : *anthony.fl...@btinternet.com*
Twitter : *@TonyFlury <https://twitter.com/TonyFlury/>*

--
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/24980dc2-6173-decd-67b6-871ef0ef9d3f%40btinternet.com.
For more options, visit https://groups.google.com/d/optout.


Re: Error while doing django tutorial part 2

2018-05-27 Thread 'Anthony Flury' via Django users
What is the code for your Choice model.  The error message clearly states that 
the Choice model is the one with the problem. 

-- 
Anthony Flury
email : anthony.fl...@btinternet.com
Twitter : @TonyFlury

> On 26 May 2018, at 18:47, Kranthi Kiran <1991.kran...@gmail.com> wrote:
> 
> Text of error message in case the image is not loading
> 
> 
> >>> q = Question.objects.get(pk=1)
> >>> q.choice_set.all()
> Traceback (most recent call last):
>   File "", line 1, in 
>   File "/usr/lib64/python3.6/site-packages/django/db/models/query.py", line 
> 251,  
> in __repr__
> return '<%s %r>' % (self.__class__.__name__, data)
>   File "/usr/lib64/python3.6/site-packages/django/db/models/base.py", line 
> 513,  
> in __repr__
> return '<%s: %s>' % (self.__class__.__name__, self)
>   File "/home/kkondapalli/mysite/polls/models.py", line 25, in __str__
> return self.question_text
> AttributeError: 'Choice' object has no attribute 'question_text'
> >>>
> 
> 
> 
>> On Saturday, 26 May 2018 22:49:04 UTC+5:30, Kranthi Kiran wrote:
>> Hello User,
>> 
>> I am following django tutorial at 
>> https://docs.djangoproject.com/en/2.0/intro/tutorial02/
>> 
>> After modifying polls/models.py  and when running python3.6 manage.py shell 
>> again
>> 
>> 
>> I am getting the following error at the following 
>> 
>> >>> q = Question.objects.get(pk=1)
>> 
>> # Display any choices from the related object set -- none so far.
>> >>> q.choice_set.all()
>> 
>> 
>> Error screenshot
>> 
>> 
>> 
>> 
>> Please help me to resolve the issue at earliest
>> 
> 
> -- 
> 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/0e27456c-eefa-4a1e-bf4f-a44d9e8dcad1%40googlegroups.com.
> 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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/79BDF872-C026-4A13-A6FA-31C7041CFD3A%40btinternet.com.
For more options, visit https://groups.google.com/d/optout.


Re: Is there a WYSIWYG app I can use for an inherited Django created website?

2018-05-26 Thread 'Anthony Flury' via Django users
Basically no. 

While there might be a WYSIWYG editor for the templates (which are basically 
HTML, JS and CSS with an embedded python like script) they will only edit the 
html within the template file and you won’t see the auto generated html for the 
individual Django fields, or the other Django constructs within the template.

Django is also a lot more complex than a wordpress - WP tends to be static 
pages (I have never seen a WP page which fetched data from a database; Django 
web site are often a mix between all static pages (like the welcome page) and 
pages where most/ all of the content is dynamic with data extracted live from a 
database. There is often a certain level of processing of the data before it 
gets displayed on the page - and that is where Python comes in. 

I think you need to learn some HTML, CSS (and Python & Django); even adding a 
new static web page to an existing site requires you to understand something of 
the Django framework (so that you know how page requests get translated into 
views on templates). 

-- 
Anthony Flury
email : anthony.fl...@btinternet.com
Twitter : @TonyFlury

> On 26 May 2018, at 17:34, DjamgoNewbie <mikerom...@gmail.com> wrote:
> 
> I have worked with WordPress but I inherited an already made website built 
> with Django. Is there a WYSIWYG app that I can use to update/edit the Django 
> site without me having to learn Django /Python first? The updates/corrections 
> to the website are time sensitive.
> 
> -- 
> 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/1d3a6753-caf8-4c1f-981a-fb1f3a4065e7%40googlegroups.com.
> 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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/302080A1-9509-4498-A128-8D152AA48C9F%40btinternet.com.
For more options, visit https://groups.google.com/d/optout.


Re: Multisite strategy

2018-05-24 Thread Anthony Petrillo
Thanks Melvyn. That helps a lot.
Anthony

On Thu, May 24, 2018 at 1:18 PM, Melvyn Sopacua <m.r.sopa...@gmail.com>
wrote:

> On donderdag 24 mei 2018 16:39:34 CEST Anthony Petrillo wrote:
>
>
>
> > So I was thinking that was an option so that I could build one site and
>
> > then have translations into other languages so when the user picked a
>
> > language everything will switch to that language. Is this a naive
>
> > assumption?
>
>
>
> A bit. Everything that is in the code can be translated using the gettext
> functionality outlined in the documention. Everything that is in the
> database, cannot.
>
>
>
> You will need separate app for that. Which is the best fit for you,
> depends on a number of factors, but here are some to choose from:
>
>
>
> From the Django Packages Internationalizion
> <https://djangopackages.org/grids/g/i18n/> grid:
>
>
>
> - Django Model Translation
>
> -  Parler
>
> -  Linguist
>
> -  Model Trans
>
>
>
> > On Tuesday, May 22, 2018 at 2:31:36 AM UTC-4, Carlo Ascani wrote:
>
> > > Hi all,
>
> > >
>
> > > I'd like to implement something like this:
>
> > >
>
> > > One Django project to serve 3 sites:
>
> > > 1. `domain.com` which is the "master" site, containing just a landing
> page
>
> > > 2. `de.domain.com` which is the "German" site
>
> > > 3. `en.domain.com` which is the "UK" site
>
> > >
>
> > > `de` and `en` refers the location, not the language (e.g. `
>
> > > de.domain.com/en/` <http://de.domain.com/en/> <
> http://de.domain.com/en/> is the German site in
>
> > > English)
>
> > >
>
> > > If you go to `domain.com` you can choose the language and the country,
>
> > > and you are just redirected to the right place.
>
> > >
>
> > > Is `contrib.site` suitable for that scenario?
>
> > > I was thinking at 3 different sites.
>
> > > If so, how can I use them locally while in development?
>
> > >
>
> > > Any other suggestions?
>
> > >
>
> > > Best,
>
> > > Carlo
>
>
>
>
>
> --
>
> Melvyn Sopacua
>
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "Django users" group.
> To unsubscribe from this topic, visit https://groups.google.com/d/
> topic/django-users/ys6oZtF1Dxg/unsubscribe.
> To unsubscribe from this group and all its topics, 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/2693684.PrGW0JMWH4%40fritzbook
> <https://groups.google.com/d/msgid/django-users/2693684.PrGW0JMWH4%40fritzbook?utm_medium=email_source=footer>
> .
>
> For more options, visit https://groups.google.com/d/optout.
>



-- 

Anthony

-- 
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/CADr2eV5De4UCY6w8u9aPJewx%2B-iT4xpU2daCkn_C_thukeVC1A%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Temporal table in Django 1.6

2018-05-24 Thread 'Anthony Flury' via Django users
Although Django doesn't support the Temporal tables directly - it gives 
you all the tools you need to create one.


And there are some installable extensions :

    django-temporal-models : 
https://github.com/TyumenGortrans/django-temporal-models


    You should be able to install it by

            pip install django-temporal-models

    The documentation is in Russian, and it does only seem to support 
Python 2 - but it might give you some ideas of how to implement it.


If I was implementing this on my own, I would have two models for the 
data and the history. I would use triggers to track updates, deletions 
on the data etc (all of which would write to the history), and then have 
a OneToMany relationship from your data table to the history table. 
Writing the signals wouldn't be that difficult; every change creates a 
new row in the history with the current data time.


To create a well rounded extension (like the one above) is more work - 
but for a specific solution for your project, implementing your own 
shouldn't be that difficult



--
--
Anthony Flury
email : *anthony.fl...@btinternet.com*
Twitter : *@TonyFlury <https://twitter.com/TonyFlury/>

*On 21/05/18 20:13, Nirali Supe wrote:

Hello,

I need to create Temporal table in Django 1.6
Does Django support  Temporal table model? I unable to find the Django 
documentation on it.

Can someone please point me to the documentation?

Thank you,
Nirali Supe
--
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 
<mailto:django-users+unsubscr...@googlegroups.com>.
To post to this group, send email to django-users@googlegroups.com 
<mailto: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/918a65bb-e9c3-42fb-9170-6e5092b62bc5%40googlegroups.com 
<https://groups.google.com/d/msgid/django-users/918a65bb-e9c3-42fb-9170-6e5092b62bc5%40googlegroups.com?utm_medium=email_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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/14e753f9-4370-75cf-5767-3c7815bae16b%40btinternet.com.
For more options, visit https://groups.google.com/d/optout.


Re: Multisite strategy

2018-05-24 Thread Anthony Petrillo
I'm new at this Django stuff, so this is more of a question than a 
suggestion. I keep seeing a references to translating. I found in the 
manual the following: 

3.15 Internationalization and localization
3.15.1 Translation
Overview
In order to make a Django project translatable, you have to add a minimal 
number of hooks to your Python code and
templates. These hooks are called translation strings. They tell Django: 
“This text should be translated into the end
user’s language, if a translation for this text is available in that 
language.” It’s your responsibility to mark translatable
strings; the system can only translate strings it knows about.

So I was thinking that was an option so that I could build one site and 
then have translations into other languages so when the user picked a 
language everything will switch to that language. Is this a naive 
assumption?


On Tuesday, May 22, 2018 at 2:31:36 AM UTC-4, Carlo Ascani wrote:
>
> Hi all,
>
> I'd like to implement something like this:
>
> One Django project to serve 3 sites:
> 1. `domain.com` which is the "master" site, containing just a landing page
> 2. `de.domain.com` which is the "German" site
> 3. `en.domain.com` which is the "UK" site
>
> `de` and `en` refers the location, not the language (e.g. `
> de.domain.com/en/`  is the German site in 
> English)
>
> If you go to `domain.com` you can choose the language and the country, 
> and you are just redirected to the right place.
>
> Is `contrib.site` suitable for that scenario?
> I was thinking at 3 different sites.
> If so, how can I use them locally while in development?
>
> Any other suggestions?
>
> Best,
> Carlo
>
>
>

-- 
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/b10986bb-9b75-4c29-80e0-cfe902a9e2c5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re:

2018-05-23 Thread 'Anthony Flury' via Django users

Does the file actually exist - it should be in :

   *my_site/polls/templates/polls/*

https://docs.djangoproject.com/en/2.0/intro/tutorial03/#write-views-that-actually-do-something

    Assuming you haven't changed the TEMPLATES settings in some way.

--
--
Anthony Flury
email : *anthony.fl...@btinternet.com*
Twitter : *@TonyFlury <https://twitter.com/TonyFlury/>*

On 23/05/18 11:16, Umar Kambala wrote:


Yes its spelled correctly on the command window its telling me
TemplateDoesNotExit: polls/detail.html

On May 23, 2018 9:58 AM, "tango ward" <tangowar...@gmail.com 
<mailto:tangowar...@gmail.com>> wrote:


Check if your template name is correct in your views.py

On Wed, May 23, 2018 at 5:56 PM, Umar Kambala
<umarkamb...@gmail.com <mailto:umarkamb...@gmail.com>> wrote:

Plz need help
I found this problem TemplateDoesNotExit at /polls/1/ where
might have I gone wrong?

-- 
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
<mailto:django-users+unsubscr...@googlegroups.com>.
To post to this group, send email to
django-users@googlegroups.com
<mailto:django-users@googlegroups.com>.
Visit this group at
https://groups.google.com/group/django-users
<https://groups.google.com/group/django-users>.
To view this discussion on the web visit

https://groups.google.com/d/msgid/django-users/CAPkbFbZwVPyBpVsA65UTjeJNgKHnQqpsTVmOmeO5GFeusnVfww%40mail.gmail.com

<https://groups.google.com/d/msgid/django-users/CAPkbFbZwVPyBpVsA65UTjeJNgKHnQqpsTVmOmeO5GFeusnVfww%40mail.gmail.com?utm_medium=email_source=footer>.
For more options, visit https://groups.google.com/d/optout
<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
<mailto:django-users+unsubscr...@googlegroups.com>.
To post to this group, send email to django-users@googlegroups.com
<mailto:django-users@googlegroups.com>.
Visit this group at https://groups.google.com/group/django-users
<https://groups.google.com/group/django-users>.
To view this discussion on the web visit

https://groups.google.com/d/msgid/django-users/CAA6wQLLkxWQd3wDOMPNDEAPPNeTfVJhU7L1GP4au75yrU6Bcuw%40mail.gmail.com

<https://groups.google.com/d/msgid/django-users/CAA6wQLLkxWQd3wDOMPNDEAPPNeTfVJhU7L1GP4au75yrU6Bcuw%40mail.gmail.com?utm_medium=email_source=footer>.
For more options, visit https://groups.google.com/d/optout
<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 
<mailto:django-users+unsubscr...@googlegroups.com>.
To post to this group, send email to django-users@googlegroups.com 
<mailto: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/CAPkbFbZmHibrrij317hQeczBiWqFB_QexEZFxKcko2qpsbzEww%40mail.gmail.com 
<https://groups.google.com/d/msgid/django-users/CAPkbFbZmHibrrij317hQeczBiWqFB_QexEZFxKcko2qpsbzEww%40mail.gmail.com?utm_medium=email_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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/080cbd1f-c321-c4b1-718d-67d350492c03%40btinternet.com.
For more options, visit https://groups.google.com/d/optout.


Re: getting error while reloading the url"http://localhost:8000/polls/".The error is given below.Please tell my why i am seeing this error?

2018-05-22 Thread 'Anthony Flury' via Django users

In your MySite\urls.py :

   urlpatterns = [
   path('', include('polls.urls')),
   path('admin/', admin.site.urls),
   ]


should be

   urlpatterns = [
   path('polls', include('polls.urls')),
   path('admin/', admin.site.urls),
   ]

Django doesn't assume that the url should be /polls - just 
because the app name is 'polls' - you have to be explicit about the url 
path that needs to be matched.

--
Anthony Flury
email : *anthony.fl...@btinternet.com*
Twitter : *@TonyFlury <https://twitter.com/TonyFlury/>*

On 22/05/18 16:27, Avitab Ayan Sarmah wrote:

Mysite\urls.py:
from django.contrib import admin
from django.urls import include, path

urlpatterns = [
path('', include('polls.urls')),
path('admin/', admin.site.urls),
]

polls\urls.py:
from django.urls import path

from . import views

app_name = 'polls'
urlpatterns = [
# ex: /polls/
path('', views.IndexView.as_view(), name='index'),
# ex: /polls/5/
path('/', views.DetailView.as_view(), name='detail'),
# ex: /polls/5/results/
path('/results/', views.ResultsView.as_view(), name='results'),
# ex: /polls/5/vote/
path('/vote/', views.vote, name='vote'),
]


On Friday, May 18, 2018 at 10:42:17 PM UTC+5:30, James Farris wrote:

What does your urls.py look like?

According to the error it doesn’t appear that polls/ is defined in
your urls.py file

On Fri, May 18, 2018 at 10:05 AM Avitab Ayan Sarmah
<avita...@gmail.com > wrote:


  Page not found (404)

Request Method: GET
Request URL:http://localhost:8000/polls/

Using the URLconf defined in |mysite.urls|, Django tried these
URL patterns, in this order:

 1. [name='index']
 2. / [name='detail']
 3. /results/ [name='results']
 4. /vote/ [name='vote']
 5. admin/

The current path, |polls/|, didn't match any of these.

You're seeing this error because you have |DEBUG = True| in
your Django settings file. Change that to |False|, and Django
will display a standard 404 page.

-- 
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
https://groups.google.com/group/django-users
<https://groups.google.com/group/django-users>.
To view this discussion on the web visit

https://groups.google.com/d/msgid/django-users/54b07f4e-663c-4ed0-a419-541d735148a1%40googlegroups.com

<https://groups.google.com/d/msgid/django-users/54b07f4e-663c-4ed0-a419-541d735148a1%40googlegroups.com?utm_medium=email_source=footer>.
For more options, visit https://groups.google.com/d/optout
<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 
<mailto:django-users+unsubscr...@googlegroups.com>.
To post to this group, send email to django-users@googlegroups.com 
<mailto: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/0d8bf4ad-99dc-4c0e-8341-1084e15daf75%40googlegroups.com 
<https://groups.google.com/d/msgid/django-users/0d8bf4ad-99dc-4c0e-8341-1084e15daf75%40googlegroups.com?utm_medium=email_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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/1b976379-41c5-27ed-36e7-a2e938876df8%40btinternet.com.
For more options, visit https://groups.google.com/d/optout.


Re: Unit testing models.py

2018-05-14 Thread 'Anthony Flury' via Django users

I would agree with that - test any custom functionality -

 * Custom methods (including __str__ and __repr__)
 * custom managers
 * Triggers (that maybe save custom fields on update)
 * validations - testing to ensure that the right validation is
   performed on that field - i.e. you linked the right field with the
   right validation.

I would do a cursory test that you can save and retrieve an object - 
just to make sure that you have executed your migrations correctly



On 13/05/18 19:08, Jani Tiainen wrote:

Hi,

In general you don't need to test your models if you don't use 
anything special there. If you do have properties or methods on models 
that do something that is good to test that they return correct values 
or do correct things.




On Sun, May 13, 2018 at 7:11 PM, Mark Phillips 
<m...@phillipsmarketing.biz <mailto:m...@phillipsmarketing.biz>> wrote:


What should be unit tested in models.py? I assume the storing of
data and retrieving of data from the database does not need to be
tested, as I further assume django has a full set of tests for
those operations.

I can see testing these parts of models.py

* All custom methods

* Labels for all fields
something like
def test_first_name_label(self):
        author=Author.objects.get(id=1)
        field_label =
author._meta.get_field('first_name').verbose_name
        self.assertEquals(field_label,'first name')

* Field attributes (eg length of CharField)? Is this really
necessary, as I would again assume django covers this in their
unit tests?

Anything else that I am missing?

Thanks!

Mark
-- 
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
<mailto:django-users+unsubscr...@googlegroups.com>.
To post to this group, send email to django-users@googlegroups.com
<mailto:django-users@googlegroups.com>.
Visit this group at https://groups.google.com/group/django-users
<https://groups.google.com/group/django-users>.
To view this discussion on the web visit

https://groups.google.com/d/msgid/django-users/CAEqej2P0_sZt2j06nf0OnOL%2BE%3DuVa1Cs0BOFmTx8vjQm6-io2Q%40mail.gmail.com

<https://groups.google.com/d/msgid/django-users/CAEqej2P0_sZt2j06nf0OnOL%2BE%3DuVa1Cs0BOFmTx8vjQm6-io2Q%40mail.gmail.com?utm_medium=email_source=footer>.
For more options, visit https://groups.google.com/d/optout
<https://groups.google.com/d/optout>.




--
Jani Tiainen

- Well planned is half done, and a half done has been sufficient before...
--
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 
<mailto:django-users+unsubscr...@googlegroups.com>.
To post to this group, send email to django-users@googlegroups.com 
<mailto: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/CAHn91oeJYPGbLaJAZbJqd3jxbDcY6m3d8e2fSE06_E_ZwXXosQ%40mail.gmail.com 
<https://groups.google.com/d/msgid/django-users/CAHn91oeJYPGbLaJAZbJqd3jxbDcY6m3d8e2fSE06_E_ZwXXosQ%40mail.gmail.com?utm_medium=email_source=footer>.

For more options, visit https://groups.google.com/d/optout.



--
--
Anthony Flury
email : *anthony.fl...@btinternet.com*
Twitter : *@TonyFlury <https://twitter.com/TonyFlury/>*

--
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/9822baae-9064-2a48-ede3-c4f2c2b4d031%40btinternet.com.
For more options, visit https://groups.google.com/d/optout.


Re: I canot upload files how can i fix it

2018-05-14 Thread 'Anthony Flury' via Django users

What does the form contain ?

Does the web page you get give you an upload button ?

Does the code in the view get triggered ?

Do you get any errors ?

On 13/05/18 04:23, carlos.davalo...@tectijuana.edu.mx wrote:

 views

def ArticuloFormA(request,Materiaid):
    Articulos = Articulo.objects.filter(Materia_id= Materiaid)
    Articulos = Articulos.order_by('-Fecha_Publicacion')[:5]
    Pregunta_Form = ArticuloForm()
    args = {'Pregunta_Form': Pregunta_Form}
    if request.method == 'POST':
    form = ArticuloForm(request.POST or None, request.FILES or None)
    if form.is_valid():
    Materias = Materia.objects.get(id = Materiaid)
    Preguntad = form.save(commit=False)
    Preguntad.user = request.user
    Preguntad.Texto_Pregunta = request.POST['Titulo']
    Preguntad.Materia = Materias
    Preguntad.Pdf_articulo = request.FILES['Pdf_articulo']
    Preguntad.save()
    return 
render(request,'articulos/detail.html',{'Preguntas': 
Articulos,'Materias': Materias})

    else:
    Pregunta_Form = ArticuloForm()
    args = {'Pregunta_Form': Pregunta_Form}
    return render(request,'foro/FormPregunta.html',args)


html

{% extends 'cuentas/base.html' %}

    {% block body %}
    
    CrearPregunta
    
    {% csrf_token %}
    {{ Pregunta_Form.docfile }}
    Submit

    
    
    {% endblock %}

--
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 
<mailto:django-users+unsubscr...@googlegroups.com>.
To post to this group, send email to django-users@googlegroups.com 
<mailto: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/353c96a5-5946-4530-beb4-71ad83c0366b%40googlegroups.com 
<https://groups.google.com/d/msgid/django-users/353c96a5-5946-4530-beb4-71ad83c0366b%40googlegroups.com?utm_medium=email_source=footer>.

For more options, visit https://groups.google.com/d/optout.



--
--
Anthony Flury
email : *anthony.fl...@btinternet.com*
Twitter : *@TonyFlury <https://twitter.com/TonyFlury/>*

--
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/7c9a06eb-c51c-ac5f-8068-9bfffdd18686%40btinternet.com.
For more options, visit https://groups.google.com/d/optout.


The path to my login template after registration is incorrect, but the path to the registration template in the same directory is correct, I don't understand why.

2018-05-12 Thread Anthony Orona

I set up user registration by subclassing generic.CreateView in an app 
called Accounts. and I then set up my urls using django.contrib.auth.urls. 
I can register a user but when I try to redirect to the login page, I get 
this error: 


~//workspace/web/goldrush/gr_backend/templates/registration/login.html 
(Source does not exist)

I don't understand why and I have been fiddling with this for an hour to no 
avail. 

The Accounts App, my settings, and project-level urls are available at: 
[this link](https://github.com/Ajorona/ecommercedjango) to my github. I am 
not going to put this project into production so I left my project secret 
key visible ¯\_(ツ)_/¯. Can someone help me understand how to correctly 
configure my templates for the Accounts App? I am using a project-level 
templates directory.

-- 
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/7338bc1f-cd49-44e3-88a8-4af1606e331b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: sphinx is showing the django base views instead of my own views.py

2018-05-08 Thread Anthony Petrillo
Solved.

Thank you again Tony for pointing me in the right direction.

Jens Hedegaard Nielsen gave the answer (indirectly) 
at https://github.com/sphinx-doc/sphinx/issues/4182. There he pointed to 

autodoc_mock_imports = ["django"] 

in the Sphinx 
documentation 
http://www.sphinx-doc.org/en/stable/ext/autodoc.html#confval-autodoc_mock_imports

Anthony

On Friday, May 4, 2018 at 11:25:20 AM UTC-4, Anthony Petrillo wrote:
>
> The view being shown when using Sphinx on a Django site is: 
>
>
> <https://lh3.googleusercontent.com/-IyVWh5gFHgg/Wux2UtHMdTI/XAM/ttdoOJAmaa0PZZSuKxsoEs27EJi45tssACLcBGAs/s1600/HMzGQ.png>
>
>
> The beginning of my views.py is:
>
>
> import os
>
> from django.shortcuts import render, redirect 
>
> from django.urls import reverse 
>
> from django.http import HttpResponse, HttpResponseRedirect 
>
> from django.utils import timezone
>
> from . forms import PlayForm, RollForm, checkBoard, BossForm
>
> from random import randint 
>
> from . templatetags.playExtras import translateDice 
>
> from .models import Board, Winner, Boss
>
>
> def getFirstFolder(req):
>
> """ return the string between first two / - this is a hack, find out 
> how to do it with the object """
>
> r = req.split("'")
>
> loc = r[1].find('/',1)
>
> x = r[1][1:loc]
>
> return(x)
>
>
> def loadBoard(request,context,location=''):
>
> ''' Load the board from the database into context. Add a hyperlink for 
> available squares.
>
>
> :param context: context for template
>
> :type context: dictionary
>
>
> :param location: Comma seperated string of available locations or 
> empty string so no links included.
>
> :type location: str
>
>
> :return: 'not on the board' or 'all taken' or comma seperated string 
> of location options such as 'A0,B0'
>
> :rtype: str
>
> '''
>
> req = request.__str__()
>
> I was getting errors if I didn't show Sphinx where the Python was located. 
> The path additions I made in the Sphinx's conf.py are:
>
> ourPaths = [
> '/game/',
> '/game/game',
> '/game/play',
> '/game/play/templatetags'
> ]
> for p in ourPaths:
> abspath = os.path.abspath('.')  + p
> print('path..',abspath)
> sys.path.insert(0, abspath)
> # Need to point to where the Django is on this system. FIND OUT HOW TO 
> MAKE THIS RELATIVE
> sys.path.insert(0,'/home/ajp/Downloads/env/lib/python3.5/site-packages')
>
> sys.path.insert(0,'/home/ajp/Downloads/env/lib/python3.5/site-packages/django')
>
>
> The views.rst file I'm using: 
>
> views module
> ==
>
> .. automodule:: views
> :members:
> :undoc-members:
> :show-inheritance:
>
> I searched for days but I'm afraid I do not know the right terms search 
> for to find the answer. I posted on stackoverflow for a couple weeks and no 
> responses at all. 
>
> I'm okay with the other code showing up, but I'd need to see my code in 
> the manual as well.
>
> Thank you for any help you can give. 
>

-- 
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/ebe15a98-9139-4eba-bd4d-f86e015477bd%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Username same as user id

2018-05-07 Thread 'Anthony Flury' via Django users
Yes - but that is very different from what you are asking - Facebook 
have a two stage form - first set the details - and then set the user 
name. Their user name isn't optional - it is always mandatory - it is 
just set at stage two.


You can assign any value to any variable you wish - this isn't a Django 
issue.


On 07/05/18 01:56, lakshitha kumara wrote:

hi anthony

Look at the facebook registration form. there are no username field 
first time user registration. but once user registered they can set 
username what they want.


Thanks

On Sunday, May 6, 2018 at 8:13:55 PM UTC+5:30, lakshitha kumara wrote:

Hello guys

Is there way to assign username same as user id if username
passing empty value on registration form. is there way to do that.

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 
<mailto:django-users+unsubscr...@googlegroups.com>.
To post to this group, send email to django-users@googlegroups.com 
<mailto: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/e7eb07c0-6162-4c88-b5b4-8d1a5ee2d4b6%40googlegroups.com 
<https://groups.google.com/d/msgid/django-users/e7eb07c0-6162-4c88-b5b4-8d1a5ee2d4b6%40googlegroups.com?utm_medium=email_source=footer>.

For more options, visit https://groups.google.com/d/optout.



--
--
Anthony Flury
email : *anthony.fl...@btinternet.com*
Twitter : *@TonyFlury <https://twitter.com/TonyFlury/>*

--
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/72d11416-4530-8977-c02e-a4b316cfeca1%40btinternet.com.
For more options, visit https://groups.google.com/d/optout.


Re: Username same as user id

2018-05-07 Thread 'Anthony Flury' via Django users

Of course there is :
on the view which responds to your registration form (likely to be where 
you call authenticate) - you simply test if the username field has been 
set when the registration is posted - and if not set it to be whatever 
you want.


Or - in your custom backend you can do the same thing; basically you 
have code like this :


if not username:
    username = random_digits()

where random_digits is a function you write to generate your random user 
name/number.


Remember you will need to tell the user what number you have chosen for 
them.


This isn't really a Django issue to be honest - it is simply code.


On 07/05/18 07:22, lakshitha kumara wrote:


Hello Jeni

Thank you for your reply. yes i dealing with my own custom 
authentication backend and now i desided to use username as random 
number Instead of user id if username not set.


Thanks you

On Sunday, May 6, 2018 at 8:13:55 PM UTC+5:30, lakshitha kumara wrote:

Hello guys

Is there way to assign username same as user id if username
passing empty value on registration form. is there way to do that.

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 
<mailto:django-users+unsubscr...@googlegroups.com>.
To post to this group, send email to django-users@googlegroups.com 
<mailto: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/a5474895-5676-449f-834f-4d3ab30594dd%40googlegroups.com 
<https://groups.google.com/d/msgid/django-users/a5474895-5676-449f-834f-4d3ab30594dd%40googlegroups.com?utm_medium=email_source=footer>.

For more options, visit https://groups.google.com/d/optout.



--
--
Anthony Flury
email : *anthony.fl...@btinternet.com*
Twitter : *@TonyFlury <https://twitter.com/TonyFlury/>*

--
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/521987a2-bac7-704e-24ff-0b4c550656f4%40btinternet.com.
For more options, visit https://groups.google.com/d/optout.


Re: Username same as user id

2018-05-06 Thread 'Anthony Flury' via Django users

I can't imagine having an application where username is optional ...

On 06/05/18 17:48, lakshitha kumara wrote:

hi anthony

Thank you for reply on this site username field not required field for 
user  but its set as required field on backend so i need assing user 
id as as username if username is empty for on registration submit.

user can login with email phone and username

Thanks


On Sunday, May 6, 2018 at 8:13:55 PM UTC+5:30, lakshitha kumara wrote:

Hello guys

Is there way to assign username same as user id if username
passing empty value on registration form. is there way to do that.

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 
<mailto:django-users+unsubscr...@googlegroups.com>.
To post to this group, send email to django-users@googlegroups.com 
<mailto: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/ed1f8b3c-301e-400c-b493-a55f49f2cdc5%40googlegroups.com 
<https://groups.google.com/d/msgid/django-users/ed1f8b3c-301e-400c-b493-a55f49f2cdc5%40googlegroups.com?utm_medium=email_source=footer>.

For more options, visit https://groups.google.com/d/optout.



--
--
Anthony Flury
email : *anthony.fl...@btinternet.com*
Twitter : *@TonyFlury <https://twitter.com/TonyFlury/>*

--
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/97139e2f-b293-141d-bbf6-a52a15ed084b%40btinternet.com.
For more options, visit https://groups.google.com/d/optout.


Re: While going through django tutorial i found some errors when i tried to execute the python manage.py runserver.The error is attached below:

2018-05-06 Thread 'Anthony Flury' via Django users

It is ForeignKey (capital K).

In your files you sent you missed the one file it was actually 
complaining about :




On 06/05/18 18:09, Avitab Ayan Sarmah wrote:

index.html:

{% if latest_question_list %}
  
  {% for question in latest_question_list %}
    {{
question.question_text }}
  {% endfor %}
  
{% else %}
  No polls are available.
{% endif %}

admin.py:


from django.contrib import admin

from . models import Question

admin.site.register(Question)

views.py:

from django.shortcuts import get_object_or_404, render

from . models import Question

def index(request):
latest_question_list = Question.objects.order_by('-pub_date')[:5]
context = {'latest_question_list': latest_question_list}
return render(request, 'polls/index.html', context)

def detail(request, question_id):
question = get_object_or_404(Question, pk=question_id)

def results(request, question_id):
response = "You're looking at the results of question %s."
return HttpResponse(response % question_id)

def vote(request, question_id):
return HttpResponse("You're voting on question %s." % question_id)

detail.html:

{{ question.question_text }}

{% for choice in question.choice_set.all %}
  {{ choice.choice_text }}
{% endfor %}


mysite/polls/urls.py:

from django.urls import path

from . import views

urlpatterns = [
# ex: /polls/
path('', views.index, name='index'),
# ex: /polls/5/
path('/', views.detail, name='detail'),
#ex: /polls/5/results/
path('/results/', views.results, name='results'),
#ex: /polls/5/vote/
path('int:question_id>/vote/', views.vote, name='vote'),
]

mysite/urls.py:

from django.contrib import admin
from django.urls import include, path

urlpatterns = [
path('', include('polls.urls')),
path('admin/', admin.site.urls),
]

Please check the above codes and comment where i've gone wrong
--
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 
<mailto:django-users+unsubscr...@googlegroups.com>.
To post to this group, send email to django-users@googlegroups.com 
<mailto: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/12b0418f-7979-4d07-b827-68b0c227%40googlegroups.com 
<https://groups.google.com/d/msgid/django-users/12b0418f-7979-4d07-b827-68b0c227%40googlegroups.com?utm_medium=email_source=footer>.

For more options, visit https://groups.google.com/d/optout.



--
--
Anthony Flury
email : *anthony.fl...@btinternet.com*
Twitter : *@TonyFlury <https://twitter.com/TonyFlury/>*

--
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/420f69c9-717a-a9c5-9196-3165418c25d0%40btinternet.com.
For more options, visit https://groups.google.com/d/optout.


Re: sphinx is showing the django base views instead of my own views.py

2018-05-05 Thread Anthony Petrillo
Thank you Tony. It is the second option, documenting my code. 

I changed my rst to (note the site name was changed from game to rival5):

views module
==

.. automodule:: rival5.play.views
:members:
:undoc-members:
:show-inheritance:

I have the following added to the path in conf.py:

ourPaths = [
'/rival5/',
'/rival5/rival5',
'/rival5/play',
'/rival5/play/templatetags'
]
for p in ourPaths:
abspath = os.path.abspath('.')  + p
print('path..',abspath)
sys.path.insert(0, abspath)
# Need to point to where the Django is on this system. FIND OUT HOW TO MAKE 
THIS RELATIVE
sys.path.insert(0,'/home/ajp/Downloads/env/lib/python3.5/site-packages')
sys.path.insert(0,'/home/ajp/Downloads/env/lib/python3.5/site-packages/django')

I have __init__.py in all the directories. 

I'm getting this error:

WARNING: 
/home/ajp/ownCloud/CEO/SC/Customers/Rival5/source/rival5/play/views.rst:4: 
(WARNING/2) autodoc: failed to import module 'rival5.play.views'; the 
following exception was raised:
Traceback (most recent call last):
  File "/usr/local/lib/python3.5/dist-packages/sphinx/ext/autodoc.py", line 
658, in import_object
__import__(self.modname)
ImportError: No module named 'rival5.play'

I searched and the recommendation is to be sure to include the path to the 
file in conf.py which I've already done, unless I'm making a mistake. I 
have other code that is not part of the django naming scheme and it works 
fine. 

I'm hoping my mistake is obvious to you. Thanks so much for your time. 



On Friday, May 4, 2018 at 11:25:20 AM UTC-4, Anthony Petrillo wrote:
>
> The view being shown when using Sphinx on a Django site is: 
>
>
> <https://lh3.googleusercontent.com/-IyVWh5gFHgg/Wux2UtHMdTI/XAM/ttdoOJAmaa0PZZSuKxsoEs27EJi45tssACLcBGAs/s1600/HMzGQ.png>
>
>
> The beginning of my views.py is:
>
>
> import os
>
> from django.shortcuts import render, redirect 
>
> from django.urls import reverse 
>
> from django.http import HttpResponse, HttpResponseRedirect 
>
> from django.utils import timezone
>
> from . forms import PlayForm, RollForm, checkBoard, BossForm
>
> from random import randint 
>
> from . templatetags.playExtras import translateDice 
>
> from .models import Board, Winner, Boss
>
>
> def getFirstFolder(req):
>
> """ return the string between first two / - this is a hack, find out 
> how to do it with the object """
>
> r = req.split("'")
>
> loc = r[1].find('/',1)
>
> x = r[1][1:loc]
>
> return(x)
>
>
> def loadBoard(request,context,location=''):
>
> ''' Load the board from the database into context. Add a hyperlink for 
> available squares.
>
>
> :param context: context for template
>
> :type context: dictionary
>
>
> :param location: Comma seperated string of available locations or 
> empty string so no links included.
>
> :type location: str
>
>
> :return: 'not on the board' or 'all taken' or comma seperated string 
> of location options such as 'A0,B0'
>
> :rtype: str
>
> '''
>
> req = request.__str__()
>
> I was getting errors if I didn't show Sphinx where the Python was located. 
> The path additions I made in the Sphinx's conf.py are:
>
> ourPaths = [
> '/game/',
> '/game/game',
> '/game/play',
> '/game/play/templatetags'
> ]
> for p in ourPaths:
> abspath = os.path.abspath('.')  + p
> print('path..',abspath)
> sys.path.insert(0, abspath)
> # Need to point to where the Django is on this system. FIND OUT HOW TO 
> MAKE THIS RELATIVE
> sys.path.insert(0,'/home/ajp/Downloads/env/lib/python3.5/site-packages')
>
> sys.path.insert(0,'/home/ajp/Downloads/env/lib/python3.5/site-packages/django')
>
>
> The views.rst file I'm using: 
>
> views module
> ==
>
> .. automodule:: views
> :members:
> :undoc-members:
> :show-inheritance:
>
> I searched for days but I'm afraid I do not know the right terms search 
> for to find the answer. I posted on stackoverflow for a couple weeks and no 
> responses at all. 
>
> I'm okay with the other code showing up, but I'd need to see my code in 
> the manual as well.
>
> Thank you for any help you can give. 
>

-- 
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/594dab3f-030c-4507-85a1-3c23057dba99%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: sphinx is showing the django base views instead of my own views.py

2018-05-05 Thread 'Anthony Flury' via Django users

Can you be clear what you are trying to do ?

Did you want your Sphinx Page to display an alternative Django 
documentation - i.e. a module reference for Django ?


Or did you want your Sphinx Page to document your app  - if so the issue 
is that your rst just calls for the views module - and that is the one 
in sys.path (i.e. Django); if you want the views.py from your app - your 
rst has to reference the full dotted path to the views module :


   views module
   ==

   .. automodule:: site.app.views
    :members:
    :undoc-members:
    :show-inheritance:





On 04/05/18 16:09, Anthony Petrillo wrote:


The view being shown when using Sphinx on a Django site is:

<https://lh3.googleusercontent.com/-IyVWh5gFHgg/Wux2UtHMdTI/XAM/ttdoOJAmaa0PZZSuKxsoEs27EJi45tssACLcBGAs/s1600/HMzGQ.png>


The beginning of my views.py is:


import os

from django.shortcuts import render, redirect

from django.urls import reverse

from django.http import HttpResponse, HttpResponseRedirect

from django.utils import timezone

from . forms import PlayForm, RollForm, checkBoard, BossForm

from random import randint

from . templatetags.playExtras import translateDice

from .models import Board, Winner, Boss


def getFirstFolder(req):

    """ return the string between first two / - this is a hack, find 
out how to do it with the object """


    r = req.split("'")

    loc = r[1].find('/',1)

    x = r[1][1:loc]

    return(x)


def loadBoard(request,context,location=''):

    ''' Load the board from the database into context. Add a hyperlink 
for available squares.



    :param context: context for template

    :type context: dictionary


    :param location: Comma seperated string of available locations or 
empty string so no links included.


    :type location: str


    :return: 'not on the board' or 'all taken' or comma seperated 
string of location options such as 'A0,B0'


    :rtype: str

    '''

    req = request.__str__()


I was getting errors if I didn't show Sphinx where the Python was 
located. The path additions I made in the Sphinx's conf.py are:


ourPaths = [
    '/game/',
    '/game/game',
    '/game/play',
'/game/play/templatetags'
    ]
for p in ourPaths:
    abspath = os.path.abspath('.')  + p
print('path..',abspath)
    sys.path.insert(0, abspath)
# Need to point to where the Django is on this system. FIND OUT HOW TO 
MAKE THIS RELATIVE

sys.path.insert(0,'/home/ajp/Downloads/env/lib/python3.5/site-packages')
sys.path.insert(0,'/home/ajp/Downloads/env/lib/python3.5/site-packages/django')


The views.rst file I'm using:

views module
==

.. automodule:: views
    :members:
    :undoc-members:
    :show-inheritance:

I searched for days but I'm afraid I do not know the right terms 
search for to find the answer. I posted on stackoverflow for a couple 
weeks and no responses at all.


I'm okay with the other code showing up, but I'd need to see my code 
in the manual as well.


Thank you for any help you can give.
--
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 
<mailto:django-users+unsubscr...@googlegroups.com>.
To post to this group, send email to django-users@googlegroups.com 
<mailto: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/e53d3f68-b008-4d4a-a9bd-74d1af57337c%40googlegroups.com 
<https://groups.google.com/d/msgid/django-users/e53d3f68-b008-4d4a-a9bd-74d1af57337c%40googlegroups.com?utm_medium=email_source=footer>.

For more options, visit https://groups.google.com/d/optout.



--
--
Anthony Flury
email : *anthony.fl...@btinternet.com*
Twitter : *@TonyFlury <https://twitter.com/TonyFlury/>*

--
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/f212f060-53c7-162f-3dd7-8520b771fd63%40btinternet.com.
For more options, visit https://groups.google.com/d/optout.


Re: I got error when working on "Writing your first Django app, part 5" of tutorial

2018-05-05 Thread 'Anthony Flury' via Django users
ROOT_URLCONF ideally point to the top level project urls.py if you have 
one - if you point it to an app's urls.py - you have to them make sure 
you link that app back to all the other (which sort of defeats the point 
of the app) - and make sure that something you refers forward to the 
admin urls.


It is better to point it too the top level urls.py.

'django-admin startproject blah' builds a default : ROOT_URL_CONF = 
'blah.urls' which should be sufficient unless you are doing something odd.


On 04/05/18 17:28, brzrkr wrote:
It seems you need to point your Django project to your urls.py file. 
See: https://docs.djangoproject.com/en/2.0/ref/settings/#root-urlconf
This should point to your urls.py file, the file containing the 
`urlpatterns` variable, which is a list of `path()` statements.
For example if your urls.py file is in `/myapp/urls.py`, in your 
settings.py you should write: `ROOT_URLCONF = myapp.urls`.


On Friday, 4 May 2018 15:13:08 UTC+2, truongtronghai wrote:

When I run below command
>>> response = client.get('/')
I got error "module 'django.conf.global_settings' has no attribute
'ROOT_URLCONF'"

Please give me advice to solve it. 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 
<mailto:django-users+unsubscr...@googlegroups.com>.
To post to this group, send email to django-users@googlegroups.com 
<mailto: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/22414d59-c59b-4528-8bdb-9bccf351e5b7%40googlegroups.com 
<https://groups.google.com/d/msgid/django-users/22414d59-c59b-4528-8bdb-9bccf351e5b7%40googlegroups.com?utm_medium=email_source=footer>.

For more options, visit https://groups.google.com/d/optout.



--
--
Anthony Flury
email : *anthony.fl...@btinternet.com*
Twitter : *@TonyFlury <https://twitter.com/TonyFlury/>*

--
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/f82b9b47-baf0-4398-d688-56bc1527d9e7%40btinternet.com.
For more options, visit https://groups.google.com/d/optout.


sphinx is showing the django base views instead of my own views.py

2018-05-04 Thread Anthony Petrillo


The view being shown when using Sphinx on a Django site is: 




The beginning of my views.py is:


import os

from django.shortcuts import render, redirect 

from django.urls import reverse 

from django.http import HttpResponse, HttpResponseRedirect 

from django.utils import timezone

from . forms import PlayForm, RollForm, checkBoard, BossForm

from random import randint 

from . templatetags.playExtras import translateDice 

from .models import Board, Winner, Boss


def getFirstFolder(req):

""" return the string between first two / - this is a hack, find out 
how to do it with the object """

r = req.split("'")

loc = r[1].find('/',1)

x = r[1][1:loc]

return(x)


def loadBoard(request,context,location=''):

''' Load the board from the database into context. Add a hyperlink for 
available squares.


:param context: context for template

:type context: dictionary


:param location: Comma seperated string of available locations or empty 
string so no links included.

:type location: str


:return: 'not on the board' or 'all taken' or comma seperated string of 
location options such as 'A0,B0'

:rtype: str

'''

req = request.__str__()

I was getting errors if I didn't show Sphinx where the Python was located. 
The path additions I made in the Sphinx's conf.py are:

ourPaths = [
'/game/',
'/game/game',
'/game/play',
'/game/play/templatetags'
]
for p in ourPaths:
abspath = os.path.abspath('.')  + p
print('path..',abspath)
sys.path.insert(0, abspath)
# Need to point to where the Django is on this system. FIND OUT HOW TO MAKE 
THIS RELATIVE
sys.path.insert(0,'/home/ajp/Downloads/env/lib/python3.5/site-packages')
sys.path.insert(0,'/home/ajp/Downloads/env/lib/python3.5/site-packages/django')


The views.rst file I'm using: 

views module
==

.. automodule:: views
:members:
:undoc-members:
:show-inheritance:

I searched for days but I'm afraid I do not know the right terms search for 
to find the answer. I posted on stackoverflow for a couple weeks and no 
responses at all. 

I'm okay with the other code showing up, but I'd need to see my code in the 
manual as well.

Thank you for any help you can give. 

-- 
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/e53d3f68-b008-4d4a-a9bd-74d1af57337c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: OperationalError

2018-05-03 Thread 'Anthony Flury' via Django users

Django 2.0 docs suggest using reportlab :

https://docs.djangoproject.com/en/2.0/howto/outputting-pdf/

I had some success with : pupeteer - 
http://django-puppeteer-pdf.readthedocs.io/en/latest/ - which works by 
having a CBV type framework - so you subclass a PDF template view - and 
that will autogenerate a PDF for you - you just need to have unique urls 
for the PDFs.




On 03/05/18 13:22, Gerald Brown wrote:


FINALLY. SUCCESS!!! What I ended up doing to correct the problem was 
to drop the whole database (NO RECORDS YET). When I tried to run 
migrations it said there were no changes.  I then had to run 
makemigrations  and migrate  so I am now back 
in business!!!


Now does anyone know of an *easy* way to create PDF documents in Django???

Thanks to all for the suggestions and ideas!!!

On Thursday, May 3, 2018 at 6:13:35 PM UTC+8, Gerald Brown wrote:

I finally discovered what I think is the cause of my problem.
*DJANGO MIGRATIONS ARE NOT WORKING.*On the system that has the
problem is where I made migration to change some of the field
names.  The fields that were not found where the ones that did get
changed but the old unchanged names were still there.  On another
system that is working NONE of the fields names were changed so it
didn't have any unknown fields. Both systems had migrations run
against the model file where some fields had changes made and the
other one NO changes were made and on a third machine all changes
were made.

/Who knows what evil lurks in the heart of the computer? *The
Shadow knows!!!* /


On Wednesday, 02 May, 2018 07:56 AM, Gerald Brown wrote:

I have a Django application that I am having problems with.  In
the Admin page I have 3 sections, ABC, DEF & XYZ. Each has 1
option to "Add/Change".  In 2 of them when I click on the option
it works fine. The third gives me the following error "
*1054, "Unknown column 'xyz_xyz.first_name' in "field list" *The
Exception location is:

*/home/medrec1/.virtualenvs/medrecproj/lib/python3.5/site-packages/*MySQLdb*/connections.py
in query, line 277* On another system (both running the same
code) I was also getting a different error also in
*site-packages/MySQLdb* but I was able correct that by installing
2 DEV packages and then  installing MySQLClient, which I also did on this 
computer.  The other
system does NOT give this error.

Any ideas, suggestions, solutions on how to solve this error and any other 
errors in the Django code?

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
<mailto:django-users+unsubscr...@googlegroups.com>.
To post to this group, send email to
django-users@googlegroups.com <mailto:django-users@googlegroups.com>.
Visit this group at https://groups.google.com/group/django-users
<https://groups.google.com/group/django-users>.
To view this discussion on the web visit

https://groups.google.com/d/msgid/django-users/74790172-8bf5-43b6-9bad-bab68ae11a4a%40googlegroups.com

<https://groups.google.com/d/msgid/django-users/74790172-8bf5-43b6-9bad-bab68ae11a4a%40googlegroups.com?utm_medium=email_source=footer>.
For more options, visit https://groups.google.com/d/optout
<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 
<mailto:django-users+unsubscr...@googlegroups.com>.
To post to this group, send email to django-users@googlegroups.com 
<mailto: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/e17d8d56-d57c-4f3d-ae6f-a004a5beda70%40googlegroups.com 
<https://groups.google.com/d/msgid/django-users/e17d8d56-d57c-4f3d-ae6f-a004a5beda70%40googlegroups.com?utm_medium=email_source=footer>.

For more options, visit https://groups.google.com/d/optout.



--
--
Anthony Flury
email : *anthony.fl...@btinternet.com*
Twitter : *@TonyFlury <https://twitter.com/TonyFlury/>*

--
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/ce2f9885-bb30-3386-0411-b4b022cafca2%40btinternet.com.
For more options, visit https://groups.google.com/d/optout.


Re: Working through the Django tutorial and have run into a problem I cannot figure out. Help would be appreciated. What am I missing here? whenever is search the url "http://127.0.0.1:8000/polls/" th

2018-05-03 Thread 'Anthony Flury' via Django users
ps.com>.
To post to this group, send email to
django-users@googlegroups.com
<mailto:django-users@googlegroups.com>.
Visit this group at
https://groups.google.com/group/django-users
<https://groups.google.com/group/django-users>.
To view this discussion on the web visit

https://groups.google.com/d/msgid/django-users/CAEx5wm7VMMa3C2%3DyWA%3DQu%3DhihJiWujwvoA59Xx4ru59Zdc0UVg%40mail.gmail.com

<https://groups.google.com/d/msgid/django-users/CAEx5wm7VMMa3C2%3DyWA%3DQu%3DhihJiWujwvoA59Xx4ru59Zdc0UVg%40mail.gmail.com?utm_medium=email_source=footer>.
For more options, visit https://groups.google.com/d/optout
<https://groups.google.com/d/optout>.



-- 
Fidel Leon

fi...@flm.cat <mailto:fi...@flm.cat>
Phone: +34 622 26 44 92
-- 
You received this message because you are subscribed to a topic in

the Google Groups "Django users" group.
To unsubscribe from this topic, visit
https://groups.google.com/d/topic/django-users/5hvN4Lfds-w/unsubscribe
<https://groups.google.com/d/topic/django-users/5hvN4Lfds-w/unsubscribe>.
To unsubscribe from this group and all its topics, send an email
to django-users+unsubscr...@googlegroups.com
<mailto:django-users+unsubscr...@googlegroups.com>.
To post to this group, send email to django-users@googlegroups.com
<mailto:django-users@googlegroups.com>.
Visit this group at https://groups.google.com/group/django-users
<https://groups.google.com/group/django-users>.
To view this discussion on the web visit

https://groups.google.com/d/msgid/django-users/CAHXg%3DN3-8kKboqLD8cFRympuLvtTgj0uh6BxbfMr8FtfyNEojA%40mail.gmail.com

<https://groups.google.com/d/msgid/django-users/CAHXg%3DN3-8kKboqLD8cFRympuLvtTgj0uh6BxbfMr8FtfyNEojA%40mail.gmail.com?utm_medium=email_source=footer>.


For more options, visit https://groups.google.com/d/optout
<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 
<mailto:django-users+unsubscr...@googlegroups.com>.
To post to this group, send email to django-users@googlegroups.com 
<mailto: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/CAEx5wm6dhT3ZLPvKcFObV1Po26w82b3u%3DwFoj7GQm_iYUg2xzw%40mail.gmail.com 
<https://groups.google.com/d/msgid/django-users/CAEx5wm6dhT3ZLPvKcFObV1Po26w82b3u%3DwFoj7GQm_iYUg2xzw%40mail.gmail.com?utm_medium=email_source=footer>.

For more options, visit https://groups.google.com/d/optout.



--
--
Anthony Flury
email : *anthony.fl...@btinternet.com*
Twitter : *@TonyFlury <https://twitter.com/TonyFlury/>*

--
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/4906b240-8140-e303-a41d-1aad98b5cebb%40btinternet.com.
For more options, visit https://groups.google.com/d/optout.


Re: Need help: django-admin.py startproject [projectname] creates directory which I cannot access

2018-05-03 Thread 'Anthony Flury' via Django users

Serves me right for writing code without testing :-(

It of course should be :

            import os
            top_dir = os.path.join(os.getcwd(), 'python_created_me')
            os.makedirs(top_dir)

Glad you have it sorted - and glad it turned out not to be Django ...

On 03/05/18 17:06, Duška Miloradović wrote:

Anthony, I got this:

D:\projectdir>python create_dir.py
Traceback (most recent call last):
  File "create_dir.py", line 2, in 
    top_dir = path.join(os.getcwd(), 'python_created_me')
NameError: name 'path' is not defined

I searched for it through windows explorer again and I actually *found 
it* on this strange location: C:\VTRoot\HarddiskVolume1\projectdir\mysite

Do you have any clue how this happened?
How to make things right? :)

On Thu, May 3, 2018 at 5:08 PM, Anthony Flury 
<anthony.fl...@btinternet.com <mailto:anthony.fl...@btinternet.com>> 
wrote:


On 03/05/18 08:06, Anthony Flury wrote:

On Thursday, 03 May, 2018 03:25 PM, Daisy wrote:

    I tried what you suggested and got this:
    D:\projectdir>python create_dir.py
    Traceback (most recent call last):
      File "create_dir.py", line 1, in 
        from os import mkdirs
    ImportError: cannot import name 'mkdirs'

Sorry - that should be :

            import os
            top_dir = path.join(os.getcwd(), 'python_created_me')
            os.makedirs(top_dir)


Copy that to a python file called '*create_dir.py*' in your
*projectdir* - and run it by this command '*python create_dir.py*'

One you run it you should have a new empty directory called
'python_created_me' - running the comand again should result
in an error.

The reason for doing this is to check that the Python code
that Django is using does work ok.

The other thing you could do is to use the File Manager search to
see if 'my_site' has been created else where on your system


-- 
-- 
Anthony Flury

email : *anthony.fl...@btinternet.com
<mailto:anthony.fl...@btinternet.com>*
Twitter : *@TonyFlury <https://twitter.com/TonyFlury/
<https://twitter.com/TonyFlury/>>*


--
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 
<mailto:django-users+unsubscr...@googlegroups.com>.
To post to this group, send email to django-users@googlegroups.com 
<mailto: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/CAJ0SFUA52autPYk95a9s4t%2BHXzdx-OYgj%3DzLyfynYX9XiM%3D6NQ%40mail.gmail.com 
<https://groups.google.com/d/msgid/django-users/CAJ0SFUA52autPYk95a9s4t%2BHXzdx-OYgj%3DzLyfynYX9XiM%3D6NQ%40mail.gmail.com?utm_medium=email_source=footer>.

For more options, visit https://groups.google.com/d/optout.



--
--
Anthony Flury
email : *anthony.fl...@btinternet.com*
Twitter : *@TonyFlury <https://twitter.com/TonyFlury/>*

--
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/5aeed66b-25ef-200f-22fc-4a0775ea0779%40btinternet.com.
For more options, visit https://groups.google.com/d/optout.


Re: Need help: django-admin.py startproject [projectname] creates directory which I cannot access

2018-05-03 Thread 'Anthony Flury' via Django users

On 03/05/18 08:06, Anthony Flury wrote:

On Thursday, 03 May, 2018 03:25 PM, Daisy wrote:

I tried what you suggested and got this:
D:\projectdir>python create_dir.py
Traceback (most recent call last):
  File "create_dir.py", line 1, in 
    from os import mkdirs
ImportError: cannot import name 'mkdirs'


Sorry - that should be :

            import os
            top_dir = path.join(os.getcwd(), 'python_created_me')
            os.makedirs(top_dir)


Copy that to a python file called '*create_dir.py*' in your 
*projectdir* - and run it by this command '*python create_dir.py*'


One you run it you should have a new empty directory called 
'python_created_me' - running the comand again should result in an error.


The reason for doing this is to check that the Python code that Django 
is using does work ok.


The other thing you could do is to use the File Manager search to see if 
'my_site' has been created else where on your system


--
--
Anthony Flury
email : *anthony.fl...@btinternet.com*
Twitter : *@TonyFlury <https://twitter.com/TonyFlury/>*

--
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/4ae66204-5ad6-dfa4-28f7-d93b671bb7fb%40btinternet.com.
For more options, visit https://groups.google.com/d/optout.


Re: Need help: django-admin.py startproject [projectname] creates directory which I cannot access

2018-05-03 Thread 'Anthony Flury' via Django users

On 03/05/18 06:59, Daisy wrote:

Thank you very much for your reply, and here I my answers:
  * Does the directory show up when you do a *dir* command in 
projectdir ? It does not show up, although it says that there are 2 
directories (see attachment).

Those two directories '.' & '..' are standard in every directory

  * Can you do anything on the *mysite* directory - can you rename it,
    or even delete it ? I can't - system cannot find the file specified.
Very odd - points to a an OS/disk problem to be honest - I am not sure 
Django is doing anything clever.

  * Can you see it in File explorer - No.
  * Can you manually create a directory in your *projectdir* ? - Yes, 
and it is displayed after command *dir*.

  * Can you create a different projectdir - and run *django-admin
    startproject mysite* in there ? - I tried creating it on different 
paths, both on C and D disk, but it was the same behavior.


What can I do now? :)



Have you tried write a small Python application that creates a directory :

 from os import mkdirs
     top_dir = path.join(os.getcwd(), name)
 mkdirs(top_dir)

Copy that to a python file called '*create_dir.py*' in your *projectdir* 
- and run it by this command '*python create_dir.py*'


One you run it you should have a new empty directory called 
'python_created_me' - running the comand again should result in an error.


The reason for doing this is to check that the Python code that Django 
is using does work ok.


--
Anthony Flury
email : *anthony.fl...@btinternet.com*
Twitter : *@TonyFlury <https://twitter.com/TonyFlury/>*


четвртак, 03. мај 2018. 01.08.04 UTC+2, TonyF-UK је написао/ла:

Lets troubleshoot:

  * Does the directory show up when you do a *dir* command in
projectdir ?
  * Can you do anything on the *mysite* directory - can you rename
it,
    or even delete it ?
  * Can you see it in File explorer
  * Can you manually create a directory in your *projectdir* ?
  * Can you create a different projectdir - and run *django-admin
    startproject mysite* in there ?

My gut feeling is that this is a diskdrive/OS type issue - rather
than
Django specific

You may have a corrupted directory - or a bad section of disk; try
the
troubleshooting steps above first.



On 02/05/18 22:09, Daisy wrote:
> I installed django according to provided instructions and I am
trying
> to follow the Django article: Writing your first Django app, part 1
> <https://docs.djangoproject.com/en/2.0/intro/tutorial01/
<https://docs.djangoproject.com/en/2.0/intro/tutorial01/>> but I am
> stuck at Creating a project with command: django-admin startproject
> mysite.
> The problem is that I CAN execute command but when I try to access
> directory with cd mysite I get the message "The system cannot
find the
> path specified." although when I try to execute command
startproject
> again I get the message that it already exists. (see attachment)
> I cannot find new directory via windows explorer neither.
> I have installed django 2.0.5 version and python 3.6.3 (32-bit).
> --
> 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 
> <mailto:django-users+unsubscr...@googlegroups.com >.
> To post to this group, send email to django...@googlegroups.com

> <mailto:django...@googlegroups.com >.
> Visit this group at https://groups.google.com/group/django-users
<https://groups.google.com/group/django-users>.
> To view this discussion on the web visit
>

https://groups.google.com/d/msgid/django-users/c574d479-a1b6-4c20-91ab-208ae42d4996%40googlegroups.com

<https://groups.google.com/d/msgid/django-users/c574d479-a1b6-4c20-91ab-208ae42d4996%40googlegroups.com>

>

<https://groups.google.com/d/msgid/django-users/c574d479-a1b6-4c20-91ab-208ae42d4996%40googlegroups.com?utm_medium=email_source=footer

<https://groups.google.com/d/msgid/django-users/c574d479-a1b6-4c20-91ab-208ae42d4996%40googlegroups.com?utm_medium=email_source=footer>>.

> For more options, visit https://groups.google.com/d/optout
<https://groups.google.com/d/optout>.


-- 
-- 
Anthony Flury

email : *anthon...@btinternet.com *
Twitter : *@TonyFlury <https://twitter.com/TonyFlury/
<https://twitter.com/TonyFlury/>>*

--
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 
<mail

Re: Need help: django-admin.py startproject [projectname] creates directory which I cannot access

2018-05-02 Thread 'Anthony Flury' via Django users

Lets troubleshoot:

 * Does the directory show up when you do a *dir* command in projectdir ?
 * Can you do anything on the *mysite* directory - can you rename it,
   or even delete it ?
 * Can you see it in File explorer
 * Can you manually create a directory in your *projectdir* ?
 * Can you create a different projectdir - and run *django-admin
   startproject mysite* in there ?

My gut feeling is that this is a diskdrive/OS type issue - rather than 
Django specific


You may have a corrupted directory - or a bad section of disk; try the 
troubleshooting steps above first.




On 02/05/18 22:09, Daisy wrote:
I installed django according to provided instructions and I am trying 
to follow the Django article: Writing your first Django app, part 1 
<https://docs.djangoproject.com/en/2.0/intro/tutorial01/> but I am 
stuck at Creating a project with command: django-admin startproject 
mysite.
The problem is that I CAN execute command but when I try to access 
directory with cd mysite I get the message "The system cannot find the 
path specified." although when I try to execute command startproject 
again I get the message that it already exists. (see attachment)

I cannot find new directory via windows explorer neither.
I have installed django 2.0.5 version and python 3.6.3 (32-bit).
--
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 
<mailto:django-users+unsubscr...@googlegroups.com>.
To post to this group, send email to django-users@googlegroups.com 
<mailto: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/c574d479-a1b6-4c20-91ab-208ae42d4996%40googlegroups.com 
<https://groups.google.com/d/msgid/django-users/c574d479-a1b6-4c20-91ab-208ae42d4996%40googlegroups.com?utm_medium=email_source=footer>.

For more options, visit https://groups.google.com/d/optout.



--
--
Anthony Flury
email : *anthony.fl...@btinternet.com*
Twitter : *@TonyFlury <https://twitter.com/TonyFlury/>*

--
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/77f18454-13a5-4e03-f791-7da59016e379%40btinternet.com.
For more options, visit https://groups.google.com/d/optout.


Re: OperationalError

2018-05-02 Thread 'Anthony Flury' via Django users
At first glance it looks like you haven't applied a migration to this 
computer.


at the command line on this computer  - in the man project directory :

If you have not copied the migration scripts from your development 
machine do this first :


   $ python manage.py makemigrations

and then do this :

   $ python manage.py migrate

--
--
Anthony Flury
email : *anthony.fl...@btinternet.com*
Twitter : *@TonyFlury <https://twitter.com/TonyFlury/>

*On 02/05/18 00:56, Gerald Brown wrote:
I have a Django application that I am having problems with.  In the 
Admin page I have 3 sections, ABC, DEF & XYZ. Each has 1 option to 
"Add/Change".  In 2 of them when I click on the option it works fine. 
The third gives me the following error "
*1054, "Unknown column 'xyz_xyz.first_name' in "field list" *The 
Exception location is: 
*/home/medrec1/.virtualenvs/medrecproj/lib/python3.5/site-packages/*MySQLdb*/connections.py 
in query, line 277* On another system (both running the same code) I 
was also getting a different error also in *site-packages/MySQLdb* but 
I was able correct that by installing 2 DEV packages and then  installing MySQLClient, which I also did on this computer.  The other

system does NOT give this error.

Any ideas, suggestions, solutions on how to solve this error and any other 
errors in the Django code?

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 
<mailto:django-users+unsubscr...@googlegroups.com>.
To post to this group, send email to django-users@googlegroups.com 
<mailto: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/74790172-8bf5-43b6-9bad-bab68ae11a4a%40googlegroups.com 
<https://groups.google.com/d/msgid/django-users/74790172-8bf5-43b6-9bad-bab68ae11a4a%40googlegroups.com?utm_medium=email_source=footer>.

For more options, visit https://groups.google.com/d/optout.



--
--
Anthony Flury
email : *anthony.fl...@btinternet.com*
Twitter : *@TonyFlury <https://twitter.com/TonyFlury/>*

--
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/ee20f787-ae18-f407-de84-b4122d9f304d%40btinternet.com.
For more options, visit https://groups.google.com/d/optout.


Re: Crazy Idea: OOP for "Hyperlink"

2018-04-30 Thread 'Anthony Flury' via Django users
What is wrong with a special type of Field - which is a URL, but also 
have augmented data items which are stored on the model?


As far as I know - there is no rule that states that each 'Field' on a 
model has to have one and only one field in the database. Even if you 
have one and only one field in the database, you could capture augmented 
information about the URL, and store that as a blob field on the model.


The Custom field would also implement the right methods to turn the 
field into html, or even a form.


All possible - the question is how much effort is needed to implement 
and test this custom Field.


--
--
Anthony Flury
email : *anthony.fl...@btinternet.com*
Twitter : *@TonyFlury <https://twitter.com/TonyFlury/>*

On 30/04/18 08:24, guettli wrote:



Am Donnerstag, 26. April 2018 15:54:31 UTC+2 schrieb Matthew Pava:

I’ve been thinking about your idea, and I wonder if there could
instead be some kind of widget for URL objects (or views).


A widget ... Let me think about it. A widget is a libray, is source code.
The code needs some data to operate on.
Where should the data come from? Where should I store the data?
What kind of data/input does the widget need?

I have no clue
--
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 
<mailto:django-users+unsubscr...@googlegroups.com>.
To post to this group, send email to django-users@googlegroups.com 
<mailto: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/fd48e249-9d57-43f5-87e4-09bed383af62%40googlegroups.com 
<https://groups.google.com/d/msgid/django-users/fd48e249-9d57-43f5-87e4-09bed383af62%40googlegroups.com?utm_medium=email_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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/ba738bb9-dfd7-b865-f486-a308f7b30bc6%40btinternet.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django--Making query use part of the matching name

2018-04-28 Thread 'Anthony Flury' via Django users
What are the rules - you say that a query string of '10FTK' should match 
'10FTH86RSK', but also '10FTK', '10F6TK', '10FTK4'


I think the problem is that the rules aren't 100% clear.

 * For '10FTK' to match '10FTH' you actually only care about the
   first 4 characters ?
 * For '10FTK' to match '10FTK...' implies you care about the first 5
 * For '10FTK' to match '10F6TK...' implies you care about your 5
   characters with an option numeric inserted after char 3 ?

so - should it match '106FTK ...' or '10TFK' or '10F99TK'

I can suggest a few strategies :

 * With English spelling it is not common for a knowledgable to get the
   first letter wrong - so you could find that the user will know they
   want '10...' and that the 'FTK' bit might be mis-remembered - so
   search on the first two characters only.
 * Use the entered code to build a more fuzzy search - so 10FTK becomes
   something like r'10*F.*T.*(K|H)' (for instance starting with the
   characters '10' and looking for FTK or FTH with possible intervening
   options.
 * Typically long code words are difficult to remember - - is it
   possible that '10FTH86RSK' actually represents a concept that can be
   categorized and described in English - for instance rather than try
   to implement a fuzzy search for the code, you actually provide a
   user friendly categorization drill down; so the user works down a
   tree of specific natural language descriptions - which internally
   builds the code '10FTH86RSK'

On Apr 25, 2018, at 5:13 PM, shawn...@gmail.com 
<mailto:shawn...@gmail.com> wrote:



Hello everyone!

Currently I am working on Django.

I defined a 'Search' function in views.py:

def search(request):
 q = request.GET.get("q")
 if q:
 ReactResul = Reactionsmeta.objects.filter(id__contains=q)
 MetaResul = Metabolites.objects.filter(id__contains=q)
 GeneResul = Genes.objects.filter(id__contains=q)

 else:
 # you may want to return Customer.objects.none() instead 
ReactResul= Reactionsmeta.objects.all()
 GeneResul = Genes.objects.all()
 MetaResul = Metabolites.objects.all()
 context =dict(result_1=MetaResul, q=q, result_2=ReactResul, result_3 = 
GeneResul)
 return render(request, "Recon/search.html", context)

And now I want to make it more powerful.

If I want to search '10FTH86RSK' but I cannot remember the whole 
name, I can just use part of the string to make query. For example, 
if I type '10FTK', '10FTH86RSK' should be returned as result.
In that case, '10FTK', '10F6TK' or '10FTK4' should also be returned 
as results.


So how could I achieve this function?
--
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 
<mailto:django-users+unsubscr...@googlegroups.com>.
To post to this group, send email to django-users@googlegroups.com 
<mailto: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/793b8999-cac4-4c2d-94cc-eabb80f4e702%40googlegroups.com 
<https://groups.google.com/d/msgid/django-users/793b8999-cac4-4c2d-94cc-eabb80f4e702%40googlegroups.com?utm_medium=email_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 
<mailto:django-users+unsubscr...@googlegroups.com>.
To post to this group, send email to django-users@googlegroups.com 
<mailto: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/9EC3A76F-EE60-47DC-B4DD-9092D8321EC1%40gmail.com 
<https://groups.google.com/d/msgid/django-users/9EC3A76F-EE60-47DC-B4DD-9092D8321EC1%40gmail.com?utm_medium=email_source=footer>.

For more options, visit https://groups.google.com/d/optout.



--
--
Anthony Flury
email : *anthony.fl...@btinternet.com*
Twitter : *@TonyFlury <https://twitter.com/TonyFlury/>*

--
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/4e24ffcd-a098-14f7-db47-d235fdb65002%40btinternet.com.
For more options, visit https://groups.google.com/d/optout.


Re: Crazy Idea: OOP for "Hyperlink"

2018-04-25 Thread 'Anthony Flury' via Django users
Interestingly, I am thinking on something similar too - having a 
report/notifications/actions view that have an auto generated URL. The 
idea (on my concept) is that by getting this unique URL via email, a 
user can access the report/action without needing to actually login - 
the fact that a user accesses the url is authenticaton - it could 
optionally require a password, since the userid is effectively part of 
the URL


My thoughts :

Either a specific

   A Notification/Report Model where one of the fields will be the
   unique URL id
    An incoming URL with the right path would search for the
   notification model with the extracted URL id
    My views would search my models for the incoming Id, and
   confirm expected users, permissions etc.
    I would only have one view that needs this so my specific
   solution would be highly specific


Or a  generic solution

   A model for URLs and that model can have a one to one or one to one
   to many relationship with other models; clearly this relationship is
   dynamic so - I see this :

   In the Model :

   from hrefgeneric.models import HRefModel

   class Notification(models.Model)
    href = models.OneToOne(HRefModel, ...)
    ...

   In the views

   from hrefgeneric.views import HRefRequiredMixin

   class NotificationView(HRefRequiredMixin, View):
    class HREFRequired:
        login_url = '/login/'
        redirect_field_name='redirect_to'
        user_name_field = 'username'

     def get(self, HRef):
                # HRef is now the HRef instance relevant to the
   incoming request (not just any text extracted from the URL
                      pass
       def post(self, HRef):
                # HRef is now the HRef instance relevant to the
   incoming request (not just any text extracted from the URL
                      pass


   If login_url is set to anything truthy, then the mixin will enforce
   some form of authentication form, with 'user_name_field' set to the
   expected user name of the HRef (assuming the expected user on the
   HRef is not None).

   For the generic solution it would be great if there a decorator for
   non class based views which does something similar.

    The HRef instance needs the following fields

        field_name =  # The name of any URL field that 
this HREF should be matched on
        field_value =  # The value that the above field 
should have for this HREF
            user =  # The user that is allowed to 
access this HREF - can be None
            group =  # The permission Group that the 
user - can be None
            permission =  # One or more permissions that 
the user - can be None


    On creation, field_name & field_value must be set

    Example:
          a pattern like this :
           path('/notification/', my_view)

      and a href instance :
                HRef(field_name='id', field_value='aabbccddeeff')

     would match against an incoming path of
                http://host/notification/aabbccddeeff

    It might be that we need to match multiple fields on a url - not 
sure how we do this.


I would happily contribute to an Django appropriate plugin etc - it 
seems like there is a lot of commonality between the use cases.


--
Anthony Flury
email : *anthony.fl...@btinternet.com*
Twitter : *@TonyFlury <https://twitter.com/TonyFlury/>*


On 25/04/18 09:30, guettli wrote:

Thank Adrien for sharing your knowledge.

Our use cases have some parts that are common and some
parts that are distinct.

You want actions, I want static attributes.

You define them on the model.

I use URLs. In my case sometimes there is a 1:1 relationship between 
URL and model,

but sometimes not.

In my use case I have reports. I want a report to have a preview html 
snippet.


There are N reports (N URLs) for one model.

But I think there are more common things than distinct things.

One URL can have N attributes.

Some are actions, some static ones.

Where these attributes come from is a different topic.

If the URL  represents a model, the attributes (in your case 
"actions") of the model

can be propagated up to the URL.

I  hope you undestand what I wrote. If not, then tell me.

Up to now these are just basic thoughts. I won't do any coding
during the next days. If someone likes this idea and implements it,
please let me know. I am always curious.

Regards,
  Thomas



Am Montag, 23. April 2018 12:22:32 UTC+2 schrieb Adrien Cossa:

Hi,

On 04/23/2018 10:59 AM, guettli wrote:

I have a vague idea to use OOP for a hyperlink.

A hyperlink has these attributes for me:

- href
- verbose name
- Permission: Is the current user allowed to follow the link?
- Preview (on-mouse-over tooltip)


We have developed something similar in the company I work for. The
use case is not exactly the same 

Re: tutorial01 is not working

2018-04-24 Thread 'Anthony Flury' via Django users
The debug suggest that it only tried to match the admin pattern but 
nothing else,


that sugggests to me that you missed this bit in the mysite/urls.py

   from django.contrib import admin
   from django.urls import include, path

   urlpatterns = [
    path('polls/', include('polls.urls')),
    path('admin/', admin.site.urls),
   ]

You notice that this now has two patterns - 'polls' and 'admin', but 
your debug message didn't mention trying the 'polls/' pattern, which 
suggests that the 'polls/' bit is missing from this file.


To help you debug this sort of thing in future - a quick tutorial might help

 * When Django gets a request for a URL, then it checks the project
   'urls.py' first - it is expected that the project 'urls.py' will
   contain a list of specific urls for the project, and then will
   include the 'urls.py' for the various apps within the project.
 * If Django is unable to find a match for the url provided - and DEBUG
   is TRUE then Django will tell you what paths it tried to match on -
   so it will list everything in the project 'urls.py' and then the
   patterns from any app 'urls.py' if it finds a match - and so on.
 * So for instance with the correct project 'urls.py' and the polls
   'url.py' as given in the tutorial, if you tried to get a url of :
   'http://localhost:8000/polls/python' - you would get a DEBUG message
   something like :

   Page not found (404)
   Request Method:  GET
   Request URL: http://127.0.0.1:8000/polls/

   Using the URLconf defined in mysite.urls, and polls.urls Django tried 
these URL patterns, in this order:

admin/
polls/

 The current path, polls/python, didn't match any of these.

   Django has matched the 'polls' bit of the URL with the 'polls'
   pattern in 'mysite/urls.py', it will now try to match the python
   bit of the URL within the 'polls/url.py' - but of course wont be
   able to, because that 'urls.py' only has a blank pattern.

--
Tony

On 23/04/18 15:43, aljomaih...@live.com wrote:

hi. i'm new to django dev. so i'm following the tutorial at 
https://docs.djangoproject.com/en/2.0/intro/tutorial01/

i copied and pasted the code samples so as not to introduce typing mistakes. everything 
works fine until i reached the "polls" section. i get below errors:

Page not found (404)
Request Method: GET
Request URL:http://127.0.0.1:8000/polls/

Using the URLconf defined in mysite.urls, Django tried these URL patterns, in 
this order:

 admin/

The current path, polls/, didn't match any of these.

You're seeing this error because you have DEBUG = True in your Django settings 
file. Change that to False, and Django will display a standard 404 page.

when i open http://127.0.0.1:8000/polls/

what could be the reason?



--
--
Anthony Flury
email : *anthony.fl...@btinternet.com*
Twitter : *@TonyFlury <https://twitter.com/TonyFlury/>*

--
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/6ebe4d08-9def-d14c-52a9-f4cb88b971a5%40btinternet.com.
For more options, visit https://groups.google.com/d/optout.


Re: ARGPARSE ERROR

2018-04-18 Thread 'Anthony Flury' via Django users

Are you using virtual environments ?

I found an issues where it seemed like part of the standard library was 
missing - and it was due to my virtual environment having an old version 
of the Python 2 binary. Some time in the Python 2.7 lifecycle, there was 
a change as to how the standard library C code modules were included in 
the binary.


If you are using the 'pip' command you are likely to be using the Python 
2 pip - even if you have Python 3.5 installed.


I would :

1. Check if you are using a virtual environment
2. Check the version of Python 2.7 you are using; the latest available
   is 2.7.14
3. If you are using a virtual env and it is out of date (but your
   system wide Python2.7 is ok), you can simply copy the python binary
   over.
4. If both virtual env and System Python are ok - double check your pip
   version, and Django version (although I doubt they are the issue).
5. If your system is out of date - update the system version.

I am not sure the same issue exists with old Python 3 versions - but it 
might be worth ensuring that you up to date versions of Python3.x and 
also 'pip3' which is the Python3 version of pip on systems with both 
Python 2 & Python 3 installed.


Good luck.

--
Anthony Flury
email : *anthony.fl...@btinternet.com*
Twitter : *@TonyFlury <https://twitter.com/TonyFlury/>*

On 12/04/18 20:58, Ankush Sharma wrote:

Hi Babatunde ,
I installed other listed tools ! Here the main concern im talking 
about is Argsparse -

the Progressbar2 3.6.2 requires argparse, which is not installed.
Thanks in advance
Ank





On Thu, 12 Apr 2018 at 20:53, Babatunde Akinyanmi 
<tundeba...@gmail.com <mailto:tundeba...@gmail.com>> wrote:


This is not a django problem. Simply install and upgrade the apps
specified in the error message

On Thu, 12 Apr 2018, 16:03 Ank, <ankush@gmail.com
<mailto:ankush@gmail.com>> wrote:

Hi all,

Iḿ trying to setup Catmaid -
http://catmaid.readthedocs.io/en/stable/. Iḿ receiving this
error when installing requirements.

Progressbar2 3.6.2 requires argparse, which is not installed.
twisted 17.9.0 requires zope.interface>=3.6.0, which is not
installed.
matplotlib 2.1.0 requires backports.functools-lru-cache, which
is not installed.
django-rest-swagger 2.1.2 has requirement
djangorestframework>=3.5.4, but you'll have
djangorestframework 3.5.3 which is incompatible



 How it can be resolved ?

Best
Ank
-- 
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
<mailto:django-users+unsubscr...@googlegroups.com>.
To post to this group, send email to
django-users@googlegroups.com
<mailto: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/1fb16f72-1837-48f1-a8f6-c7bd64ca212f%40googlegroups.com

<https://groups.google.com/d/msgid/django-users/1fb16f72-1837-48f1-a8f6-c7bd64ca212f%40googlegroups.com?utm_medium=email_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
<mailto:django-users+unsubscr...@googlegroups.com>.
To post to this group, send email to django-users@googlegroups.com
<mailto: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/CA%2BWjgXMHx_zdBtc_NG%2Bn1JMfi4oxTPHy_1y2Pw75VpxfX%2BxuqA%40mail.gmail.com

<https://groups.google.com/d/msgid/django-users/CA%2BWjgXMHx_zdBtc_NG%2Bn1JMfi4oxTPHy_1y2Pw75VpxfX%2BxuqA%40mail.gmail.com?utm_medium=email_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 
<mailto:django-users+unsubscr...@googlegroups.com>.
To post to this group, send email to django-users@googlegroups.com 
<mailto: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/CAALW

Re: Verify Emails

2018-04-07 Thread 'Anthony Flury' via Django users

why not use an email validator provided by Django ?

https://docs.djangoproject.com/en/2.0/ref/validators/#emailvalidator

The problem with the pypi module is that to validate that an email 
exists it simply looks for server in DNS (which is slightly better than 
the Django validator), but that doesn't mean that the :


 * Email server will accept emails from you - or your service
 * or that the user exists on that server ( even if the server exists).

The only real way to validate that an email server is entirely valid is 
to send an email to it, asking for a reply. Email parsing will only go 
so far.


In theory there is a defined protocol to allow clients to  query email 
servers for is valid email addresses - but most servers are set to 
ignore those requests - for obvious reasons.



--
Anthony Flury
email : *anthony.fl...@btinternet.com*
Twitter : *@TonyFlury <https://twitter.com/TonyFlury/>*

On 07/04/18 08:31, Samuel Muiruri wrote:
There's a python package for validating emails exists 
"validate_emails" https://pypi.python.org/pypi/validate_email think it 
would be useful to include it's features inside django so you can 
parse if emails exists before sending so you only send emails to those 
emails that *do *exists and also use it to get back those that don't 
so you can remove them from your list like dummy emails provided to 
your subscription page.


--
Best Regards,
Samuel Muiruri.
Student in Machine Learning & a veteran web developer.

<https://www.avast.com/sig-email?utm_medium=email_source=link_campaign=sig-email_content=webmail_term=icon> 
	Virus-free. www.avast.com 
<https://www.avast.com/sig-email?utm_medium=email_source=link_campaign=sig-email_content=webmail_term=link> 



--
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 
<mailto:django-users+unsubscr...@googlegroups.com>.
To post to this group, send email to django-users@googlegroups.com 
<mailto: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/CAJZFZXqyb9LQEmU_DHy1QToA6y1tmq3vwDBq28X%3DLYDxZgdstw%40mail.gmail.com 
<https://groups.google.com/d/msgid/django-users/CAJZFZXqyb9LQEmU_DHy1QToA6y1tmq3vwDBq28X%3DLYDxZgdstw%40mail.gmail.com?utm_medium=email_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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/b2ad280e-fac2-f95f-d860-194a3046e6c8%40btinternet.com.
For more options, visit https://groups.google.com/d/optout.


Re: why when using the tag AMP or ⚡, the server django load four times or more, and when deleting this tag only load one time? I need help

2017-08-13 Thread ANTHONY WAINER


El sábado, 12 de agosto de 2017, 5:49:05 (UTC-5), ANTHONY WAINER escribió:
>
>
> <https://lh3.googleusercontent.com/-SmvLD8obKaI/WY6b4NfqoEI/Czc/phOuO0pVVLg04CG5G7BEaWTAZS4WmqGLwCLcBGAs/s1600/Captura.PNG>
>  
> <https://lh3.googleusercontent.com/-bTNJztkxw8Q/WY6cMSx2eLI/Czg/Mlh1u7GD12QiL7mNbNBNZnCSI9FD-galgCLcBGAs/s1600/Captura.PNG>
>
>
>
>

-- 
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/c8470ba6-27dc-4f17-880e-01cee1a14687%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


why when using the tag AMP or ⚡, the server django load four times or more, and when deleting this tag only load one time? I need help

2017-08-12 Thread ANTHONY WAINER



 




-- 
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/3fe9b5e8-c847-4669-a010-9d1311c43077%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Yet Another Can't get static files to show up in shared linux website on Godaddy

2017-04-10 Thread Anthony Percy
Hi all,
Sorry to ask this question but I cant get my static files in Mezzanine to 
show up on a Godaddy hosted site e.g http://www.murraybridge.co
I have had to use "pip install flup" and "pip install django-fastcgi-server" 
as Godaddy seems to have the fcgi module active on the apache webserver 
which I understand is now deprecated.
The .htaccess file is in ~/public_html is ;

AddHandler fcgid-script .fcgi
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ mezproject.fcgi/$1 [QSA,L]

My "mezproject.fcgi" file in ~/public_html is;

*#!/home/vk2acp/code/mez/bin/python*
*import sys, os*
*# Add a custom Python path.*
*sys.path.insert(0, "/home/vk2acp/code/mezproject")*
*# Switch to the directory of your project. (Optional.)*
*os.chdir("/home/vk2acp/code/mezproject")*
*# Set the DJANGO_SETTINGS_MODULE environment variable.*
*os.environ['DJANGO_SETTINGS_MODULE'] = "mezproject.settings"*
*from django_fastcgi.servers.fastcgi import runfastcgi*
*from django.core.servers.basehttp import get_internal_wsgi_application*
*wsgi_application = get_internal_wsgi_application()*
*runfastcgi(wsgi_application, method="prefork", daemonize="false", 
minspare=1, maxsp*
*are=1, maxchildren=1)*

The "static" dir exists in the mezproject dir after I did "python manage.py 
collectstatic"
I have tried copying  static dir to the public_html dir with no effect.
Obviously I cant add the "Alias" directive as I have no control over the 
http.conf file.
It seems a pity to get this far and run into this brick wall!!!
Do I have to run the whole mez project from the public_html dir???
Any suggestions?

Best Regards

Anthony

-- 
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/a38ab714-1903-4c92-a5d0-0b1455c29a75%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


DJANGO TUTORIAL

2016-03-21 Thread Anthony W Smith
When I follow django tutorial on the django site for the polls app I keep 
getting the error after runnig the python manage.py runserver command it 
says no modsule named my site.  Please help
Anthony

-- 
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/ac171014-6e1b-4a93-bf07-daa90f2d6475%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django Newbie - Tutorial Recommendations?

2016-03-19 Thread Anthony W Smith


On Friday, March 18, 2016 at 8:31:56 AM UTC-4, Santosh Srinivas wrote:
>
> Hi Folks,
>
> I'm new to both Python and Django.
> I am looking for high quality video tutorials on Django and Python from 
> your experience (paid is also fine).
>
> Please advise.
>
> Thank you.
> Santosh
>

-- 
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/4a7a68f0-dab1-4901-bcb0-8702b9758f7a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: VIdeo Lectures ?

2015-06-03 Thread Anthony Crawford
Codingforentrepreneurs.com

On Monday, October 6, 2014 at 8:08:20 AM UTC-6, rishabh yadav wrote:
>
> Can anyone of u suggest me any good video tutorials for django ?
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To 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/e4a352b6-ce44-48dd-a56d-876b9d4f4d16%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Turn off migrations completely in Django 1.7

2014-09-19 Thread Anthony Tuininga
Hmm, the problem is that there doesn't appear to be any way to turn off the 
creation of the migrations table itself, even if all of the other models 
are set to managed=False as suggested by Nikolas. I've commented it out for 
now but it would be ideal to have some way of turning it off completely -- 
or simply doing nothing if there are no managed models.

On Thursday, September 18, 2014 5:27:45 PM UTC-6, mike wrote:
>
> Hi, 
>
> I feel your pain, but I think you can utilize something with --fake 
>
> I have been using databases for many, many years, and honestly- 
> migrations definitely make sense. I am able to add new fields within a 
> few seconds without having to do any extra work. It takes 2 minutes to 
> learn how to use migrations, and I will personally never look back. 
>
> Mike 
>
>
>
> On Thu, Sep 18, 2014 at 5:04 PM, Anthony Tuininga 
> <anthony@gmail.com > wrote: 
> > Hi, 
> > 
> > I just upgraded my test environment to Django 1.7 and immediately 
> noticed 
> > that mgirations appear to be a requirement. Searching the documentation 
> and 
> > the code itself seems to indicate that there is no way to disable it, 
> > either. Did I miss something? I don't need or want Django to create or 
> alter 
> > any database objects and up to Django 1.6 I could quite happily ignore 
> > syncdb but it seems I can't ignore migrations. Please advise! Thanks. 
> > 
> > Anthony 
> > 
> > -- 
> > 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/9bdd258f-a21b-48a0-ab1b-b3a4123b40c1%40googlegroups.com.
>  
>
> > 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/1b63e451-15bd-46be-bd93-2a8bca9d3780%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Turn off migrations completely in Django 1.7

2014-09-18 Thread Anthony Tuininga
Hi,

I just upgraded my test environment to Django 1.7 and immediately noticed 
that mgirations appear to be a requirement. Searching the documentation and 
the code itself seems to indicate that there is no way to disable it, 
either. Did I miss something? I don't need or want Django to create or 
alter any database objects and up to Django 1.6 I could quite happily 
ignore syncdb but it seems I can't ignore migrations. Please advise! Thanks.

Anthony

-- 
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/9bdd258f-a21b-48a0-ab1b-b3a4123b40c1%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django Queryset with filtering on reverse foreign key failing

2014-07-31 Thread Anthony
Could not resolve tblconfigagentgroupmembers.

I've resolved the issue now though. I moved the model to models.py from the
models_auto.py file and was then getting some validation errors mostly
missing id fields(just set primary keys on the generated models) and now
it's working as expected.


On Fri, Aug 1, 2014 at 12:18 AM, <cmawebs...@gmail.com> wrote:

> What does the FieldError say?
>
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "Django users" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/django-users/RtlHbhnTfro/unsubscribe.
> To unsubscribe from this group and all its topics, 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/4bba252c-1690-4eab-b1e8-62cb674aa151%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/4bba252c-1690-4eab-b1e8-62cb674aa151%40googlegroups.com?utm_medium=email_source=footer>
> .
>
> For more options, visit https://groups.google.com/d/optout.
>



-- 
Anthony Hawkes
E-Mail: lifesillus...@gmail.com
Ph: 0400 372 260

-- 
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/CABqJoT2hy70rcEvhxWovejjO4RT95WF9rZHeBoJ9Na-UxWDShg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Django Queryset with filtering on reverse foreign key failing

2014-07-24 Thread Anthony Hawkes


Hi All,

I'm currently using a MSSQL DB to access some data and am using django's 
inspectdb results. I've had to tweak some of the model but so far things 
have been smooth sailing. Today I needed to run a lookup that spanned 
through some tables forward and reverse and tested the following in shell 
which worked fine:

>python manage.py shellfrom db_ccmdata.models_auto import 
>TbldataAgentperformancebyperiod as agent_performance
agent_performance.objects.filter(fkagent__tblconfigagentgroupmembers__fkagentgroup__name="IT
 Call Centre Immediate")

When I implemented this in my code I started getting a FieldError and am 
confused as hell.

agent_queue = agent_performance.objects.filter(
midnightstartdate__range=(date + ' 00:00:00', date + ' 
23:59:59')).filter(fkagent__tblconfigagentgroupmembers__fkagentgroup__name='IT 
Call Centre Immediate').order_by('fktimeinterval')

I've checked the relationships are all okay but the perplexing thing is 
that it works in shell as expected.

the relationship is

tbldataagentperformancebyperiod *agentfk* -> *pkey* tblconfigagent *pkey*
 <- *agentfk*tblconfigagentgroupmembers *groupfk* -> *pkey* tblconfiggroup

I'm not sure if it's relevant but doing ./manage.py no longer works and 
manage.py returns ": No such file or directory" (it's definitely 
manage.py/python returning this) so I've been calling it with python 
manage.py etc


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 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/6061aae0-996b-485c-a971-684cf237b25d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django case, when, then on querysets

2014-05-14 Thread Anthony
But a query isn't run until I actually do something with the object, by
loading it into memory by accessing or iterating over a queryset I'm
performing potential time consuming operations. Isn't it better to do
whatever work I can on the database? In some cases I could be doing
something similar for thousands of records, surely this wouldn't be
effective? Or am I simply overestimating the effort required for Python to
work with the results?


On Thu, May 15, 2014 at 4:14 AM, Daniel Roseman <dan...@roseman.org.uk>wrote:

> On Wednesday, 14 May 2014 01:20:39 UTC+1, Anthony Hawkes wrote:
>>
>> Thanks for the answer! Do you think it would be practical to let the orm
>> generate the base query and then doing a replace on the column name? I was
>> thinking of this approach as a custom manager method to return a raw result.
>>
>> This would allow me the generate a case statement for the column and I
>> could dynamically create it.
>>
>> Ant
>>
> You're thinking of this in the wrong way. Do you really need this data to
> be generated by the database in the query? Once the original values are out
> of the db and made into Python objects, you've got a whole powerful
> object-orientated language available to you to do whatever transformations
> you need on the data, ie Python. And you needn't do it at a queryset level:
> each of the elements of the queryset is a model instance, and in the
> process of accessing any of the values of those instances you're
> necessarily interacting with the model object, so you can simply add
> instance methods and call those instead of the original attributes.
> --
> DR.
>
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "Django users" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/django-users/ZuSxc3YXA3c/unsubscribe.
> To unsubscribe from this group and all its topics, 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/fb2374d5-c928-4322-a0f0-517c24586eb6%40googlegroups.com<https://groups.google.com/d/msgid/django-users/fb2374d5-c928-4322-a0f0-517c24586eb6%40googlegroups.com?utm_medium=email_source=footer>
> .
>
> For more options, visit https://groups.google.com/d/optout.
>



-- 
Anthony Hawkes
E-Mail: lifesillus...@gmail.com
Ph: 0400 372 260

-- 
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/CABqJoT0hL3U_Rt39x_wAMA%3Dtd68o8UrwkA2qJhZxT4%2BfNDDZPQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django case, when, then on querysets

2014-05-13 Thread Anthony
Thanks for the answer! Do you think it would be practical to let the orm
generate the base query and then doing a replace on the column name? I was
thinking of this approach as a custom manager method to return a raw result.

This would allow me the generate a case statement for the column and I
could dynamically create it.

Ant
On 14/05/2014 7:25 AM, "Tom Evans" <tevans...@googlemail.com> wrote:

> On Tue, May 13, 2014 at 11:04 PM, Anthony <lifesillus...@gmail.com> wrote:
> > Basically when a queryset like
> > instance.annotate(totals=Count('item_description')[:3] like
> > PC 10
> > Mac 7
> > Mouse 5
> > Keyboard 4
> >
> > I want to combine PC and Mac as say: Desktop so the results become
> >
> > Desktop 17
> > Mac 7
> > Mouse 5
> > Keyboard 4
> > Scanner 3
> >
> > Ant
>
> Ah right I see, for some reason I didn't get the 'CASE WHEN' reference
> in subject, on the same page now.
>
> However, I have to say sorry - this feature isn't in the ORM as far as I
> know.
>
> The ORM isn't supposed to replace SQL for every query, since
> generating a less complex language to replace SQL entirely is an
> exercise in futility - once you have all the features, your new
> language is no less complex than the original. I guess this is one
> such case.
>
> Cheers
>
> Tom
>
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "Django users" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/django-users/ZuSxc3YXA3c/unsubscribe.
> To unsubscribe from this group and all its topics, 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/CAFHbX1%2BFonHK4fuDUSaRbPd6%3DsWDVsisjYs%2BhUMZR7HhA60a2A%40mail.gmail.com
> .
> 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/CABqJoT2fHB7GO88wcxQpuxOQECsxYSf2oH3jrw_QYzWv4dRwvQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django case, when, then on querysets

2014-05-13 Thread Anthony
Basically when a queryset like
instance.annotate(totals=Count('item_description')[:3] like
PC 10
Mac 7
Mouse 5
Keyboard 4

I want to combine PC and Mac as say: Desktop so the results become

Desktop 17
Mac 7
Mouse 5
Keyboard 4
Scanner 3

Ant
On 14/05/2014 4:45 AM, "Tom Evans" <tevans...@googlemail.com> wrote:

> On Tue, May 13, 2014 at 1:00 AM, Anthony Hawkes <lifesillus...@gmail.com>
> wrote:
> > Hi Guys,
> >
> > I need to replace results in a queryset and then perform counts and
> further
> > queries on the set and have been trying to find a way of doing it.
>
> What do you mean by "replace results"?
>
> >
> > Basically in some but not all cases I get a set of results eg select *
> from
> > table and then I want to do a: case when column = 'some value' then 'some
> > other value'.
> >
> > Is there any way using django's queries or at least preserving the
> ability
> > to continue using the queries using raw sql? (I've had a look at extra()
> but
> > can't see a way to make it work)
> >
>
> I'm not really sure what any of this means..
>
> Let me throw some sample code at you
>
> qs = Model.objects.all()
> if foo:
>   qs = qs.filter(column='some value')
> else:
>   qs = qs.filter(column_b='some other value')
> num_results = qs.count()
>
> Is that what you are after?
>
> Cheers
>
> Tom
>
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "Django users" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/django-users/ZuSxc3YXA3c/unsubscribe.
> To unsubscribe from this group and all its topics, 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/CAFHbX1J-NT2R5WxHeS6Qaw_ZjZCn6N4g%3DcP6Ta8gVE3MqsBP7Q%40mail.gmail.com
> .
> 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/CABqJoT2WnE5v7odhPAoYM%3DEURd3u%3D%2BzqF24MQOHKtDbKYX0kcw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Django case, when, then on querysets

2014-05-12 Thread Anthony Hawkes
Hi Guys,

I need to replace results in a queryset and then perform counts and further 
queries on the set and have been trying to find a way of doing it.

Basically in some but not all cases I get a set of results eg select * from 
table and then I want to do a: case when column = 'some value' then 'some 
other value'.

Is there any way using django's queries or at least preserving the ability 
to continue using the queries using raw sql? (I've had a look at extra() 
but can't see a way to make it work)


-- 
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/af24856c-5d0a-45aa-932d-faa56c097bcb%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: if statement in django

2014-04-05 Thread Anthony Smith
thanks now  but getting the following error

File "/home/tony/Documents/stockapp/stock/models.py" in save
  128. self.total_price = self.calc_total_price()
File "/home/tony/Documents/stockapp/stock/models.py" in calc_total_price
  124. amount_price = (self.estimated_total_weight * self.sale_kg)

have attached the code if you have time if not dont worry

def calc_estimated_total_weight(self):
amount = 0
if self.sale_head <= 0:
amount = (self.number * self.estimated_weight_hd)
return amount
def save(self):
self.estimated_total_weight = self.calc_estimated_total_weight()
super(SaleNote, self).save()

def calc_total_price(self):
amount_price = 0
if self.sale_head > 0:
   amount_price = (self.number * self.sale_head)
   return amount_price
else:
amount_price = (self.estimated_total_weight * self.sale_kg)
return amount_price

def save(self):
self.total_price = self.calc_total_price()
super(SaleNote, self).save()

 def __unicode__(self):
return self.buyer

cheers

anthony


On Sun, Apr 6, 2014 at 3:20 PM, Jay Lozier <jsloz...@gmail.com> wrote:

>
> On 04/05/2014 11:08 PM, Anthony Smith wrote:
>
>> Hi
>>
>>
>>
>> I have a small project and I have been unable to get the following
>> statement to work. Any help would great.User inputs can either
>> self_sale_head which is a $ value,if a $ value is not add a
>> self.estimated_weight_hd is used to get the total weight, the code below
>> should return a estimated_weight_total which can be used for the total sale
>> price. All works when I add the estimated_weight_total manually. I am lost
>> as why.
>>
>> |def  calc_estimated_weight_total(self):
>>  if  self.sale_head<=  0:
>>  amount=  (self.number*  self.estimated_weight_hd)
>>  return  amount
>>
>> def  save(self):
>>  self.estimated_total_weight=  self.calc_estimated_weight_total()
>>  super(SaleNote,  self).save()|
>>
>>
>>
>>  Anthony,
>
> In your first function, when the if condition evaluates to False it not
> return anything.
>
> A possible version is:
>
> def calc_estimated_weight_total(self):
> if self.sale_head <= 0:
> amount = self.number * self.estimated_weight_hd
> else:
> amount = 0  # (or your default value or other code to calculate
> amount)
> return amount
>
> Another version
>
> def calc_estimated_weight_total(self):
> amount = 0
> if self.sale_head <= 0:
> amount = self.number * self.estimated_weight_hd
> return amount
>
> Both versions will return a value not matter whether the test condition
> evaluates to True or False. The second version assumes the default value is
> 0
>
> --
> Jay Lozier
> jsloz...@gmail.com
>
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "Django users" group.
> To unsubscribe from this topic, visit https://groups.google.com/d/
> topic/django-users/irveWPRuvCY/unsubscribe.
> To unsubscribe from this group and all its topics, 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/5340E423.2070700%40gmail.com.
> 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/CACJNqTXNbBvLnJAJZ%3DOiDt4npqwvfgHeU4YDX1KZ6Ajp02WRyg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


if statement in django

2014-04-05 Thread Anthony Smith
Hi

   I have a small project and I have been unable to get the following 
statement to work. Any help would great.User inputs can either 
self_sale_head which is a $ value,if a $ value is not add a 
self.estimated_weight_hd is used to get the total weight, the code below 
should return a estimated_weight_total which can be used for the total sale 
price. All works when I add the estimated_weight_total manually. I am lost 
as why.

def calc_estimated_weight_total(self):
if self.sale_head <= 0:
amount = (self.number * self.estimated_weight_hd)
return amount
def save(self):
self.estimated_total_weight = self.calc_estimated_weight_total()
super(SaleNote, self).save()



-- 
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/70bb13fe-c61c-46b6-bd71-5ef2d8ada89a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Making functions callable

2014-03-26 Thread Anthony Hawkes
Thanks Guys, especially Javier! I've spent so much time trawling Google for 
this info!

On Thursday, 27 March 2014 04:57:30 UTC+8, Anthony Hawkes wrote:
>
> Hi Guys,
>
> I'm running into a problem with django(I guess this would also affect 
> Python in general) where if I create a view eg
> def view(year=today.year())
> The year is never re-evaluated until the server is reloaded/restarted
>
> I'm trying to figure out how to make a callable method accessible as a 
> property if this is even possible to try and rectify this(not sure if this 
> is even the correct approach). I've had a look at some magic methods but 
> can't figure it out.
>
> Basically I want to make eg
>
> def year(something):
> return 'blah'
>
> Accessible using object.year as well as object.year()
>
> Any pointers/ideas etc?
>

-- 
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/c02b9898-fbcc-41d3-a982-0b00f06e011f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Making functions callable

2014-03-26 Thread Anthony
Thanks John,

I've yet to test it but I read a few people stating to use lambdas
variables/properties. Is it definitely the case that it will only evaluate
once?

Either way I've embarked on the mission to make methods return as
properties and have found @property decorator to fit my needs, the issue
was I was calling Object.property not ObjectI().property, However I want to
apply this functionality to all my methods and am using:

__getattribute__

def __getattribute__(self, item):
super(DateCalc, self).__getattribute__(item)

But I've run into the problem that my __init__ properties don't seem to be
initialised eg I get
self._date_actual = datetime.strptime("{Y}-{m}-{d}".format(Y=year, m=month,
d=day), self._format_global).date() TypeError: must be string, not None

Anyone have an idea about what's going on?


On Thu, Mar 27, 2014 at 5:07 AM, John DeRosa <jo...@ipstreet.com> wrote:

> For the default value to work as you expect, do this:
>
> def view(request, year=None):
> if year is None:
> year = today.year()
>
>
> Kwarg defaults are evaluated when the module is interpreted for the first
> time.
>
> John
>
>
> On Mar 26, 2014, at 1:57 PM, Anthony Hawkes <lifesillus...@gmail.com>
> wrote:
>
> Hi Guys,
>
> I'm running into a problem with django(I guess this would also affect
> Python in general) where if I create a view eg
> def view(year=today.year())
> The year is never re-evaluated until the server is reloaded/restarted
>
> I'm trying to figure out how to make a callable method accessible as a
> property if this is even possible to try and rectify this(not sure if this
> is even the correct approach). I've had a look at some magic methods but
> can't figure it out.
>
> Basically I want to make eg
>
> def year(something):
> return 'blah'
>
> Accessible using object.year as well as object.year()
>
> Any pointers/ideas etc?
>
> --
> 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/e7adace8-ffc9-4f77-b970-e73bed5ae8e1%40googlegroups.com<https://groups.google.com/d/msgid/django-users/e7adace8-ffc9-4f77-b970-e73bed5ae8e1%40googlegroups.com?utm_medium=email_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>
>
>  --
> You received this message because you are subscribed to a topic in the
> Google Groups "Django users" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/django-users/gcx1oTBAZlA/unsubscribe.
> To unsubscribe from this group and all its topics, 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/FE30EAD3-E463-4379-B11C-970D86703AC3%40ipstreet.com<https://groups.google.com/d/msgid/django-users/FE30EAD3-E463-4379-B11C-970D86703AC3%40ipstreet.com?utm_medium=email_source=footer>
> .
>
> For more options, visit https://groups.google.com/d/optout.
>



-- 
Anthony Hawkes
E-Mail: lifesillus...@gmail.com
Ph: 0400 372 260

-- 
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/CABqJoT1rSB4YeHQHiZH_4KNqMuub1THHyuzAvOCjas_Drz94sg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Making functions callable

2014-03-26 Thread Anthony Hawkes
Hi Guys,

I'm running into a problem with django(I guess this would also affect 
Python in general) where if I create a view eg
def view(year=today.year())
The year is never re-evaluated until the server is reloaded/restarted

I'm trying to figure out how to make a callable method accessible as a 
property if this is even possible to try and rectify this(not sure if this 
is even the correct approach). I've had a look at some magic methods but 
can't figure it out.

Basically I want to make eg

def year(something):
return 'blah'

Accessible using object.year as well as object.year()

Any pointers/ideas etc?

-- 
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/e7adace8-ffc9-4f77-b970-e73bed5ae8e1%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Oracle 'invalid identifier' and SQL select structure

2014-01-15 Thread Anthony Hawkes
I'm having trouble with django 1.6 running queries on a table I need to 
pull data from

When I run the following from shell
CRMData.objects.filter(Incident_Date='2014-01-14')

I get:
DatabaseError: ORA-00904: "ODBC_EXTRACT_DAILY"."INCIDENT_DATE": invalid 
identifier

I've run queries in sqlplus and the following works
select * from odbc_extract_daily where incident_date='2014-01-14';

But the following doesn't
select * from odbc_extract_daily where odbc_extract_daily.incident_date=
'2014-01-14';

And returns the same
DatabaseError: ORA-00904: "ODBC_EXTRACT_DAILY"."INCIDENT_DATE": invalid 
identifier

I've had a look at core.py but can't for the life of me figure out how to 
change this behaviour - it's partially fatigue but it's making me pull my 
hair out!!!

Please halp!!

DatabaseError: ORA-00904: "ODBC_EXTRACT_DAILY"."INCIDENT_DATE": invalid 
identifier

DatabaseError: ORA-00904: "ODBC_EXTRACT_DAILY"."INCIDENT_DATE": invalid 
identifier

CRMData.objects.filter(Incident_Date='2014-01-14')CRMData.objects.filter(Incident_Date='2014-01-14')

CRMData.objects.filter(Incident_Date='2014-01-14')

CRMData.objects.filter(Incident_Date='2014-01-14')

CRMData.objects.filter(Incident_Date='2014-01-14')

-- 
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/aef7df54-89a4-49f0-aee8-3ff994677d9f%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Any Django users in Reims (France) ?

2013-08-21 Thread anthony tresontani

Salut,

Je suis sur Metz mais ca peut m'intéressé :)

Anthony

Le 21/08/2013 08:28, Fabrice Romand a écrit :

Bonjour,
Je cherche des dev Django dans la région de Reims (France)
pour organiser des rencontres sympas et échanger sur notre plateforme 
préférée

voire développer ensemble nos excellentes idées.
A votre écoute,
Fabrice
--
You received this message because you are subscribed to the Google 
Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send 
an email to django-users+unsubscr...@googlegroups.com.

To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.


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


Pickling of dinamically created models.Model subclasses: "attribute lookup failed", django 1.5

2013-03-20 Thread Sir Anthony
Hello,
I'm using django-audit-log 
witch actively creates dynamic 
models by calling type('%sAuditLogEntry' 
% meta_name, (models.Model,), 
attrs).
 
In django 1.5 I getting error when trying to cache it (pickling phase). 
Example error string: Can't pickle : attribute lookup 
testproject.models.TestItemAuditLogEntry failed. I think it because pickle 
tries to use class name with current environment.
I looked in django sources and found that this 
commitis
 cause of such behaviour. 
I'm not sure it is django bug (I'll write a ticket with test case and 
probably patch, instead), maybe I just need to made some hacks on my side, 
like implement intermediate model with custom __reduce__ like in 1.4 django 
or something alike.


-- 
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?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Easy way to temporarily disable the need to login

2012-09-05 Thread anthony tresontani

We are using a middleware to enforce a user login:

/class AutoAuthMiddleware(object):
"""
Middleware for testing purpose only.
Can enforce the user login.
"""

def process_request(self, request):
enforce_user = request.GET.get("enforce_user", None)
if hasattr(request, "user") and not enforce_user:
return

user = User.objects.filter(username = enforce_user)
if user:
backend = get_backends()[0]
user = user[0]
user.backend = "%s.%s" % (backend.__module__, 
backend.__class__.__name__) #fake authentication

login(request, user)/

You can add that to your testing environnement MIDDLEWARE_CLASSES.

Then you can just go to any url and add ?enforce_user=


On 05/09/12 17:56, Larry Martell wrote:

On Wed, Sep 5, 2012 at 9:36 AM, Kurtis Mullins  wrote:

I don't see why not.

I've been trying to do that, but it's still complaining.


Are you running unit tests (testing scripts) or are you
just using the browser for testing?

I'm trying to do performance measuring. I have a list of all the urls
accessed over the past few months by a client, along with metrics on
their execution times. I want to run all those on a new server we've
set up and collect metrics and compare them. I have a python script
that uses urllib2 but, I can't run anything without logging in. I've
tried to login from python, but I get a 403. I also tried using the
requests module - that doesn't give me the 403, but doesn't log me in
- it just returns the login page as if the login failed.


On Wed, Sep 5, 2012 at 11:24 AM, Larry Martell 
wrote:

On Wed, Sep 5, 2012 at 9:22 AM, Kurtis Mullins 
wrote:

If any of your templates/views depend upon a request.user object, you'll
run
into issues because that will not exist without "logging in". I'm not
sure
of a good way around this off-hand without knowing more about your site.
Sorry!

Yes, they do depend on a request.user object. Can I hard code the
initialization of it?


On Wed, Sep 5, 2012 at 11:18 AM, Larry Martell 
wrote:

We have a django app that requires the users to login. For some
testing we want to do, we want to disable this so the app can be run
without logging in. Is there some way to easily do this? I've tried
commenting out all the @login_required decorations, but then I was
getting a 403. I tried commenting out the 'if not
controller.has_access' lines, but then I was getting 'Report.owner"
must be a "User" instance.' Before I hack up the code any more, is
there some way to just globally disable the need to login?

--
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.


--
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.

--
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.


--
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.



--
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: E-commerce package

2012-09-04 Thread anthony tresontani

http://oscarcommerce.com/

On 04/09/12 09:27, zayatzz wrote:

http://satchmoproject.com/

On Tuesday, September 4, 2012 10:02:07 AM UTC+3, randa hisham wrote:

Iam developing an e-commerce website,lookig for a good django package
any recommends?

-- 
Randa Hesham

Software Developer

Twitter:@ro0oraa 
FaceBook:Randa Hisham 

ٍ

--
You received this message because you are subscribed to the Google 
Groups "Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/BAPgM_iNNz4J.

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.



--
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: HttpResponseNotModified returning 200 code

2012-08-22 Thread Kevin Anthony
wow, that's embarrassing.  thanks.

On Wed, Aug 22, 2012 at 4:16 PM, Alexis Roda <
alexis.roda.villalo...@gmail.com> wrote:

> Al 22/08/12 21:36, En/na Kevin Anthony ha escrit:
>
>> Here is my code:
>>
>> id = get_id(request)
>>   if id is not None:
>>   host = request.GET['host']
>>   if host!=None:
>>   command =
>> command_queue.objects.all().**filter(destination_hostname=**
>> host,user__id=id)
>>   if not command.count():
>>   HttpResponseNotModified()
>>   retval =
>> JSONResponse(command.values('**command','command_text'),**
>> Extra={"success":True})
>>   command.delete()
>>   return retval
>>  return HttpResponseForbidden()
>>
>> I know it's getting to the HttpResponseNotModified, but I'm still
>> getting a HTTP status code of 200.
>>
>> Can someone point me in the correct direction?
>>
>
> return HttpResponseNotModified()
>
>
>
> HTH
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to django-users+unsubscribe@**
> googlegroups.com <django-users%2bunsubscr...@googlegroups.com>.
> For more options, visit this group at http://groups.google.com/**
> group/django-users?hl=en<http://groups.google.com/group/django-users?hl=en>
> .
>
>


-- 
Thanks
Kevin Anthony
www.NoSideRacing.com

Do you use Banshee?
Download the Community Extensions:
http://banshee.fm/download/extensions/

-- 
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.



HttpResponseNotModified returning 200 code

2012-08-22 Thread Kevin Anthony
Here is my code:

id = get_id(request)
 if id is not None:
 host = request.GET['host']
 if host!=None:
 command =
command_queue.objects.all().filter(destination_hostname=host,user__id=id)
 if not command.count():
 HttpResponseNotModified()
 retval =
JSONResponse(command.values('command','command_text'),Extra={"success":True})
 command.delete()
 return retval
return HttpResponseForbidden()

I know it's getting to the HttpResponseNotModified, but I'm still getting a
HTTP status code of 200.

Can someone point me in the correct direction?
-- 
Thanks
Kevin Anthony
www.NoSideRacing.com

Do you use Banshee?
Download the Community Extensions:
http://banshee.fm/download/extensions/

-- 
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: Plotting a line graph

2012-07-30 Thread Kevin Anthony
I would look into the Google graph API
https://developers.google.com/chart/

On Mon, Jul 30, 2012 at 10:47 AM, Sithembewena Lloyd Dube <zebr...@gmail.com
> wrote:

> Hi all,
>
> I need to draw a simple line graph do to the following:
> - draw a simple line from y, x = 0 going towards x++. In other words, the
> line should begin at bottom left and run diagonally towards upper right.
>
> I have tried looking at ReportLab but I do not have enough time to dig
> through the docs. What plotting solution would anyone suggest?
>
> PS: An image of what I need to do is attached. X axis is miles (or points)
> won and Y axis is items receivable for those points, so if a user has 1
> miles a green dot should appear on the line demarcating 1 miles.
>
> --
> Regards,
> Sithembewena Lloyd Dube
>
> --
> 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.
>



-- 
Thanks
Kevin Anthony
www.NoSideRacing.com

Do you use Banshee?
Download the Community Extensions:
http://banshee.fm/download/extensions/

-- 
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.



  1   2   >