Re: Must be my and and can't be my code -- tracing back a URL pattern type mismatch

2019-03-30 Thread Jorge Gimeno
On Sat, Mar 30, 2019 at 7:31 PM Josh Marshall <
joshua.r.marshall.1...@gmail.com> wrote:

> I'm helping out on a project, but am running into a paradox of a bug must
> existing in the code, but no project code is called.  Not sure how to deal
> with this one.  It looks related to URL setup and the urls.py file is
> practically identical to the examples.  Can anyone make sense of this stack
> trace?
>
>
> ```
> [anadon@goodadvicemallard project1]$ poetry run ./manage.py check
> /home/anadon/.cache/pypoetry/virtualenvs/project1-N4OQNeyl-py3.6/lib/python3.6/site-packages/psycopg2/__init__.py:144:
> UserWarning: The psycopg2 wheel package will be renamed from release 2.8;
> in order to keep installing from binary please use "pip install
> psycopg2-binary" instead. For details see: <
> http://initd.org/psycopg/docs/install.html#binary-install-from-pypi>.
>   """)
> Auto generated 7 views for endpoints
> Traceback (most recent call last):
>   File "./manage.py", line 28, in 
> execute_from_command_line(sys.argv)
>   File
> "/home/anadon/.cache/pypoetry/virtualenvs/project1-N4OQNeyl-py3.6/lib/python3.6/site-packages/django/core/management/__init__.py",
> line 381, in execute_from_command_line
> utility.execute()
>   File
> "/home/anadon/.cache/pypoetry/virtualenvs/project1-N4OQNeyl-py3.6/lib/python3.6/site-packages/django/core/management/__init__.py",
> line 375, in execute
> self.fetch_command(subcommand).run_from_argv(self.argv)
>   File
> "/home/anadon/.cache/pypoetry/virtualenvs/project1-N4OQNeyl-py3.6/lib/python3.6/site-packages/django/core/management/base.py",
> line 316, in run_from_argv
> self.execute(*args, **cmd_options)
>   File
> "/home/anadon/.cache/pypoetry/virtualenvs/project1-N4OQNeyl-py3.6/lib/python3.6/site-packages/django/core/management/base.py",
> line 353, in execute
> output = self.handle(*args, **options)
>   File
> "/home/anadon/.cache/pypoetry/virtualenvs/project1-N4OQNeyl-py3.6/lib/python3.6/site-packages/django/core/management/commands/check.py",
> line 65, in handle
> fail_level=getattr(checks, options['fail_level']),
>   File
> "/home/anadon/.cache/pypoetry/virtualenvs/project1-N4OQNeyl-py3.6/lib/python3.6/site-packages/django/core/management/base.py",
> line 379, in check
> include_deployment_checks=include_deployment_checks,
>   File
> "/home/anadon/.cache/pypoetry/virtualenvs/project1-N4OQNeyl-py3.6/lib/python3.6/site-packages/django/core/management/base.py",
> line 366, in _run_checks
> return checks.run_checks(**kwargs)
>   File
> "/home/anadon/.cache/pypoetry/virtualenvs/project1-N4OQNeyl-py3.6/lib/python3.6/site-packages/django/core/checks/registry.py",
> line 71, in run_checks
> new_errors = check(app_configs=app_configs)
>   File
> "/home/anadon/.cache/pypoetry/virtualenvs/project1-N4OQNeyl-py3.6/lib/python3.6/site-packages/django/core/checks/urls.py",
> line 13, in check_url_config
> return check_resolver(resolver)
>   File
> "/home/anadon/.cache/pypoetry/virtualenvs/project1-N4OQNeyl-py3.6/lib/python3.6/site-packages/django/core/checks/urls.py",
> line 23, in check_resolver
> return check_method()
>   File
> "/home/anadon/.cache/pypoetry/virtualenvs/project1-N4OQNeyl-py3.6/lib/python3.6/site-packages/django/urls/resolvers.py",
> line 397, in check
> warnings.extend(check_resolver(pattern))
>   File
> "/home/anadon/.cache/pypoetry/virtualenvs/project1-N4OQNeyl-py3.6/lib/python3.6/site-packages/django/core/checks/urls.py",
> line 23, in check_resolver
> return check_method()
>   File
> "/home/anadon/.cache/pypoetry/virtualenvs/project1-N4OQNeyl-py3.6/lib/python3.6/site-packages/django/urls/resolvers.py",
> line 397, in check
> warnings.extend(check_resolver(pattern))
>   File
> "/home/anadon/.cache/pypoetry/virtualenvs/project1-N4OQNeyl-py3.6/lib/python3.6/site-packages/django/core/checks/urls.py",
> line 23, in check_resolver
> return check_method()
>   File
> "/home/anadon/.cache/pypoetry/virtualenvs/project1-N4OQNeyl-py3.6/lib/python3.6/site-packages/django/urls/resolvers.py",
> line 397, in check
> warnings.extend(check_resolver(pattern))
>   File
> "/home/anadon/.cache/pypoetry/virtualenvs/project1-N4OQNeyl-py3.6/lib/python3.6/site-packages/django/core/checks/urls.py",
> line 23, in check_resolver
> return check_method()
>   File
> "/home/anadon/.cache/pypoetry/virtualenvs/project1-N4OQNeyl-py3.6/lib/python3.6/site-packages/django/urls/resolvers.py",
> line 398, in check
> return warnings or self.pattern.check()
> AttributeError: 'str' object has no attribute 'check'
>
> ```
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> 

Re: How to resolve UPPER_CASE naming issues in pylint

2019-03-30 Thread Babatunde Akinyanmi
Hi,
That's pylint telling you to change the variable name 'movie_resource' to
all caps.

On Sat, 30 Mar 2019, 07:30 Dennis Alabi,  wrote:

> My program throw up this error >>Constant name "movie_resource" doesn't
> conform to UPPER_CASE naming stylepylint(invalid-name)
>
>
>
>
>
> """vidly URL Configuration
>
> The `urlpatterns` list routes URLs to views. For more information please
> see:
> https://docs.djangoproject.com/en/2.1/topics/http/urls/
> Examples:
> Function views
> 1. Add an import: from my_app import views
> 2. Add a URL to urlpatterns: path('', views.home, name='home')
> Class-based views
> 1. Add an import: from other_app.views import Home
> 2. Add a URL to urlpatterns: path('', Home.as_view(), name='home')
> Including another URLconf
> 1. Import the include() function: from django.urls import include, path
> 2. Add a URL to urlpatterns: path('blog/', include('blog.urls'))
> """
> from django.contrib import admin
> from django.urls import path, include
> from api.models import MovieResource
>
> movie_resource = MovieResource()
>
>
> urlpatterns = [
> path('admin/', admin.site.urls),
> path('movies/', include('movies.urls')),
> path('api/', include('movie_resource.urls'))
> ]
>
> --
> You received this message because you are subscribed to the Google Groups
> "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/a91173a8-058c-4b4a-a7db-183be3567e76%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%2BWjgXO_VVMvTq4r_4-%2BhbzNDVjs1HH78mN63HTcBNgUdVcd1A%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: ModelForm for model that includes multiple items of one kind

2019-03-30 Thread Dean Karres
Thanks to the responders. I was unaware of formsets / midelformsets.  I am
reading about them now.

Cheers

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


Re: ModelForm for model that includes multiple items of one kind

2019-03-30 Thread Kiran Capoor
Hi,

To connect multiple forms you should use: FormSets 

https://docs.djangoproject.com/en/2.1/topics/forms/formsets/

Or

https://docs.djangoproject.com/en/2.1/topics/forms/modelforms/#using-an-inline-formset-in-a-view


Read about it in the above links.

Regards,
Kiran Capoor

On Sunday, March 31, 2019 at 3:56:58 AM UTC+5:30, Dean Karres wrote:
>
> Hi
>
> I am looking for some advice.  I have a basic Profile model.  It looks 
> something like:
>
> Profile:
> first_name
> middle_name
> last_name
> birthday
> address_line1
> address_line2
> city
> state
> zip
> email
> phone
>
> I have a ModelForm that goes with this.
>
> This is sufficient for nearly all the cases I am trying to deal with.  
> However, there are a few special cases in which a person needs to list two 
> or more addresses; two or more email addrs; two or more phone numbers; or, 
> combinations.  
>
> I know just enough about database normalization to think that I need the 
> Profile model plus Address, Email and Phone models and have the Profile 
> have a ForeignKey relation to each of the others.  A la:
>
> Profile:
> first_name
> middle_name
> last_name
> birthday
> 
> 
> 
>
> Address
> address_line1
> address_line2
> City
> state
> zip
>
> Email
> email
>
> Phone
> phone
>
> My question is more about the associated ModelForm(s).  First, I currently 
> have a ModelForm for the first Profile model without the foreign keys.  If 
> I break out the address, email and phone portions into separate models do I 
> need to create separate model forms for each new model?  If so would the 
> new Profile ModelFOrm just inherit the ModelForms of the other components. 
> Something like:
>
> class ProfileForm(ModelForm, AddressForm, EmailForm, PhoneForm):
> ...
>
> The current ModelForm has "clean_" "clean" methods.  Do I keep that 
> in the new Profile form?  Do I put the various "clean" methods in their own 
> model forms and hope that inheritance will pull them in?
>
> Next, how does a ModelForm deal with more than one of the same item -- 
> like more then one address?
>

-- 
You received this message because you are subscribed to the Google Groups 
"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/577bc4d2-4ac9-4034-9d82-489bdd013c9e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Must be my and and can't be my code -- tracing back a URL pattern type mismatch

2019-03-30 Thread Josh Marshall
I'm helping out on a project, but am running into a paradox of a bug must 
existing in the code, but no project code is called.  Not sure how to deal 
with this one.  It looks related to URL setup and the urls.py file is 
practically identical to the examples.  Can anyone make sense of this stack 
trace?


```
[anadon@goodadvicemallard project1]$ poetry run ./manage.py check
/home/anadon/.cache/pypoetry/virtualenvs/project1-N4OQNeyl-py3.6/lib/python3.6/site-packages/psycopg2/__init__.py:144:
 
UserWarning: The psycopg2 wheel package will be renamed from release 2.8; 
in order to keep installing from binary please use "pip install 
psycopg2-binary" instead. For details see: 
.
  """)
Auto generated 7 views for endpoints
Traceback (most recent call last):
  File "./manage.py", line 28, in 
execute_from_command_line(sys.argv)
  File 
"/home/anadon/.cache/pypoetry/virtualenvs/project1-N4OQNeyl-py3.6/lib/python3.6/site-packages/django/core/management/__init__.py",
 
line 381, in execute_from_command_line
utility.execute()
  File 
"/home/anadon/.cache/pypoetry/virtualenvs/project1-N4OQNeyl-py3.6/lib/python3.6/site-packages/django/core/management/__init__.py",
 
line 375, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
  File 
"/home/anadon/.cache/pypoetry/virtualenvs/project1-N4OQNeyl-py3.6/lib/python3.6/site-packages/django/core/management/base.py",
 
line 316, in run_from_argv
self.execute(*args, **cmd_options)
  File 
"/home/anadon/.cache/pypoetry/virtualenvs/project1-N4OQNeyl-py3.6/lib/python3.6/site-packages/django/core/management/base.py",
 
line 353, in execute
output = self.handle(*args, **options)
  File 
"/home/anadon/.cache/pypoetry/virtualenvs/project1-N4OQNeyl-py3.6/lib/python3.6/site-packages/django/core/management/commands/check.py",
 
line 65, in handle
fail_level=getattr(checks, options['fail_level']),
  File 
"/home/anadon/.cache/pypoetry/virtualenvs/project1-N4OQNeyl-py3.6/lib/python3.6/site-packages/django/core/management/base.py",
 
line 379, in check
include_deployment_checks=include_deployment_checks,
  File 
"/home/anadon/.cache/pypoetry/virtualenvs/project1-N4OQNeyl-py3.6/lib/python3.6/site-packages/django/core/management/base.py",
 
line 366, in _run_checks
return checks.run_checks(**kwargs)
  File 
"/home/anadon/.cache/pypoetry/virtualenvs/project1-N4OQNeyl-py3.6/lib/python3.6/site-packages/django/core/checks/registry.py",
 
line 71, in run_checks
new_errors = check(app_configs=app_configs)
  File 
"/home/anadon/.cache/pypoetry/virtualenvs/project1-N4OQNeyl-py3.6/lib/python3.6/site-packages/django/core/checks/urls.py",
 
line 13, in check_url_config
return check_resolver(resolver)
  File 
"/home/anadon/.cache/pypoetry/virtualenvs/project1-N4OQNeyl-py3.6/lib/python3.6/site-packages/django/core/checks/urls.py",
 
line 23, in check_resolver
return check_method()
  File 
"/home/anadon/.cache/pypoetry/virtualenvs/project1-N4OQNeyl-py3.6/lib/python3.6/site-packages/django/urls/resolvers.py",
 
line 397, in check
warnings.extend(check_resolver(pattern))
  File 
"/home/anadon/.cache/pypoetry/virtualenvs/project1-N4OQNeyl-py3.6/lib/python3.6/site-packages/django/core/checks/urls.py",
 
line 23, in check_resolver
return check_method()
  File 
"/home/anadon/.cache/pypoetry/virtualenvs/project1-N4OQNeyl-py3.6/lib/python3.6/site-packages/django/urls/resolvers.py",
 
line 397, in check
warnings.extend(check_resolver(pattern))
  File 
"/home/anadon/.cache/pypoetry/virtualenvs/project1-N4OQNeyl-py3.6/lib/python3.6/site-packages/django/core/checks/urls.py",
 
line 23, in check_resolver
return check_method()
  File 
"/home/anadon/.cache/pypoetry/virtualenvs/project1-N4OQNeyl-py3.6/lib/python3.6/site-packages/django/urls/resolvers.py",
 
line 397, in check
warnings.extend(check_resolver(pattern))
  File 
"/home/anadon/.cache/pypoetry/virtualenvs/project1-N4OQNeyl-py3.6/lib/python3.6/site-packages/django/core/checks/urls.py",
 
line 23, in check_resolver
return check_method()
  File 
"/home/anadon/.cache/pypoetry/virtualenvs/project1-N4OQNeyl-py3.6/lib/python3.6/site-packages/django/urls/resolvers.py",
 
line 398, in check
return warnings or self.pattern.check()
AttributeError: 'str' object has no attribute 'check'

```

-- 
You received this message because you are subscribed to the Google Groups 
"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/af68afca-05c2-4241-a089-835387b4217b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re:

2019-03-30 Thread Chetan Ganji
Best way to learn coding n framework is to build a project. I have taken
courses from various vendors, best ones are the one from Coding For
Entrepreneurs. He also has a youtube channel. Start with try django 1.8

On Sun, Mar 31, 2019, 6:20 AM Makori Breens  wrote:

> http://track.haatm.com/aff_c?offer_id=919_id=29710
>
> On 3/30/19, Victor H. Velasquez Rizo  wrote:
> > Hello Carol.
> >
> > Try this
> > https://tutorial.djangogirls.org/en/
> >
> > On Sat, Mar 30, 2019 at 9:12 AM carol caro 
> wrote:
> >
> >> Hello. I am a new or beginner django developer. Where do I start
> from
> >> I have installed python and integrated with Django framework but I don't
> >> know what to do next
> >>
> >> --
> >> You received this message because you are subscribed to the Google
> Groups
> >> "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/CAN%2Bowc-S7n3OX0jc_fLjro6unDSNZJU4yGbYsxTLGeh55%3DFQvA%40mail.gmail.com
> >> <
> https://groups.google.com/d/msgid/django-users/CAN%2Bowc-S7n3OX0jc_fLjro6unDSNZJU4yGbYsxTLGeh55%3DFQvA%40mail.gmail.com?utm_medium=email_source=footer
> >
> >> .
> >> For more options, visit https://groups.google.com/d/optout.
> >>
> >
> >
> > --
> >
> >
> >
> > Atte...,.
> > Vìctor Hugo Velàsquez Rizo
> > Cali - Colombia
> >
> > --
> > You received this message because you are subscribed to the Google Groups
> > "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/CAFCXTzjxXSzeP8KQEWeV%2BCnVOZEHPinh08iCN1a1jYWpNcf4Xw%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/CAOz9w2Ei8LWhTorQ5Lmw-O4vBK683v%3D-nwLnWZDGQgs0uJrejA%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/CAMKMUjspjMOPeuUCCnsCsrU-_D3LWjx68F1VxasEGm8beEOX0A%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re:

2019-03-30 Thread Makori Breens
http://track.haatm.com/aff_c?offer_id=919_id=29710

On 3/30/19, Victor H. Velasquez Rizo  wrote:
> Hello Carol.
>
> Try this
> https://tutorial.djangogirls.org/en/
>
> On Sat, Mar 30, 2019 at 9:12 AM carol caro  wrote:
>
>> Hello. I am a new or beginner django developer. Where do I start from
>> I have installed python and integrated with Django framework but I don't
>> know what to do next
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "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/CAN%2Bowc-S7n3OX0jc_fLjro6unDSNZJU4yGbYsxTLGeh55%3DFQvA%40mail.gmail.com
>> 
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
> --
>
>
>
> Atte...,.
> Vìctor Hugo Velàsquez Rizo
> Cali - Colombia
>
> --
> You received this message because you are subscribed to the Google Groups
> "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/CAFCXTzjxXSzeP8KQEWeV%2BCnVOZEHPinh08iCN1a1jYWpNcf4Xw%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/CAOz9w2Ei8LWhTorQ5Lmw-O4vBK683v%3D-nwLnWZDGQgs0uJrejA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: ModelForm for model that includes multiple items of one kind

2019-03-30 Thread Chetan Ganji
I think, you will need to implement something like below.

Profile:
first_name
middle_name
last_name
birthday
address  (primary/default)
email (primary/default)
phone (primary/default)


Address

address_line1
address_line2
City
state
zip

Email

email

Phone

phone


As one profile can have multiple entries of addresses, email and phone
numbers, you could use concept of formset to deal with them.
Also, as there are multiple entries, you could store one of them as default
or primary.

I hope this helps :)


Regards,
Chetan Ganji
+91-900-483-4183
ganji.che...@gmail.com
http://ryucoder.in



I’m
protected online with Avast Free Antivirus. Get it here — it’s free forever.

<#DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>

On Sun, Mar 31, 2019 at 3:56 AM Dean Karres  wrote:

> Hi
>
> I am looking for some advice.  I have a basic Profile model.  It looks
> something like:
>
> Profile:
> first_name
> middle_name
> last_name
> birthday
> address_line1
> address_line2
> city
> state
> zip
> email
> phone
>
> I have a ModelForm that goes with this.
>
> This is sufficient for nearly all the cases I am trying to deal with.
> However, there are a few special cases in which a person needs to list two
> or more addresses; two or more email addrs; two or more phone numbers; or,
> combinations.
>
> I know just enough about database normalization to think that I need the
> Profile model plus Address, Email and Phone models and have the Profile
> have a ForeignKey relation to each of the others.  A la:
>
> Profile:
> first_name
> middle_name
> last_name
> birthday
> 
> 
> 
>
> Address
> address_line1
> address_line2
> City
> state
> zip
>
> Email
> email
>
> Phone
> phone
>
> My question is more about the associated ModelForm(s).  First, I currently
> have a ModelForm for the first Profile model without the foreign keys.  If
> I break out the address, email and phone portions into separate models do I
> need to create separate model forms for each new model?  If so would the
> new Profile ModelFOrm just inherit the ModelForms of the other components.
> Something like:
>
> class ProfileForm(ModelForm, AddressForm, EmailForm, PhoneForm):
> ...
>
> The current ModelForm has "clean_" "clean" methods.  Do I keep that
> in the new Profile form?  Do I put the various "clean" methods in their own
> model forms and hope that inheritance will pull them in?
>
> Next, how does a ModelForm deal with more than one of the same item --
> like more then one address?
>
> --
> You received this message because you are subscribed to the Google Groups
> "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/a8954cd8-e3c6-4d6f-8780-1f88a9874a3b%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/CAMKMUjuXoHKh9CwOe%3DG78mJhQUvw19Uva2hUORKxgCtbReuXNw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Looking for a Django Intern in India

2019-03-30 Thread sachin thakur
Sorry couldn't read your mail properly.
Akash sir let me know your response I have already shared my resume with you


On Sun 31 Mar, 2019, 3:56 AM sachin thakur, 
wrote:

> Right time to call you now??
>
> On Sun 31 Mar, 2019, 3:56 AM DEEPAK RAGHAV, 
> wrote:
>
>> Hello  Sir,
>>
>> I am also looking for internsjp in Django.
>> contact no:7840037929
>>
>> Thanks & Regards,
>> Deepak
>>
>> On Fri, Mar 29, 2019 at 12:41 AM Akash Purandare 
>> wrote:
>>
>>> Hello Django Developers
>>>
>>> We would like to provide you with opportunities to work in a live
>>> project on Django. This is an internship which requires you to collaborate
>>> effectively with other members of the team based in India.
>>>
>>> Requirements:
>>> Good Knowledge of Django
>>> Basic Knowledge of React
>>> Proficiency in Git and Heroku
>>>
>>> Interested developers can send their CV to the E-mail Akash Purandare
>>> .
>>> Vacancies: 2
>>>
>>> Regards
>>> Akash Purandare
>>> Oversight
>>> akash.p1...@gmail.com
>>>
>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "Django users" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to django-users+unsubscr...@googlegroups.com.
>>> To 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/a3a73d40-c532-46f7-8da9-35178362cd63%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/CACzRgKiTL3Dbf%2BK-P1qxmxSCXC%3DvcDFtaYAf_9zOQP8dqEbohA%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/CA%2BLmcYuGTQPfb3U19o%3D0XqwKX_dOsVhYLSR3zg%3DWODC6kdF9pQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Looking for a Django Intern in India

2019-03-30 Thread sachin thakur
Right time to call you now??

On Sun 31 Mar, 2019, 3:56 AM DEEPAK RAGHAV, 
wrote:

> Hello  Sir,
>
> I am also looking for internsjp in Django.
> contact no:7840037929
>
> Thanks & Regards,
> Deepak
>
> On Fri, Mar 29, 2019 at 12:41 AM Akash Purandare 
> wrote:
>
>> Hello Django Developers
>>
>> We would like to provide you with opportunities to work in a live project
>> on Django. This is an internship which requires you to collaborate
>> effectively with other members of the team based in India.
>>
>> Requirements:
>> Good Knowledge of Django
>> Basic Knowledge of React
>> Proficiency in Git and Heroku
>>
>> Interested developers can send their CV to the E-mail Akash Purandare
>> .
>> Vacancies: 2
>>
>> Regards
>> Akash Purandare
>> Oversight
>> akash.p1...@gmail.com
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to django-users+unsubscr...@googlegroups.com.
>> To 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/a3a73d40-c532-46f7-8da9-35178362cd63%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/CACzRgKiTL3Dbf%2BK-P1qxmxSCXC%3DvcDFtaYAf_9zOQP8dqEbohA%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/CA%2BLmcYvLESmc01Bf40qsVBOAVa76R4Nrjptvd9o2Qn8OJCzi%2Bg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Looking for a Django Intern in India

2019-03-30 Thread DEEPAK RAGHAV
Hello  Sir,

I am also looking for internsjp in Django.
contact no:7840037929

Thanks & Regards,
Deepak

On Fri, Mar 29, 2019 at 12:41 AM Akash Purandare 
wrote:

> Hello Django Developers
>
> We would like to provide you with opportunities to work in a live project
> on Django. This is an internship which requires you to collaborate
> effectively with other members of the team based in India.
>
> Requirements:
> Good Knowledge of Django
> Basic Knowledge of React
> Proficiency in Git and Heroku
>
> Interested developers can send their CV to the E-mail Akash Purandare
> .
> Vacancies: 2
>
> Regards
> Akash Purandare
> Oversight
> akash.p1...@gmail.com
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To 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/a3a73d40-c532-46f7-8da9-35178362cd63%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/CACzRgKiTL3Dbf%2BK-P1qxmxSCXC%3DvcDFtaYAf_9zOQP8dqEbohA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


[no subject]

2019-03-30 Thread Nanjuki Saidat
Hi all,
I am Saidat a new django developer, i need help on how to go about
this  " Change
admin portal URL to more obvious path and add link in side menu to admin
settings for admin users". In summary:


   1.  i want to change URL string to more intuitive URL (i.e.
   fhp.example.com/drunken-octo-lama/ to fhp.example.com/admin/)
   2. If a user is an admin user, show a link in the side menu to access
   admin settings page.

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


ModelForm for model that includes multiple items of one kind

2019-03-30 Thread Dean Karres
Hi

I am looking for some advice.  I have a basic Profile model.  It looks 
something like:

Profile:
first_name
middle_name
last_name
birthday
address_line1
address_line2
city
state
zip
email
phone

I have a ModelForm that goes with this.

This is sufficient for nearly all the cases I am trying to deal with.  
However, there are a few special cases in which a person needs to list two 
or more addresses; two or more email addrs; two or more phone numbers; or, 
combinations.  

I know just enough about database normalization to think that I need the 
Profile model plus Address, Email and Phone models and have the Profile 
have a ForeignKey relation to each of the others.  A la:

Profile:
first_name
middle_name
last_name
birthday




Address
address_line1
address_line2
City
state
zip

Email
email

Phone
phone

My question is more about the associated ModelForm(s).  First, I currently 
have a ModelForm for the first Profile model without the foreign keys.  If 
I break out the address, email and phone portions into separate models do I 
need to create separate model forms for each new model?  If so would the 
new Profile ModelFOrm just inherit the ModelForms of the other components. 
Something like:

class ProfileForm(ModelForm, AddressForm, EmailForm, PhoneForm):
...

The current ModelForm has "clean_" "clean" methods.  Do I keep that 
in the new Profile form?  Do I put the various "clean" methods in their own 
model forms and hope that inheritance will pull them in?

Next, how does a ModelForm deal with more than one of the same item -- like 
more then one address?

-- 
You received this message because you are subscribed to the Google Groups 
"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/a8954cd8-e3c6-4d6f-8780-1f88a9874a3b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Unit-Testing Django Views

2019-03-30 Thread Jorge Gimeno
The online version of the book is pinned to Django 1.11. You may want to
check that out.

-Jorge

On Sat, Mar 30, 2019 at 4:40 AM Test Bot  wrote:

> Sorry for the bother but I finally solved it by using Django's Test Client
> and checking for status_code and template used to render the response in my
> unit-test.
>
> Regards,
> Test Bot
>
> On Sat, Mar 30, 2019 at 5:00 PM Test Bot  wrote:
>
>> I tried removing the {% csrf_token %} from my index.html But it seemed to
>> have no effect. I got the following traceback for further clarity
>>
>> *
>>   START OF TRACEBACK*
>>
>> ===
>> python superlists/manage.py test
>> Creating test database for alias 'default'...
>> System check identified no issues (0 silenced).
>> .F.
>> Destroying test database for alias 'default'...
>> ==
>> FAIL: test_index_view_returns_correct_html (lists.tests.HomePageTest)
>> --
>> Traceback (most recent call last):
>>   File "superlists/lists/tests.py", line 25, in
>> test_index_view_returns_correct_html
>> self.assertEqual(expected_html, actual_html)
>> AssertionError: '> chars]lue="UUl2QtIopzqg9Co4uPlTlSuEPP2O44aMhda056gd4[201 chars]l>\n' !=
>> '> chars]l>\n'
>>
>> --
>> Ran 3 tests in 0.005s
>>
>> FAILED (failures=1)
>>
>> Process finished with exit code 1
>>
>> ===
>> *
>>END OF TRACEBACK*
>>
>>
>> On Fri, Mar 29, 2019 at 12:58 AM Aldian Fazrihady 
>> wrote:
>>
>>> There are several things you can try:
>>> 1. Mocking csrf token functions
>>> 2. Passing the csrf token context from first HTML generation to the
>>> second HTML generation
>>> 3. Wiping out the csrf token parts from both HTML before comparing them.
>>>
>>> On Thu, 28 Mar 2019, 23:54 Simon Charette,  wrote:
>>>
 This is effectively failing because of a mechanism added in 1.10 to
 protect
 against BREACH attacks[0] by salting the CSRF token.

 I'm not aware of any way to disable this mechanism but testing against
 the
 exact HTML returned from a view seems fragile.

 I suggest you use assertContains[1] (with or without html=True) and
 assertTemplateUsed[2] instead.

 Cheers,
 Simon

 [0] https://docs.djangoproject.com/en/2.1/ref/csrf/#how-it-works
 [1]
 https://docs.djangoproject.com/en/2.1/topics/testing/tools/#django.test.SimpleTestCase.assertContains
 [2]
 https://docs.djangoproject.com/en/2.1/topics/testing/tools/#django.test.SimpleTestCase.assertTemplateUsed

 Le jeudi 28 mars 2019 12:16:43 UTC-4, OnlineJudge95 a écrit :
>
> Hi people,
>
> I am following the book Test-Driven Development with Python
> 
>  by
> *Harry J.W. Perceval.* The book is using Django version 1.7 which is
> outdated as of now so I started with version 2.1.
>
> I am trying to unit test my index view. One unit-test that I have
> written is testing whether the index view returns correct HTML or not by
> comparing the input received through
> django.template.loader.render_to_string
> the unit-test fail with the following traceback
> python manage.py test
> Creating test database for alias 'default'...
> .System check identified no issues (0 silenced).
> F.
> ==
> FAIL: test_index_view_returns_correct_html (lists.tests.IndexViewTest)
> --
> Traceback (most recent call last):
>   File "tests.py", line 24, in test_index_view_returns_correct_html
> self.assertEqual(expected_html, actual_html)
> AssertionError: ' chars]lue="BJMT1b9fxuXOGugp00SDypeTYZxvlmc6KtBSYMDon[198 chars]l>\n' !=
> ' chars]l>\n'
>
> --
> Ran 3 tests in 0.006s
>
> FAILED (failures=1)
> Destroying test database for alias 'default'...
>
> Process finished with exit code 1
>
>
> It was clear that the csrf token is causing the test to fail. Is there
> any way to test it, or should it be tested? I ask this as when I changed 
> my
> Django version to 1.7, the tests were passing, even after giving the csrf
> token field in the form. I tried going through the changelogs but 1.7 is
> far behind (beginner here). Please find the code snippets, directory
> 

Re: Venv

2019-03-30 Thread Gurmeet Kaur
Go to scripts/activate.bat. it shud activate the ebv

On Sat, Mar 30, 2019, 2:32 PM John  wrote:

> Good evening
>
> I've created and activated venv like this:
> $ python3 -m venv 
> $ source /bin/activate
>
> Now Ive ‘deactivate’ the venv
>
> How do I re-activate 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/EA2E8453-8CF9-4F32-9EB6-D364C71D3FD4%40gmail.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

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


Re: Venv

2019-03-30 Thread Victor H. Velasquez Rizo
Hello John:
You have to be in the folder where the enviroment was created, then type
source /bin/activate

On Sat, Mar 30, 2019 at 1:32 PM John  wrote:

> Good evening
>
> I've created and activated venv like this:
> $ python3 -m venv 
> $ source /bin/activate
>
> Now Ive ‘deactivate’ the venv
>
> How do I re-activate 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/EA2E8453-8CF9-4F32-9EB6-D364C71D3FD4%40gmail.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>


-- 



Atte...,.
Vìctor Hugo Velàsquez Rizo
Cali - Colombia

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


Re: Venv

2019-03-30 Thread Gil Obradors
You do it: source /bin/activate

Missatge de John  del dia ds., 30 de març 2019 a
les 19:32:

> Good evening
>
> I've created and activated venv like this:
> $ python3 -m venv 
> $ source /bin/activate
>
> Now Ive ‘deactivate’ the venv
>
> How do I re-activate 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/EA2E8453-8CF9-4F32-9EB6-D364C71D3FD4%40gmail.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

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


Venv

2019-03-30 Thread John
Good evening

I've created and activated venv like this:
$ python3 -m venv 
$ source /bin/activate

Now Ive ‘deactivate’ the venv

How do I re-activate 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/EA2E8453-8CF9-4F32-9EB6-D364C71D3FD4%40gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re:

2019-03-30 Thread Victor H. Velasquez Rizo
Hello Carol.

Try this
https://tutorial.djangogirls.org/en/

On Sat, Mar 30, 2019 at 9:12 AM carol caro  wrote:

> Hello. I am a new or beginner django developer. Where do I start from
> I have installed python and integrated with Django framework but I don't
> know what to do next
>
> --
> You received this message because you are subscribed to the Google Groups
> "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/CAN%2Bowc-S7n3OX0jc_fLjro6unDSNZJU4yGbYsxTLGeh55%3DFQvA%40mail.gmail.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>


-- 



Atte...,.
Vìctor Hugo Velàsquez Rizo
Cali - Colombia

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


Re: Django 2.7.1 - "TemplateDoesNotExist at /munichlivingapp/seekers/ "

2019-03-30 Thread kamibarut609
Hello Mohammad.

thank you for your help.

If you read carefully the content of the thread, you will see that all the 
code was posted and I was able to figure things out thanks to the help of 
the developer.

K.

On Saturday, 30 March 2019 16:29:58 UTC+1, Mohammad Etemaddar wrote:
>
> Dear Kabiba,
> It would be good to post your code (specially the part that renders the 
> template). I think you're addressing the template by 'seeker_list.html'.
> You need to specify the mother directory 'munichi...app/seeker_list.html'.
> or put seeker_list.html right inside the templates directory.
>
> On Saturday, March 30, 2019 at 6:40:08 PM UTC+4:30, kamiba...@gmail.com 
> wrote:
>>
>> Hello,
>>
>> I thought I would post here the link to the question (which was not 
>> answered)  I just asked on Stackoverflow.
>>
>>
>> https://stackoverflow.com/questions/55431695/django-2-7-1-templatedoesnotexist-at-munichlivingapp-seekers
>>
>> Any suggestions are welcome. Thanks.
>>
>> K.
>>
>>
>>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To 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/b5681d25-5c3e-4cf5-9c52-7bea8a4af64b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Overriding settings in Django when used by the models

2019-03-30 Thread אורי
Hi Carlton,

1. I apologize for the time taking me to reply. I had other things to
handle before I could handle this issue.

2. The settings in models such as User are per class/model and not per
instance. You can see the models in the following file:
https://github.com/speedy-net/speedy-net/blob/staging/speedy/core/accounts/models.py

For example, you can see the following code:
AGE_VALID_VALUES_IN_MODEL = range(settings.MIN_AGE_ALLOWED_IN_MODEL,
settings.MAX_AGE_ALLOWED_IN_MODEL)
AGE_VALID_VALUES_IN_FORMS = range(settings.MIN_AGE_ALLOWED_IN_FORMS,
settings.MAX_AGE_ALLOWED_IN_FORMS)

These constants, for example, are used in the validators:
https://github.com/speedy-net/speedy-net/blob/staging/speedy/core/accounts/validators.py


def age_is_valid_in_model(age):
from .models import User
return (age in User.AGE_VALID_VALUES_IN_MODEL)


def age_is_valid_in_forms(age):
from .models import User
return (age in User.AGE_VALID_VALUES_IN_FORMS)


And also `User.settings` appears many times in our code.

In general the model in all the project uses the same constant values,
except in some tests where I want to override these values in order to test
some specific cases which can't be tested with the values used in
production. So I'm not sure using a property is the correct thing to do
here. I'm looking for a way to define settings per class/model, but in a
way that can be overridden in tests.

What do you think?

3. (Currently there is a hack I used in the tests, you can see `def
_1___set_up` in
https://github.com/speedy-net/speedy-net/blob/staging/speedy/core/base/test/models.py
but
it's a temporary hack and I don't think it's good as a permanent solution.

By the way, I tried to call the function ___set_up but it didn't work,
there is a problem with functions which start with 2 or more underlines.)

4. By the way, `validators` may be a property since it's only used per
instance, but I'm not sure about settings. Maybe I can use the settings
differently in `validators` and define it there as a property?

אורי
u...@speedy.net


On Thu, Jan 24, 2019 at 11:09 AM Carlton Gibson 
wrote:

> Hi Uri.
>
> Does it work if you make `User.settings` a property, that fetches the
> values dynamically, rather than assigning them once at import time?
>
> Something like:
>
> @property
> def settings(self):
> return django_settings.USER_SETTINGS
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "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/f15c64fa-4dac-4003-a619-0a2c612e9b71%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/CABD5YeE868KDtSOVCrRw-b_DUmPrOcgywvi92Mcdc2NSDW1%2B%3Dw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django 2.7.1 - "TemplateDoesNotExist at /munichlivingapp/seekers/ "

2019-03-30 Thread Mohammad Etemaddar
Dear Kabiba,
It would be good to post your code (specially the part that renders the 
template). I think you're addressing the template by 'seeker_list.html'.
You need to specify the mother directory 'munichi...app/seeker_list.html'.
or put seeker_list.html right inside the templates directory.

On Saturday, March 30, 2019 at 6:40:08 PM UTC+4:30, kamiba...@gmail.com 
wrote:
>
> Hello,
>
> I thought I would post here the link to the question (which was not 
> answered)  I just asked on Stackoverflow.
>
>
> https://stackoverflow.com/questions/55431695/django-2-7-1-templatedoesnotexist-at-munichlivingapp-seekers
>
> Any suggestions are welcome. Thanks.
>
> K.
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To 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/0ad1beef-8229-4fb5-bab1-5158ed4fe850%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re:

2019-03-30 Thread Jose Echenique
Hi, you can see, is very good.
http://www.moreware.org/books/The%20Definitive%20Guide%20to%20Django.pdf


El sáb., 30 de mar. de 2019 a la(s) 10:12, carol caro (carolcar...@gmail.com)
escribió:

> Hello. I am a new or beginner django developer. Where do I start from
> I have installed python and integrated with Django framework but I don't
> know what to do next
>
> --
> You received this message because you are subscribed to the Google Groups
> "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/CAN%2Bowc-S7n3OX0jc_fLjro6unDSNZJU4yGbYsxTLGeh55%3DFQvA%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/CACemh7VcotzQqosZ-MBUNnkam7qdJZPR9d7dF2asJHnsNomg_A%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re:

2019-03-30 Thread Gil Obradors
Hi Carol,

The next, for example, can be doing all the official tutorial :
https://docs.djangoproject.com/en/2.1/intro/tutorial01/#
This was my way

There are books too, I recommend you this editorial:
https://www.packtpub.com/



Good luck!!






Missatge de carol caro  del dia ds., 30 de març 2019
a les 15:12:

> Hello. I am a new or beginner django developer. Where do I start from
> I have installed python and integrated with Django framework but I don't
> know what to do next
>
> --
> You received this message because you are subscribed to the Google Groups
> "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/CAN%2Bowc-S7n3OX0jc_fLjro6unDSNZJU4yGbYsxTLGeh55%3DFQvA%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/CAK-JoTTsrq6SDbDAkrhRHyafcpxJOq1L1JUyJsV5_A2mKQgMiA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


[no subject]

2019-03-30 Thread carol caro
Hello. I am a new or beginner django developer. Where do I start from I
have installed python and integrated with Django framework but I don't know
what to do next

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


Django 2.7.1 - "TemplateDoesNotExist at /munichlivingapp/seekers/ "

2019-03-30 Thread kamibarut609
Hello,

I thought I would post here the link to the question (which was not 
answered)  I just asked on Stackoverflow.

https://stackoverflow.com/questions/55431695/django-2-7-1-templatedoesnotexist-at-munichlivingapp-seekers

Any suggestions are welcome. Thanks.

K.


-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To 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/183069ca-3a2d-418e-a534-95626385bff3%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Newbie question : running the makemigrations command in the terminal

2019-03-30 Thread kamibarut609
@jgi...@caktusgroup.com  Thank you for your help, I received some help on 
Stackoverflow.
@ Krishna Tulsyan Thank you for your help, I received some help on 
Stackoverflow.

On Friday, 29 March 2019 12:37:05 UTC+1, Krishna Tulsyan wrote:
>
> Hi,
> can you provide the folder structure of your app, and apps.py file
> ensure that the name of the app is 'munichlivin_app' and name of the class 
> in apps.py is 'MunichLivingConfig'
>
> On Thursday, March 28, 2019 at 9:05:46 PM UTC+5:30, kamiba...@gmail.com 
> wrote:
>>
>> Hello,
>>
>> (Newbie here): I am trying to run the makemigrations icommand in my 
>> terminal. You will find here below the three relevant files, the third one 
>> showing the errors displayed in 
>> the terminal. 
>>
>> My settings.py file:
>>
>>
>> https://pastebin.com/raw/xLpX0Zfg
>>
>>
>> My models.py file: 
>>
>> https://pastebin.com/raw/wYfSy8ET
>>
>>
>> The terminal entry (with the errors)
>>
>>
>> https://pastebin.com/raw/Pmpnepf1
>>
>>
>> Thank you for your time and your help.
>>
>>
>> K.
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To 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/cf03abe8-23b6-4709-a2ff-07c06f3da8e3%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Upgrading Django from 1.11 to 2.2

2019-03-30 Thread Tim Graham
Consider the "Upgrading Django to a newer version" guide.
https://docs.djangoproject.com/en/stable/howto/upgrade-version/

On Friday, March 29, 2019 at 4:52:10 AM UTC-4, Uri Even-Chen wrote:
>
> Hi,
>
> I want to upgrade Django from 1.11 to 2.2. Do I have to upgrade first to 
> 2.0 and then to 2.1, or can I upgrade directly from 1.11 to 2.2?
>
> By the way, we use many third-party packages and I'm not sure which 
> version of Django they support. Maybe not all of them already support 
> Django 2.2.
>
> Thanks!
> אורי
> u...@speedy.net 
>

-- 
You received this message because you are subscribed to the Google Groups 
"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/00868231-d3a9-4d4d-ab8e-f5de77c28745%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Unit-Testing Django Views

2019-03-30 Thread Test Bot
Sorry for the bother but I finally solved it by using Django's Test Client
and checking for status_code and template used to render the response in my
unit-test.

Regards,
Test Bot

On Sat, Mar 30, 2019 at 5:00 PM Test Bot  wrote:

> I tried removing the {% csrf_token %} from my index.html But it seemed to
> have no effect. I got the following traceback for further clarity
>
> *
> START OF TRACEBACK*
>
> ===
> python superlists/manage.py test
> Creating test database for alias 'default'...
> System check identified no issues (0 silenced).
> .F.
> Destroying test database for alias 'default'...
> ==
> FAIL: test_index_view_returns_correct_html (lists.tests.HomePageTest)
> --
> Traceback (most recent call last):
>   File "superlists/lists/tests.py", line 25, in
> test_index_view_returns_correct_html
> self.assertEqual(expected_html, actual_html)
> AssertionError: ' chars]lue="UUl2QtIopzqg9Co4uPlTlSuEPP2O44aMhda056gd4[201 chars]l>\n' !=
> ' chars]l>\n'
>
> --
> Ran 3 tests in 0.005s
>
> FAILED (failures=1)
>
> Process finished with exit code 1
>
> ===
> *
>  END OF TRACEBACK*
>
>
> On Fri, Mar 29, 2019 at 12:58 AM Aldian Fazrihady 
> wrote:
>
>> There are several things you can try:
>> 1. Mocking csrf token functions
>> 2. Passing the csrf token context from first HTML generation to the
>> second HTML generation
>> 3. Wiping out the csrf token parts from both HTML before comparing them.
>>
>> On Thu, 28 Mar 2019, 23:54 Simon Charette,  wrote:
>>
>>> This is effectively failing because of a mechanism added in 1.10 to
>>> protect
>>> against BREACH attacks[0] by salting the CSRF token.
>>>
>>> I'm not aware of any way to disable this mechanism but testing against
>>> the
>>> exact HTML returned from a view seems fragile.
>>>
>>> I suggest you use assertContains[1] (with or without html=True) and
>>> assertTemplateUsed[2] instead.
>>>
>>> Cheers,
>>> Simon
>>>
>>> [0] https://docs.djangoproject.com/en/2.1/ref/csrf/#how-it-works
>>> [1]
>>> https://docs.djangoproject.com/en/2.1/topics/testing/tools/#django.test.SimpleTestCase.assertContains
>>> [2]
>>> https://docs.djangoproject.com/en/2.1/topics/testing/tools/#django.test.SimpleTestCase.assertTemplateUsed
>>>
>>> Le jeudi 28 mars 2019 12:16:43 UTC-4, OnlineJudge95 a écrit :

 Hi people,

 I am following the book Test-Driven Development with Python
 
  by
 *Harry J.W. Perceval.* The book is using Django version 1.7 which is
 outdated as of now so I started with version 2.1.

 I am trying to unit test my index view. One unit-test that I have
 written is testing whether the index view returns correct HTML or not by
 comparing the input received through
 django.template.loader.render_to_string
 the unit-test fail with the following traceback
 python manage.py test
 Creating test database for alias 'default'...
 .System check identified no issues (0 silenced).
 F.
 ==
 FAIL: test_index_view_returns_correct_html (lists.tests.IndexViewTest)
 --
 Traceback (most recent call last):
   File "tests.py", line 24, in test_index_view_returns_correct_html
 self.assertEqual(expected_html, actual_html)
 AssertionError: '>>> chars]lue="BJMT1b9fxuXOGugp00SDypeTYZxvlmc6KtBSYMDon[198 chars]l>\n' !=
 '>>> chars]l>\n'

 --
 Ran 3 tests in 0.006s

 FAILED (failures=1)
 Destroying test database for alias 'default'...

 Process finished with exit code 1


 It was clear that the csrf token is causing the test to fail. Is there
 any way to test it, or should it be tested? I ask this as when I changed my
 Django version to 1.7, the tests were passing, even after giving the csrf
 token field in the form. I tried going through the changelogs but 1.7 is
 far behind (beginner here). Please find the code snippets, directory
 structure provided below.


 *lists/views.py*










 *from django.http import HttpResponsefrom django.shortcuts import render# 
 Create your views here.def index(request):if request.method == 'POST': 
return 

Re: Unit-Testing Django Views

2019-03-30 Thread Test Bot
I tried removing the {% csrf_token %} from my index.html But it seemed to
have no effect. I got the following traceback for further clarity

*
START OF TRACEBACK*
===
python superlists/manage.py test
Creating test database for alias 'default'...
System check identified no issues (0 silenced).
.F.
Destroying test database for alias 'default'...
==
FAIL: test_index_view_returns_correct_html (lists.tests.HomePageTest)
--
Traceback (most recent call last):
  File "superlists/lists/tests.py", line 25, in
test_index_view_returns_correct_html
self.assertEqual(expected_html, actual_html)
AssertionError: '\n' !=
'\n'

--
Ran 3 tests in 0.005s

FAILED (failures=1)

Process finished with exit code 1
===
*
 END OF TRACEBACK*


On Fri, Mar 29, 2019 at 12:58 AM Aldian Fazrihady  wrote:

> There are several things you can try:
> 1. Mocking csrf token functions
> 2. Passing the csrf token context from first HTML generation to the second
> HTML generation
> 3. Wiping out the csrf token parts from both HTML before comparing them.
>
> On Thu, 28 Mar 2019, 23:54 Simon Charette,  wrote:
>
>> This is effectively failing because of a mechanism added in 1.10 to
>> protect
>> against BREACH attacks[0] by salting the CSRF token.
>>
>> I'm not aware of any way to disable this mechanism but testing against the
>> exact HTML returned from a view seems fragile.
>>
>> I suggest you use assertContains[1] (with or without html=True) and
>> assertTemplateUsed[2] instead.
>>
>> Cheers,
>> Simon
>>
>> [0] https://docs.djangoproject.com/en/2.1/ref/csrf/#how-it-works
>> [1]
>> https://docs.djangoproject.com/en/2.1/topics/testing/tools/#django.test.SimpleTestCase.assertContains
>> [2]
>> https://docs.djangoproject.com/en/2.1/topics/testing/tools/#django.test.SimpleTestCase.assertTemplateUsed
>>
>> Le jeudi 28 mars 2019 12:16:43 UTC-4, OnlineJudge95 a écrit :
>>>
>>> Hi people,
>>>
>>> I am following the book Test-Driven Development with Python
>>> 
>>>  by
>>> *Harry J.W. Perceval.* The book is using Django version 1.7 which is
>>> outdated as of now so I started with version 2.1.
>>>
>>> I am trying to unit test my index view. One unit-test that I have
>>> written is testing whether the index view returns correct HTML or not by
>>> comparing the input received through
>>> django.template.loader.render_to_string
>>> the unit-test fail with the following traceback
>>> python manage.py test
>>> Creating test database for alias 'default'...
>>> .System check identified no issues (0 silenced).
>>> F.
>>> ==
>>> FAIL: test_index_view_returns_correct_html (lists.tests.IndexViewTest)
>>> --
>>> Traceback (most recent call last):
>>>   File "tests.py", line 24, in test_index_view_returns_correct_html
>>> self.assertEqual(expected_html, actual_html)
>>> AssertionError: '>> chars]lue="BJMT1b9fxuXOGugp00SDypeTYZxvlmc6KtBSYMDon[198 chars]l>\n' !=
>>> '>> chars]l>\n'
>>>
>>> --
>>> Ran 3 tests in 0.006s
>>>
>>> FAILED (failures=1)
>>> Destroying test database for alias 'default'...
>>>
>>> Process finished with exit code 1
>>>
>>>
>>> It was clear that the csrf token is causing the test to fail. Is there
>>> any way to test it, or should it be tested? I ask this as when I changed my
>>> Django version to 1.7, the tests were passing, even after giving the csrf
>>> token field in the form. I tried going through the changelogs but 1.7 is
>>> far behind (beginner here). Please find the code snippets, directory
>>> structure provided below.
>>>
>>>
>>> *lists/views.py*
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>> *from django.http import HttpResponsefrom django.shortcuts import render# 
>>> Create your views here.def index(request):if request.method == 'POST':  
>>>   return HttpResponse(request.POST['item_text'])return 
>>> render(request, 'index.html')*
>>>
>>>
>>> *lists/test.py*
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>> *from django.http import HttpRequestfrom django.template.loader import
>>> render_to_stringfrom django.test import TestCasefrom django.urls import
>>> resolvefrom lists.views import index# Create your tests here.class
>>> IndexViewTest(TestCase): 

Re: Unit-Testing Django Views

2019-03-30 Thread Test Bot
Thanks everyone for the clearance of the problem. I will remove the unit
test's logic to check fir template, it seems a viable test case along with
the status code value.

On Fri, Mar 29, 2019, 2:24 AM Chetan Ganji  wrote:

> There is one more way you could do it
>
>
> class TestIndexPageLoad(TestCase):
>
> def setUp(self):
> self.client = Client()
> self.response = self.client.get('/')
>
> def test_check_response(self):
> self.assertTemplateUsed(self.response, 'index.html')
>
>
>
> Regards,
> Chetan Ganji
> +91-900-483-4183
> ganji.che...@gmail.com
> http://ryucoder.in
>
>
> On Fri, Mar 29, 2019 at 1:56 AM Chetan Ganji 
> wrote:
>
>> I would prefer to just check the status code of the response object.
>> This is what I have done. You have to check if it works for forms with
>> csrf_token or not.
>>
>>
>> class TestReverseUrls(TestCase):
>>
>> def setUp(self):
>> self.client = Client()
>> self.reverseUrls = ['index', 'login', 'register']
>> self.response = {url:self.client.get(reverse(url)) for url in self
>> .reverseUrls}
>>
>> def test_reverse_urls(self):
>> for url in self.reverseUrls:
>> self.assertEqual(self.response[url].status_code, 200)
>>
>>
>>
>> Regards,
>> Chetan Ganji
>> +91-900-483-4183
>> ganji.che...@gmail.com
>> http://ryucoder.in
>>
>>
>> On Fri, Mar 29, 2019 at 12:57 AM Aldian Fazrihady 
>> wrote:
>>
>>> There are several things you can try:
>>> 1. Mocking csrf token functions
>>> 2. Passing the csrf token context from first HTML generation to the
>>> second HTML generation
>>> 3. Wiping out the csrf token parts from both HTML before comparing them.
>>>
>>> On Thu, 28 Mar 2019, 23:54 Simon Charette,  wrote:
>>>
 This is effectively failing because of a mechanism added in 1.10 to
 protect
 against BREACH attacks[0] by salting the CSRF token.

 I'm not aware of any way to disable this mechanism but testing against
 the
 exact HTML returned from a view seems fragile.

 I suggest you use assertContains[1] (with or without html=True) and
 assertTemplateUsed[2] instead.

 Cheers,
 Simon

 [0] https://docs.djangoproject.com/en/2.1/ref/csrf/#how-it-works
 [1]
 https://docs.djangoproject.com/en/2.1/topics/testing/tools/#django.test.SimpleTestCase.assertContains
 [2]
 https://docs.djangoproject.com/en/2.1/topics/testing/tools/#django.test.SimpleTestCase.assertTemplateUsed

 Le jeudi 28 mars 2019 12:16:43 UTC-4, OnlineJudge95 a écrit :
>
> Hi people,
>
> I am following the book Test-Driven Development with Python
> 
>  by
> *Harry J.W. Perceval.* The book is using Django version 1.7 which is
> outdated as of now so I started with version 2.1.
>
> I am trying to unit test my index view. One unit-test that I have
> written is testing whether the index view returns correct HTML or not by
> comparing the input received through
> django.template.loader.render_to_string
> the unit-test fail with the following traceback
> python manage.py test
> Creating test database for alias 'default'...
> .System check identified no issues (0 silenced).
> F.
> ==
> FAIL: test_index_view_returns_correct_html (lists.tests.IndexViewTest)
> --
> Traceback (most recent call last):
>   File "tests.py", line 24, in test_index_view_returns_correct_html
> self.assertEqual(expected_html, actual_html)
> AssertionError: ' chars]lue="BJMT1b9fxuXOGugp00SDypeTYZxvlmc6KtBSYMDon[198 chars]l>\n' !=
> ' chars]l>\n'
>
> --
> Ran 3 tests in 0.006s
>
> FAILED (failures=1)
> Destroying test database for alias 'default'...
>
> Process finished with exit code 1
>
>
> It was clear that the csrf token is causing the test to fail. Is there
> any way to test it, or should it be tested? I ask this as when I changed 
> my
> Django version to 1.7, the tests were passing, even after giving the csrf
> token field in the form. I tried going through the changelogs but 1.7 is
> far behind (beginner here). Please find the code snippets, directory
> structure provided below.
>
>
> *lists/views.py*
>
>
>
>
>
>
>
>
>
>
> *from django.http import HttpResponsefrom django.shortcuts import render# 
> Create your views here.def index(request):if request.method == 
> 'POST':return HttpResponse(request.POST['item_text'])return 
> render(request, 'index.html')*
>
>
> *lists/test.py*
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>

Re: how to find out if instagram accept the username and password of the bot?

2019-03-30 Thread Gourav Sardana
If the user enter incorrect credentials then you will redirect it to
another page or a pop up which shows wrong credentials.

def user_login(request):
if request.method == 'POST':
# First get the username and password supplied
username = request.POST.get('username')
password = request.POST.get('password')
# Django's built-in authentication function:
user = authenticate(username=username, password=password)
# If we have a user
if user:
#Check it the account is active
if user.is_active:
# Log the user in.
login(request, user)
if user.groups.filter(name='Doctor'):
return HttpResponse('Hey Doctor')
elif user.groups.filter(name='LabUser'):
return HttpResponseRedirect(reverse('patient_details'))
else:
return HttpResponse('Hey Customer')
else:
# If account is not active:
return HttpResponse("Your account is not active.")
else:
print("Someone tried to login and failed.")
print("They used username: {} and password: {}".format(username,password))
return HttpResponse("Invalid login details supplied.")


On Sat, 30 Mar 2019, 2:18 am Saeed Pooladzadeh,  wrote:

>
> I know what you mean but if the user inserts a wrong user and
> password what happens?
> در جمعه 29 مارس 2019، ساعت 23:48:26 (UTC+4:30)، Gourav Sardana نوشته:
>>
>> You have to make a form.py and define your form there.
>> In the views you have to make a validation for the username and the
>> password.
>>
>> On Sat, 30 Mar 2019, 12:44 am Saeed Pooladzadeh, 
>> wrote:
>>
>>> Hello,
>>>
>>> I'm a beginner at Django and Python and now plan to make a simple bot
>>> site for Instagram with instabot:
>>>
>>>
>>> https://github.com/instabot-py/instabot.py
>>>
>>> My problem is how can I find out if Instagram accept the username and
>>> password of the user or the username and password is wrong. How can I warn
>>> the user?
>>>
>>> thanks,
>>> Saeed
>>>
>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "Django users" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to django...@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/eac56b27-f17a-4fc9-8476-41f61feae520%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/cdd5ea94-8990-45b7-b011-a1bc68982630%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/CACdXjQLu72ixidLYZny18xqyQGH9dxFCw3GuEjLkrqQ8_N-VrA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


How to resolve UPPER_CASE naming issues in pylint

2019-03-30 Thread Dennis Alabi
My program throw up this error >>Constant name "movie_resource" doesn't 
conform to UPPER_CASE naming stylepylint(invalid-name)





"""vidly URL Configuration

The `urlpatterns` list routes URLs to views. For more information please 
see:
https://docs.djangoproject.com/en/2.1/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: path('', views.home, name='home')
Class-based views
1. Add an import: from other_app.views import Home
2. Add a URL to urlpatterns: path('', Home.as_view(), name='home')
Including another URLconf
1. Import the include() function: from django.urls import include, path
2. Add a URL to urlpatterns: path('blog/', include('blog.urls'))
"""
from django.contrib import admin
from django.urls import path, include
from api.models import MovieResource

movie_resource = MovieResource()


urlpatterns = [
path('admin/', admin.site.urls),
path('movies/', include('movies.urls')),
path('api/', include('movie_resource.urls'))
]

-- 
You received this message because you are subscribed to the Google Groups 
"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/a91173a8-058c-4b4a-a7db-183be3567e76%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.