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


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
Customers, and you have a model for your Gold Customers 

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


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 

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/
'+"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
.
To view this discussion on the web visit

https://groups.google.com/d/msgid/django-users/2c166097-9635-4dd0-828c-5b1f3006cf1e%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/d18ca5b1-6426-405b-8348-91c13ace1bb9%40googlegroups.com 
.

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



--
--
Anthony Flury
email : *anthony.fl...@btinternet.com*
Twitter : *@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 
.
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/785cb34c-4099-4213-9aef-2c81a5a21ef7%40googlegroups.com 
.

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



--
--
Anthony Flury
email : *anthony.fl...@btinternet.com*
Twitter : *@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 
.
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/785cb34c-4099-4213-9aef-2c81a5a21ef7%40googlegroups.com 
.

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



--
--
Anthony Flury
email : *anthony.fl...@btinternet.com*
Twitter : *@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

On 05/07/18 12:49, Umar Kambala wrote:


Please am sorry am new to django, I don't really understood what u mean

I know that Tim has helped you in this occassion but  you really do need 
to  know how to find your way around a computer


the commands 'ls' and 'cd ..'

are nothing to do with Django - they are basic commands for managing 
your file system which will work regardless of whether you use Django or not


I know in a previous answer, someone suggested that you learn some basic 
Python knowledge, can I also suggest that you learn some basic console 
commands - how to change directory, list files, delete and rename files 
how to look at the file details (file size, dates etc). These are all 
useful things when you are trying to do development.



On Jul 5, 2018 11:42 AM, "Tim Vogt (Tim Vogt)" > wrote:


do $ls and find the directory where the manage.py file is.
cd.. to go one directory back




Op 5 jul. 2018, om 13:25 heeft Umar Kambala
mailto:umarkamb...@gmail.com>> het
volgende geschreven:

thanks Mr Tim
i have python 3.6 install on my computer, i try running python
manage.py migrate and this is what i got

C:\Users\Admin\Desktop\Django web>python manage.py migrate
python: can't open file 'manage.py': [Errno 2] No such file or
directory

On Thu, Jul 5, 2018 at 4:21 AM, Tim Vogt (Tim Vogt)
mailto:timtv...@gmail.com>> wrote:

perhaps run the project with python2 or
do python manage.py migrate.



Op 5 jul. 2018, om 13:18 heeft Umar Kambala
mailto:umarkamb...@gmail.com>> het
volgende geschreven:

please this what i had after running my Django-admin
startproject myproject

  File

"c:\users\admin\appdata\local\programs\python\python36-32\lib\site-packages\django\core\management\__init__.py",
line 371, in execute_from_command_line
    utility.execute()
  File

"c:\users\admin\appdata\local\programs\python\python36-32\lib\site-packages\django\core\management\__init__.py",
line 365, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
  File

"c:\users\admin\appdata\local\programs\python\python36-32\lib\site-packages\django\core\management\__init__.py",
line 216, in fetch_command
    klass = load_command_class(app_name, subcommand)
  File

"c:\users\admin\appdata\local\programs\python\python36-32\lib\site-packages\django\core\management\__init__.py",
line 36, in load_command_class
    module = import_module('%s.management.commands.%s' %
(app_name, name))
  File

"c:\users\admin\appdata\local\programs\python\python36-32\lib\importlib\__init__.py",
line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "", line 994, in _gcd_import
  File "", line 971, in
_find_and_load
  File "", line 955, in
_find_and_load_unlocked
  File "", line 665, in
_load_unlocked
  File "", line 678,
in exec_module
  File "", line 219, in
_call_with_frames_removed
  File

"c:\users\admin\appdata\local\programs\python\python36-32\lib\site-packages\django\core\management\commands\startproject.py",
line 1, in 
    from django.core.management.templates import TemplateCommand
  File

"c:\users\admin\appdata\local\programs\python\python36-32\lib\site-packages\django\core\management\templates.py",
line 17, in 
    from django.template import Context, Engine
ModuleNotFoundError: No module named 'django.template'

what should i do to debug this error please?


-- 
You received this message because you are subscribed to the

Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails
from it, send an email to
django-users+unsubscr...@googlegroups.com
.
To 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/CAPkbFbatt4e_SVMPbWEHk--tBKC8VJR6xYcAEjwEJRjMFwT7Wg%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.
   

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 *

--
You received this message because you are subscribed to the Google 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 
.
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/1d490e7d-424f-421f-9278-2b326d95b397%40googlegroups.com 
.

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



--
--
Anthony Flury
email : *anthony.fl...@btinternet.com*
Twitter : *@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 
.
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/40926567-952b-449b-85b2-e7e91ab86b82%40googlegroups.com 
.

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



--
--
Anthony Flury
email : *anthony.fl...@btinternet.com*
Twitter : *@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: 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

>.
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/d17bbc16-4c0b-4d06-bfa5-af814a20cbc6%40googlegroups.com



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



-- 
-- 
Anthony Flury

email : *anthony.fl...@btinternet.com
*
Twitter : *@TonyFlury >*




--
--
Anthony Flury
email : *anthony.fl...@btinternet.com*
Twitter : *@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 
.
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/d17bbc16-4c0b-4d06-bfa5-af814a20cbc6%40googlegroups.com 
.

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



--
--
Anthony Flury
email : *anthony.fl...@btinternet.com*
Twitter : *@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 
.
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/a920009c-ca15-4fe4-a146-26cfddef809b%40googlegroups.com 
.

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



--
--
Anthony Flury
email : *anthony.fl...@btinternet.com*
Twitter : *@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: 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, > 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
.
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/8c65b7f0-9ca7-4e07-8167-fb29274710e1%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/CAEx5wm7JH77g9JfU%3DzHY3%2BCiDbnD3vDnaXLy%3DV1mE8E2wCrd2g%40mail.gmail.com 
.

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



--
--
Anthony Flury
email : *anthony.fl...@btinternet.com*
Twitter : *@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 
.
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/6b6eb6ac-7152-474e-88eb-2da9eb473d3f%40googlegroups.com 
.

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



--
--
Anthony Flury
email : *anthony.fl...@btinternet.com*
Twitter : *@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

...
if your template uses request related information (like logged in
user). The cheaper method is something like this code

,
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 
.
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/850bfcaa-0518-48ef-a827-087100efda92%40googlegroups.com 
.

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



--
--
Anthony Flury
email : *anthony.fl...@btinternet.com*
Twitter : *@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

|relation "GasNet_riser"does notexist LINE 
1:DELETEFROM"GasNet_riser"WHERE"GasNet_riser"."id"=1115^|


when I run the above query manually in my database it runse with no 
problem |DELETE FROM "GasNet_riser" WHERE "GasNet_riser"."id" = 
1115| returns |Query returned successfully: one row affected, 62 msec 
execution time.|


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

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 
.
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/b0b8631b-990b-4123-bc14-e10cf9b1406a%40googlegroups.com 
.

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



--
--
Anthony Flury
email : *anthony.fl...@btinternet.com*
Twitter : *@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 
.
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/CAEohp0dkVzwRZWe9ig8cWWVyXq08K_qndfVmSpj8AM9Zxgaf-Q%40mail.gmail.com 
.

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



--
--
Anthony Flury
email : *anthony.fl...@btinternet.com*
Twitter : *@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 
.
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/CAEohp0dkVzwRZWe9ig8cWWVyXq08K_qndfVmSpj8AM9Zxgaf-Q%40mail.gmail.com 
.

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



--
--
Anthony Flury
email : *anthony.fl...@btinternet.com*
Twitter : *@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  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: 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 

*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 
.
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/918a65bb-e9c3-42fb-9170-6e5092b62bc5%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/14e753f9-4370-75cf-5767-3c7815bae16b%40btinternet.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 *

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" > wrote:


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

On Wed, May 23, 2018 at 5:56 PM, Umar Kambala
> 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
.
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/CAPkbFbZwVPyBpVsA65UTjeJNgKHnQqpsTVmOmeO5GFeusnVfww%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 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

.
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/CAPkbFbZmHibrrij317hQeczBiWqFB_QexEZFxKcko2qpsbzEww%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 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 *

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
 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
.
To view this discussion on the web visit

https://groups.google.com/d/msgid/django-users/54b07f4e-663c-4ed0-a419-541d735148a1%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/0d8bf4ad-99dc-4c0e-8341-1084e15daf75%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/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 
> 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
.
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/CAEqej2P0_sZt2j06nf0OnOL%2BE%3DuVa1Cs0BOFmTx8vjQm6-io2Q%40mail.gmail.com

.
For more options, visit 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 
.
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/CAHn91oeJYPGbLaJAZbJqd3jxbDcY6m3d8e2fSE06_E_ZwXXosQ%40mail.gmail.com 
.

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



--
--
Anthony Flury
email : *anthony.fl...@btinternet.com*
Twitter : *@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 
.
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/353c96a5-5946-4530-beb4-71ad83c0366b%40googlegroups.com 
.

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



--
--
Anthony Flury
email : *anthony.fl...@btinternet.com*
Twitter : *@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.


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 
.
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/e7eb07c0-6162-4c88-b5b4-8d1a5ee2d4b6%40googlegroups.com 
.

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



--
--
Anthony Flury
email : *anthony.fl...@btinternet.com*
Twitter : *@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 
.
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/a5474895-5676-449f-834f-4d3ab30594dd%40googlegroups.com 
.

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



--
--
Anthony Flury
email : *anthony.fl...@btinternet.com*
Twitter : *@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 
.
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/ed1f8b3c-301e-400c-b493-a55f49f2cdc5%40googlegroups.com 
.

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



--
--
Anthony Flury
email : *anthony.fl...@btinternet.com*
Twitter : *@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 
.
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/12b0418f-7979-4d07-b827-68b0c227%40googlegroups.com 
.

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



--
--
Anthony Flury
email : *anthony.fl...@btinternet.com*
Twitter : *@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 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:




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.



--
--
Anthony Flury
email : *anthony.fl...@btinternet.com*
Twitter : *@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 
.
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/22414d59-c59b-4528-8bdb-9bccf351e5b7%40googlegroups.com 
.

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



--
--
Anthony Flury
email : *anthony.fl...@btinternet.com*
Twitter : *@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.


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
.
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/74790172-8bf5-43b6-9bad-bab68ae11a4a%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/e17d8d56-d57c-4f3d-ae6f-a004a5beda70%40googlegroups.com 
.

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



--
--
Anthony Flury
email : *anthony.fl...@btinternet.com*
Twitter : *@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
I think the root cause of the errors was due to an incorrect settings - 
but Fidel is right that your views.py wasn't great either.


On 03/05/18 17:36, Avitab Ayan Sarmah wrote:

thank you Fidel, and i will take care of it

On Thu, May 3, 2018 at 9:57 PM, Fidel Leon > wrote:


Sure:

from django.http import HttpResponse

from .models import Question


def index(request):
latest_question_list = Question.objects.order_by('-pub_date')[:5]
    output = ', '.join([q.question_text for q in
latest_question_list])
    return HttpResponse(output)

def detail(request, question_id):
return HttpResponse("You're looking at question %s." % 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)

As a matter of advice, please use a fixed-width font when pasting
code, because Python is indented with spaces and using any other
type of font makes reading your mail difficult :)

El jue., 3 may. 2018 a las 18:08, Avitab Ayan Sarmah
(>) escribió:

hello Fidel Leon can you please rewrite the whole views.py
code so that i can understand what is the exact code is

On Thu, May 3, 2018 at 9:19 PM, Fidel Leon > wrote:



El jue., 3 may. 2018 a las 17:38, Avitab Ayan Sarmah
(>)
escribió:


*polls/views.py*:

from django.http import HttpResponse
from django.template import loader

from . models import Question

def index(request):
return HttpResponse("Hello, world.You're at the polls
index.")
latest_question_list =
Question.objects.order_by('-pub_date')[:5]
output = ', '.join([q.question_text for q in
latest_question_list])
return HttpResponse(output)
latest_question_list =
Question.objects.order_by('-pub_date')[:5]
template = loader.get_template('polls/index.html')
context = {
'latest_question_list': latest_question_list,
}
return HttpResponse(template.render(context, request))


Your function index(request) inside polls/views.py is
badly written (you have three function returns). Seems you
are following the tutorial but not removing the previous
examples:

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)

-- 
Fidel Leon

fi...@flm.cat 

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

.
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/CAHXg%3DN2SNuyAsAzk7mYfBB5rahtD3fRSa4vTbL92BQf5CHg-Nw%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 

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 
> 
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
*
Twitter : *@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/CAJ0SFUA52autPYk95a9s4t%2BHXzdx-OYgj%3DzLyfynYX9XiM%3D6NQ%40mail.gmail.com 
.

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



--
--
Anthony Flury
email : *anthony.fl...@btinternet.com*
Twitter : *@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 *

--
You received this message because you are subscribed to the Google 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 *


четвртак, 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
> > 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 
> .
> 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/c574d479-a1b6-4c20-91ab-208ae42d4996%40googlegroups.com



>

>.

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


-- 
-- 
Anthony Flury

email : *anthon...@btinternet.com *
Twitter : *@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 

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 
 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 
.
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/c574d479-a1b6-4c20-91ab-208ae42d4996%40googlegroups.com 
.

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



--
--
Anthony Flury
email : *anthony.fl...@btinternet.com*
Twitter : *@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 

*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 
.
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/74790172-8bf5-43b6-9bad-bab68ae11a4a%40googlegroups.com 
.

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



--
--
Anthony Flury
email : *anthony.fl...@btinternet.com*
Twitter : *@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 *

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 
.
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/fd48e249-9d57-43f5-87e4-09bed383af62%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/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 
 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 
.
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/793b8999-cac4-4c2d-94cc-eabb80f4e702%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/9EC3A76F-EE60-47DC-B4DD-9092D8321EC1%40gmail.com 
.

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



--
--
Anthony Flury
email : *anthony.fl...@btinternet.com*
Twitter : *@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 *


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 as yours, but we end 

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 *

--
You received this message because you are subscribed to the Google 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 *

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 
> 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, > 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
.
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/1fb16f72-1837-48f1-a8f6-c7bd64ca212f%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/CA%2BWjgXMHx_zdBtc_NG%2Bn1JMfi4oxTPHy_1y2Pw75VpxfX%2BxuqA%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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAALWEk2D4B%3D%3Dw%2BD1BK3TpZQ8fEwCE8-s8nDWMZztO3ZPu4tBXw%40mail.gmail.com 

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 *

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.

 
	Virus-free. www.avast.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 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/CAJZFZXqyb9LQEmU_DHy1QToA6y1tmq3vwDBq28X%3DLYDxZgdstw%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 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.