Re: Having trouble loading up my poll app

2018-05-28 Thread Caleb Bryson
P.S.: This is my first attempt at setting up a website using django so my 
code may look a little ruff.

here is my urls.py
from django.urls import path

from . import views

urlpatterns = [
path('', views.index, name='index'),

path('/', views.detail, name='detail'),
path('/results/', views.results, name='results'),
path('/vote/', views.vote, name='vote'),
]

app_name = 'polls'
urlpatterns = [
path('', views.index, name='index'),
path('/', views.detail, name='detail'),
path('/results/', views.results, name='results'),
path('/vote/', views.vote, name='vote'),
]

here is my detail.html 
{{ question.question_text }}

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


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

{{ choice.choice_text 
}}
{% endfor %}



and here is my result.html
{{ question.question_text }}


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


Vote again?

On Monday, May 28, 2018 at 9:45:41 PM UTC-4, Caleb Bryson wrote:
Hey guys, I am on part 4 of writing your first django app. And I am stuck 
at the part where it says this "Now, go to /polls/1/ in your browser and 
vote in the question. You should see a results page that gets updated each 
time you vote. If you submit the form without having chosen a choice, you 
should see the error message." . I thought I was supposed to use the url "
http://localhost:8000/polls/1/"; but it gave me a error saying "Template 
does not exist at /polls/1/". I am not really sure how to fix this to move 
on with the tutorial. Does anyone know how to get rid of this error?

-- 
You received this message because you are subscribed to the Google Groups 
"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/a940e7c2-24ed-4412-8424-eff83beaf421%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Having trouble loading up my poll app

2018-05-28 Thread 김영찬
When you receive that error message "Template does not exist", most of time
you are able to find errors in URL and TEMPLATE.
Please show us your urls.py and detail.html and result.html :)

2018-05-29 10:45 GMT+09:00 Caleb Bryson :

> Hey guys, I am on part 4 of writing your first django app. And I am stuck
> at the part where it says this "Now, go to /polls/1/ in your browser and
> vote in the question. You should see a results page that gets updated each
> time you vote. If you submit the form without having chosen a choice, you
> should see the error message." . I thought I was supposed to use the url "
> http://localhost:8000/polls/1/"; but it gave me a error saying "Template
> does not exist at /polls/1/". I am not really sure how to fix this to move
> on with the tutorial. Does anyone know how to get rid of this error?
>
> --
> You received this message because you are subscribed to the Google Groups
> "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/fc0f2c87-a6c9-4276-b045-2c2caf1d3e3c%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%2Bfs_cuRg4bUfLC1aC7%3D5y7Veyheq5rbxXJkSD4pAgnDWDjztw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Authenticated users should only be able to see their own data

2018-05-28 Thread Mike Dewhirst

On 29/05/2018 11:44 AM, Mike Dewhirst wrote:

On 29/05/2018 11:04 AM, Dylan Moreland wrote:

Hello,

I'm building an employee performance tracker for my company, and I'd 
like each employee to be able to view their own infractions (late to 
a shift, missed punch, etc.) and no one else's, obviously. I plan to 
use the built-in Django admin interface to allow HR to modify the 
database as necessary, and I also want to build a frontend for 
employees to access.


I also meant to say you don't need a separate Employee model. The 
existing Django auth.user has what you need. You probably want a 
user_profile model to carry 1:1 information not available in auth.user


The docs recommend that you create your own user by inheriting from 
django.contrib.auth.models.AbstractUser and maybe that's what you are 
doing with your Employee model. I think it is a good idea unless you you 
are sure you won't need to.


https://docs.djangoproject.com/en/1.11/topics/auth/customizing/#extending-the-existing-user-model




You write views to extract data from the database and render the 
result in a frontend template. Provided you force the users to 
authenticate, generally by decorating the views with @login_required, 
then the http request object Django gives you has the authenticated 
user as an attribute. ie., request.user is the employee object.


If you then retrieve infraction data from the database keyed on 
request.user, that employee will only see his or her own infractions 
and no-one else's.


There are other things you need to watch. For example, don't let 
employees access the admin (user.is_staff = False) unless you have 
taken care to prevent them seeing other data. It is more complex than 
doing it in your own views but it can be done.


You might also think about warning users to logout after visiting 
their page because by default a Django session lasts two weeks. It is 
a bit problematic trying to force logout from the server.


Good luck. I think you will enjoy the flexibility and power of Django.




My models are currently set up as follows:

    *_'Employee' model:_*

    - first_name (CharField)

    - last_name (CharField)

    *_'InfractionType' model:_*
    - description (CharField)

    *_'Infraction' model:_*
    - timestamp (DateTimeField)
    - employee (ForeignKey, Employee)
    - type (ForeignKey, InfractionType)
    - has_comment (Boolean) #true if employee has added an explanatory
    comment to our timecard system, false if they haven't
    - description (CharField)


I am also using the django.contrib.auth and django.contrib.admin 
libraries and their corresponding database tables.


How should I set up my templates such that each logged-in user has 
access to only their own employee information? I get the sense that I 
will need to add a one-to-one relationship between the User table and 
Employee table, but I'm not sure if I'm on the right track.


Also, I've been developing in Django for about three days now, so I'm 
very new to all of this. I appreciate your patience and support.



Thanks so much for your help,
Dylan
--
You received this message because you are subscribed to the Google 
Groups "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/ba106eda-7a33-412f-ad90-c0fc8540a006%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/e92b1814-e6f0-706b-fa4a-ca9dba475923%40dewhirst.com.au.
For more options, visit https://groups.google.com/d/optout.


Having trouble loading up my poll app

2018-05-28 Thread Caleb Bryson
Hey guys, I am on part 4 of writing your first django app. And I am stuck 
at the part where it says this "Now, go to /polls/1/ in your browser and 
vote in the question. You should see a results page that gets updated each 
time you vote. If you submit the form without having chosen a choice, you 
should see the error message." . I thought I was supposed to use the url 
"http://localhost:8000/polls/1/"; 
but it gave me a error saying "Template does not exist at /polls/1/". I am 
not really sure how to fix this to move on with the tutorial. Does anyone 
know how to get rid of this error?

-- 
You received this message because you are subscribed to the Google Groups 
"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/fc0f2c87-a6c9-4276-b045-2c2caf1d3e3c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Authenticated users should only be able to see their own data

2018-05-28 Thread Mike Dewhirst

On 29/05/2018 11:04 AM, Dylan Moreland wrote:

Hello,

I'm building an employee performance tracker for my company, and I'd 
like each employee to be able to view their own infractions (late to a 
shift, missed punch, etc.) and no one else's, obviously. I plan to use 
the built-in Django admin interface to allow HR to modify the database 
as necessary, and I also want to build a frontend for employees to 
access.


You write views to extract data from the database and render the result 
in a frontend template. Provided you force the users to authenticate, 
generally by decorating the views with @login_required, then the http 
request object Django gives you has the authenticated user as an 
attribute. ie., request.user is the employee object.


If you then retrieve infraction data from the database keyed on 
request.user, that employee will only see his or her own infractions and 
no-one else's.


There are other things you need to watch. For example, don't let 
employees access the admin (user.is_staff = False) unless you have taken 
care to prevent them seeing other data. It is more complex than doing it 
in your own views but it can be done.


You might also think about warning users to logout after visiting their 
page because by default a Django session lasts two weeks. It is a bit 
problematic trying to force logout from the server.


Good luck. I think you will enjoy the flexibility and power of Django.




My models are currently set up as follows:

*_'Employee' model:_*

- first_name (CharField)

- last_name (CharField)

*_'InfractionType' model:_*
- description (CharField)

*_'Infraction' model:_*
- timestamp (DateTimeField)
- employee (ForeignKey, Employee)
- type (ForeignKey, InfractionType)
- has_comment (Boolean) #true if employee has added an explanatory
comment to our timecard system, false if they haven't
- description (CharField)


I am also using the django.contrib.auth and django.contrib.admin 
libraries and their corresponding database tables.


How should I set up my templates such that each logged-in user has 
access to only their own employee information? I get the sense that I 
will need to add a one-to-one relationship between the User table and 
Employee table, but I'm not sure if I'm on the right track.


Also, I've been developing in Django for about three days now, so I'm 
very new to all of this. I appreciate your patience and support.



Thanks so much for your help,
Dylan
--
You received this message because you are subscribed to the Google 
Groups "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/ba106eda-7a33-412f-ad90-c0fc8540a006%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/839d4482-16a0-efad-c819-edfe0f68c505%40dewhirst.com.au.
For more options, visit https://groups.google.com/d/optout.


Authenticated users should only be able to see their own data

2018-05-28 Thread Dylan Moreland
Hello,

I'm building an employee performance tracker for my company, and I'd like 
each employee to be able to view their own infractions (late to a shift, 
missed punch, etc.) and no one else's, obviously. I plan to use the 
built-in Django admin interface to allow HR to modify the database as 
necessary, and I also want to build a frontend for employees to access. 

My models are currently set up as follows:

*'Employee' model:*

- first_name (CharField)

- last_name (CharField)

*'InfractionType' model:*
- description (CharField)

*'Infraction' model:*
- timestamp (DateTimeField)
- employee (ForeignKey, Employee)
- type (ForeignKey, InfractionType)
- has_comment (Boolean) #true if employee has added an explanatory comment 
to our timecard system, false if they haven't
- description (CharField)


I am also using the django.contrib.auth and django.contrib.admin libraries 
and their corresponding database tables.

How should I set up my templates such that each logged-in user has access 
to only their own employee information? I get the sense that I will need to 
add a one-to-one relationship between the User table and Employee table, 
but I'm not sure if I'm on the right track.

Also, I've been developing in Django for about three days now, so I'm very 
new to all of this. I appreciate your patience and support.


Thanks so much for your help,
Dylan

-- 
You received this message because you are subscribed to the Google Groups 
"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/ba106eda-7a33-412f-ad90-c0fc8540a006%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: money field question

2018-05-28 Thread Mike Dewhirst

On 29/05/2018 6:06 AM, Simon McConnell wrote:



On Mon., 28 May 2018, 7:50 pm Mike Dewhirst, > wrote:


On 24/05/2018 12:03 PM, Mike Dewhirst wrote:
> On 23/05/2018 12:31 PM, Simon McConnell wrote:
>> I'm in a similar boat at the moment. There
>> is https://github.com/vimeo/py-money too.
>
> I looked at that but it probably won't ever support exchange rates.
> Not sure yet if that is a show stopper because maybe forex is a
> separate thing anyway. I do need exchange rates in another
project and
> I'd like choose a MoneyField which works in all projects.

On reflection I don't think exchange rates are any sort of
show-stopper.
I either agree on an exchange rate with the client ahead of time
and do
a forex deal without a rate (and wear the loss or gain when actually
exchanged) or bill in AUD and expect AUD to be remitted. I don't
think I
want the complication of the MoneyField doing what someone else
thinks
should happen.


Agreed. Currency exchange happens at the financial institution, not in 
our web apps. It would only be useful for estimation in my mind (I see 
no need for it in my application so haven't thought much about it).




>
>> Note that django-money uses py-moneyed which does not yet use
Babel,
>> so rendering of the correct symbol is limited to a few hardcoded
>> currencies.

But py-moneyed does claim a complete dictionary of ISO 4217
currencies.



googlecode/python-money
    |
    |   |    |
   py-moneyed   |   grengojbo/python-money
    |   |    |
    \___/    |
    |    |
  django-money    poswald/python-money

 and

    vimeo/py-money

 py-moneyed is de-djangoed googlecode and django-money is googlecode 
plus py-moneyed


I'm still procrastinating.





https://github.com/limist/py-moneyed/blob/master/moneyed/localization.py 
only has the localisation configured for a handful of currencies, and 
not our precious AUD :). The shortest party would be adding them all 
in or doing https://github.com/limist/py-moneyed/issues/22



It also supports Python 2.7 which is useful for me because I
haven't yet
rebuilt apache/mod_wsgi for py3 on my Ubuntu VMs. I wish there was a
pill to cure procrastination.


Work with what you've got (that being procrastination): 
http://www.structuredprocrastination.com



poswald/python-money does the same and looks interesting. Might go
there
and see how it works. It also has form and field helpers.

Mike


>
> Interesting. I don't use Babel yet. But it is on the horizon.
>
> I'm beginning to see why Django doesn't (yet?) have a built-in
> MoneyField and I'm still interested in experience with differences
> between them.
>
> Mike
>
>>
>>
>> https://github.com/python-babel/babel
>>
>>
>> On Tuesday, 22 May 2018 11:25:04 UTC+10, Mike Dewhirst wrote:
>>
>>     I have just read ...
>>
>>     * Martin Fowler's Money base pattern (P488 to 495)
>> https://martinfowler.com/eaaCatalog/money.html
>>     
>>     * https://github.com/poswald/python-money
>>     
>>     * https://github.com/django-money/django-money
>>     
>>     * https://github.com/limist/py-moneyed
>>     
>>
>>     ... and I am spoiled for choice. I was going to just use a
>>     DecimalField
>>     and CharField for currency and do my own thing when I
decided to
>> pull
>>     Martin Fowler off my shelf and saw how careful I was going
to need
>>     to be.
>>
>>     My question: Is Django planning to adopt one or other of
the above
>>     implementations?
>>
>>     I'm just trying to short-circuit more detailed analysis of
these
>>     packages and perhaps others I haven't yet found. If one is
on the
>>     horizon for Django I'll just go with that.
>>
>>     Thanks
>>
>>     Mike
>>
>>
>>
>> --
>> You received this message because you are subscribed to the Google
>> Groups "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 
>> >.
>> Vi

Re: money field question

2018-05-28 Thread Mike Dewhirst

On 29/05/2018 6:06 AM, Simon McConnell wrote:


https://github.com/limist/py-moneyed/blob/master/moneyed/localization.py 
only has the localisation configured for a handful of currencies, and 
not our precious AUD :). The shortest party would be adding them all 
in or doing https://github.com/limist/py-moneyed/issues/22




Look at the bottom of this file ...

https://github.com/poswald/python-money/blob/master/money/money.py


--
You received this message because you are subscribed to the Google Groups "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/7c53a30a-3a33-a177-1d66-9350fb918e69%40dewhirst.com.au.
For more options, visit https://groups.google.com/d/optout.


Re: money field question

2018-05-28 Thread Simon McConnell
On Mon., 28 May 2018, 7:50 pm Mike Dewhirst,  wrote:

> On 24/05/2018 12:03 PM, Mike Dewhirst wrote:
> > On 23/05/2018 12:31 PM, Simon McConnell wrote:
> >> I'm in a similar boat at the moment. There
> >> is https://github.com/vimeo/py-money too.
> >
> > I looked at that but it probably won't ever support exchange rates.
> > Not sure yet if that is a show stopper because maybe forex is a
> > separate thing anyway. I do need exchange rates in another project and
> > I'd like choose a MoneyField which works in all projects.
>
> On reflection I don't think exchange rates are any sort of show-stopper.
> I either agree on an exchange rate with the client ahead of time and do
> a forex deal without a rate (and wear the loss or gain when actually
> exchanged) or bill in AUD and expect AUD to be remitted. I don't think I
> want the complication of the MoneyField doing what someone else thinks
> should happen.
>

Agreed. Currency exchange happens at the financial institution, not in our
web apps. It would only be useful for estimation in my mind (I see no need
for it in my application so haven't thought much about it).


>
> >
> >> Note that django-money uses py-moneyed which does not yet use Babel,
> >> so rendering of the correct symbol is limited to a few hardcoded
> >> currencies.
>
> But py-moneyed does claim a complete dictionary of ISO 4217 currencies.
>


https://github.com/limist/py-moneyed/blob/master/moneyed/localization.py
only has the localisation configured for a handful of currencies, and not
our precious AUD :). The shortest party would be adding them all in or
doing https://github.com/limist/py-moneyed/issues/22

>
> It also supports Python 2.7 which is useful for me because I haven't yet
> rebuilt apache/mod_wsgi for py3 on my Ubuntu VMs. I wish there was a
> pill to cure procrastination.
>

Work with what you've got (that being procrastination):
http://www.structuredprocrastination.com


> poswald/python-money does the same and looks interesting. Might go there
> and see how it works. It also has form and field helpers.
>
> Mike
>
>
> >
> > Interesting. I don't use Babel yet. But it is on the horizon.
> >
> > I'm beginning to see why Django doesn't (yet?) have a built-in
> > MoneyField and I'm still interested in experience with differences
> > between them.
> >
> > Mike
> >
> >>
> >>
> >> https://github.com/python-babel/babel
> >>
> >>
> >> On Tuesday, 22 May 2018 11:25:04 UTC+10, Mike Dewhirst wrote:
> >>
> >> I have just read ...
> >>
> >> * Martin Fowler's Money base pattern (P488 to 495)
> >> https://martinfowler.com/eaaCatalog/money.html
> >> 
> >> * https://github.com/poswald/python-money
> >> 
> >> * https://github.com/django-money/django-money
> >> 
> >> * https://github.com/limist/py-moneyed
> >> 
> >>
> >> ... and I am spoiled for choice. I was going to just use a
> >> DecimalField
> >> and CharField for currency and do my own thing when I decided to
> >> pull
> >> Martin Fowler off my shelf and saw how careful I was going to need
> >> to be.
> >>
> >> My question: Is Django planning to adopt one or other of the above
> >> implementations?
> >>
> >> I'm just trying to short-circuit more detailed analysis of these
> >> packages and perhaps others I haven't yet found. If one is on the
> >> horizon for Django I'll just go with that.
> >>
> >> Thanks
> >>
> >> Mike
> >>
> >>
> >>
> >> --
> >> You received this message because you are subscribed to the Google
> >> Groups "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/762af31e-56fd-4976-bef2-f627c5673f38%40googlegroups.com
> >> <
> https://groups.google.com/d/msgid/django-users/762af31e-56fd-4976-bef2-f627c5673f38%40googlegroups.com?utm_medium=email&utm_source=footer>.
>
> >>
> >> For more options, visit https://groups.google.com/d/optout.
> >
>
>
> --
>
> Climate Pty Ltd
> PO Box 308
> Mount Eliza
> Vic 3930
> Australia +61
>
> T: 03 9034 3977
> M: 0411 704 143
>
>
> --
> 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/O51wKkudE_U/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

Definitive (or any) guide to testing Django admin actions with intermediate pages?

2018-05-28 Thread Derek
Looking for some help with a persistent problem.

While there are many examples scattered across the internet about how to
incorporate intermediate pages (typically with a form involved) into a
custom Django admin action, I have not been able to find a complete and
definitive guide to how to create unit tests for such functions.

If anyone has, actually, created such a unit test, I'd appreciate your
insight. I am not looking for "best practice" but something pragmatic that
"Just Works".

I imagine the unit test looks something like this:

def test_custom_admin_action():
# set up scaffolding - client? request? login a user?
# set up the queryset data
# set up the form data
# call the action, passing in (?) the queryset and the form data
# validate the response*

* in most cases, for the actions I write**, the action returns back to the
original Django list page from where it was called, typically with a
message indicating the success (or otherwise) of the action.  So validation
would ideally need to check both the system changes (e.g. records altered
or new records created) and the response to the user, which was made via
the Django messages framework.
** for purpose of this question, its safe to assume that all logic for the
action is included in it as a single whole.

Any help with this is appreciated - its the one part of testing that just
eludes me.

Derek

-- 
You received this message because you are subscribed to the Google Groups 
"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/CAF1Wu3MiLaU8TDW7dStQ4dDCZTW69EiXxRho_1gmJLAmcE0X0w%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: main page have stopped work after creating poll app

2018-05-28 Thread Florian Schweikert

It seems you don't have a "main" page.
The page you saw was a placeholder starting page if there are no other 
urls defined.

If you want to deliver something at / you have to add it to urls.py


PS: pasting screenshots of code is a very bad habit.

On 26/05/18 14:46, Dmitry Sobolev wrote:



if I comment this stroke in urls.py the main page begins to work but in 
this case I don't have an access to the polls app.





суббота, 26 мая 2018 г., 15:00:04 UTC+3 пользователь Dmitry Sobolev написал:

Hello guys!
I am doing 1st steps in Django.
Started 1st tutorial page 3 times from there and getting the same
case each time.
After that, I created a working "poll app" that works under
127.0.0.1:8000/polls/ 
the main address stop working
where should I see the problem of this problem and make main page
work both with "poll app"?
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/4d392683-e5c3-40fc-98f6-7a0d91e8fa8b%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/632f534e-c43f-76ec-cca8-a39dc11ab489%40ist-total.org.
For more options, visit https://groups.google.com/d/optout.


Re: main page have stopped work after creating poll app

2018-05-28 Thread Julio Biason
Hi Dmitry,

Define "the main address stop working"? Do you mean it won't accept any
other requests?

You should probably check the command line where you started "manage.py
runserver". It should display a backtrace pointing to anything that went
wrong.

On Sat, May 26, 2018 at 5:43 AM, Dmitry Sobolev 
wrote:

> Hello guys!
> I am doing 1st steps in Django.
> Started 1st tutorial page 3 times from there and getting the same case
> each time.
> After that, I created a working "poll app" that works under
> 127.0.0.1:8000/polls/
> the main address stop working
> where should I see the problem of this problem and make main page work
> both with "poll app"?
> 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/02e80ca1-a53c-4668-beb9-1f21a31bae70%40googlegroups.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>



-- 
*Julio Biason*, Sofware Engineer
*AZION*  |  Deliver. Accelerate. Protect.
Office: +55 51 3083 8101   |  Mobile: +55 51
*99907 0554*

-- 
You received this message because you are subscribed to the Google Groups 
"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/CAEM7gE1ovixssyFzKwOLqvh1tcbVaCRQy%3DzbDSe7rWzVuGW53A%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: money field question

2018-05-28 Thread Mike Dewhirst

On 24/05/2018 12:03 PM, Mike Dewhirst wrote:

On 23/05/2018 12:31 PM, Simon McConnell wrote:
I'm in a similar boat at the moment. There 
is https://github.com/vimeo/py-money too.


I looked at that but it probably won't ever support exchange rates. 
Not sure yet if that is a show stopper because maybe forex is a 
separate thing anyway. I do need exchange rates in another project and 
I'd like choose a MoneyField which works in all projects.


On reflection I don't think exchange rates are any sort of show-stopper. 
I either agree on an exchange rate with the client ahead of time and do 
a forex deal without a rate (and wear the loss or gain when actually 
exchanged) or bill in AUD and expect AUD to be remitted. I don't think I 
want the complication of the MoneyField doing what someone else thinks 
should happen.





Note that django-money uses py-moneyed which does not yet use Babel, 
so rendering of the correct symbol is limited to a few hardcoded 
currencies.


But py-moneyed does claim a complete dictionary of ISO 4217 currencies.

It also supports Python 2.7 which is useful for me because I haven't yet 
rebuilt apache/mod_wsgi for py3 on my Ubuntu VMs. I wish there was a 
pill to cure procrastination.


poswald/python-money does the same and looks interesting. Might go there 
and see how it works. It also has form and field helpers.


Mike




Interesting. I don't use Babel yet. But it is on the horizon.

I'm beginning to see why Django doesn't (yet?) have a built-in 
MoneyField and I'm still interested in experience with differences 
between them.


Mike




https://github.com/python-babel/babel


On Tuesday, 22 May 2018 11:25:04 UTC+10, Mike Dewhirst wrote:

    I have just read ...

    * Martin Fowler's Money base pattern (P488 to 495)
    https://martinfowler.com/eaaCatalog/money.html
    
    * https://github.com/poswald/python-money
    
    * https://github.com/django-money/django-money
    
    * https://github.com/limist/py-moneyed
    

    ... and I am spoiled for choice. I was going to just use a
    DecimalField
    and CharField for currency and do my own thing when I decided to 
pull

    Martin Fowler off my shelf and saw how careful I was going to need
    to be.

    My question: Is Django planning to adopt one or other of the above
    implementations?

    I'm just trying to short-circuit more detailed analysis of these
    packages and perhaps others I haven't yet found. If one is on the
    horizon for Django I'll just go with that.

    Thanks

    Mike



--
You received this message because you are subscribed to the Google 
Groups "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/762af31e-56fd-4976-bef2-f627c5673f38%40googlegroups.com 
. 


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





--

Climate Pty Ltd
PO Box 308
Mount Eliza
Vic 3930
Australia +61

T: 03 9034 3977
M: 0411 704 143


--
You received this message because you are subscribed to the Google Groups "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/65f7387c-aa75-f29c-9f99-74095d5e9c7d%40dewhirst.com.au.
For more options, visit https://groups.google.com/d/optout.