Re: Django 1.10 with Python 3.5 on Mac with Fink

2017-01-31 Thread Alan
Found the problem, a old wrongly set DJANGO_SETTINGS_MODULE pointing to the
offending module.

On 30 January 2017 at 22:49, Alan  wrote:

> So I installed django 1.10 and then when I try to do this;
>
> python3.5 -m django --version
>
> Traceback (most recent call last):
>   File "/sw/lib/python3.5/runpy.py", line 193, in _run_module_as_main
> "__main__", mod_spec)
>   File "/sw/lib/python3.5/runpy.py", line 85, in _run_code
> exec(code, run_globals)
>   File "/sw/lib/python3.5/site-packages/django/__main__.py", line 9, in
> 
> management.execute_from_command_line()
>   File "/sw/lib/python3.5/site-packages/django/core/management/__init__.py",
> line 367, in execute_from_command_line
> utility.execute()
>   File "/sw/lib/python3.5/site-packages/django/core/management/__init__.py",
> line 316, in execute
> settings.INSTALLED_APPS
>   File "/sw/lib/python3.5/site-packages/django/conf/__init__.py", line
> 53, in __getattr__
> self._setup(name)
>   File "/sw/lib/python3.5/site-packages/django/conf/__init__.py", line
> 41, in _setup
> self._wrapped = Settings(settings_module)
>   File "/sw/lib/python3.5/site-packages/django/conf/__init__.py", line
> 97, in __init__
> mod = importlib.import_module(self.SETTINGS_MODULE)
>   File "/sw/lib/python3.5/importlib/__init__.py", line 126, in
> import_module
> return _bootstrap._gcd_import(name[level:], package, level)
>   File "", line 986, in _gcd_import
>   File "", line 969, in _find_and_load
>   File "", line 944, in
> _find_and_load_unlocked
>   File "", line 222, in
> _call_with_frames_removed
>   File "", line 986, in _gcd_import
>   File "", line 969, in _find_and_load
>   File "", line 956, in
> _find_and_load_unlocked
> ImportError: No module named 'ccpngrid'
>
> I don't even have PYTHONPATH set, I don't have any idea why is trying to
> import a module like 'ccpngrid' (which the closest thing related to python
> is that it is a django app within my Eclipse workspace, and no, I am not
> within these folders).
>
> So, I can at least try to start to sort this issue?
>
> Thanks,
>
> Alan
>
> --
> Alan Wilter SOUSA da SILVA, DSc
> Senior Bioinformatician, UniProt
> European Bioinformatics Institute (EMBL-EBI)
> European Molecular Biology Laboratory
> Wellcome Trust Genome Campus
> Hinxton
> Cambridge CB10 1SD
> United Kingdom
> Tel: +44 (0)1223 494588 <01223%20494588>
>



-- 
Alan Wilter SOUSA da SILVA, DSc
Senior Bioinformatician, UniProt
European Bioinformatics Institute (EMBL-EBI)
European Molecular Biology Laboratory
Wellcome Trust Genome Campus
Hinxton
Cambridge CB10 1SD
United Kingdom
Tel: +44 (0)1223 494588

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


Re: Can any one help me with this error "Page not found (404)" ?

2017-01-31 Thread Thames Khi
Once the polls app is created there is no reference to the root /project 
site!

On Wednesday, April 27, 2011 at 1:48:17 PM UTC+1, Oleg Lomaka wrote:
>
> Go on read 3rd part of tutorial about urls.py configuration
> http://docs.djangoproject.com/en/dev/intro/tutorial03/
>
>
> On Wed, Apr 27, 2011 at 8:13 AM, Maaz Muqri  > wrote:
>
>> Page not found (404)
>> Request Method: GET
>> Request URL:http://127.0.0.1:8000/
>> Using the URLconf defined in mysite.urls, Django tried these URL
>> patterns, in this order:
>> ^admin/
>> The current URL, , didn't match any of these.
>> You're seeing this error because you have DEBUG = True in your Django
>> settings file. Change that to False, and Django will display a
>> standard 404 page.
>>
>>
>> 
>>
>>
>> Iam getting this error when I am running the first Django Polls
>> Application. Can anyone say me where is this Django settings file ? I
>> am using Ubuntu operating system
>>
>>

-- 
You received this message because you are subscribed to the Google Groups 
"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/6ca311cf-ae0e-4297-9624-8743d23e03ed%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Django Channels alongside Django Rest Framework

2017-01-31 Thread adam . oxley
Hi everyone,

We are currently considering using Django Channels for implementing 
WebSockets into a project. I am wondering if it is known that Django 
Channels runs perfectly within the same Django project as DRF? 

I have spent a little time investigating this myself and could manage to 
get DRF working on its own, but channels not working, and channels working 
on its own but not DRF (in the same project), depending on whether I ran 
the daphne server or 'runserver' which I assume runs WSGI. Couldn't find 
anything online about getting these two side by side.

Thanks,
Adam

-- 
 

==

hedgehog lab is a limited company registered in England and Wales. 
Registered number: 05993194. Registered office: Generator Studios, 
Trafalgar Street, Newcastle Upon Tyne, NE1 2LA

-- 
You received this message because you are subscribed to the Google Groups 
"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/f13e0afc-98a4-4b4c-9315-48f95607e681%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


How can I solve the broken home page in the root folder?

2017-01-31 Thread Thames Khi
I followed a simple tutorial to create a sample application in DJango. Here 
is my code for urls.py in the root folder:

from django.conf.urls import url, include
from django.contrib import admin
#from data import views

urlpatterns = [

url(r'^data/', include('data.urls')),
url(r'^admin/', admin.site.urls),


I get this error:

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

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

   1. ^data/
   2. ^admin/

The current URL, , didn't match any of these.

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



The app http:///data/ works fine.


If I remove the line: url(r'^data/', include('data.urls')),


then the root app works a treat:


It worked!Congratulations on your first Django-powered page.

Is there a way to solve this or is there a way to redirect the page to 
another app? I really do not want to give out a website address with /data

Thank you very much.

Khi


-- 
You received this message because you are subscribed to the Google Groups 
"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/05cf9421-5481-4e6a-b1a9-0ae874dbe860%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: I have problem in when submitting song_form

2017-01-31 Thread Александр Христюхин (roboslone)
Hi, it's your model, you probably have "album" field, that is required and not 
filled by a view.

> On 31 Jan 2017, at 14:35, sridhar chary  wrote:
> 
> I don't no where i made mistake
> 
> DETAIL.HTML
> 
> 
> {% extends 'music/base.html'%}
> {% block title %}Album detail{%endblock%}
> {% block body %}
> 
> 
>   
>   
>   
>   
>
>   
>   {% if album.album_logo %}
>src="{{album.album_logo.url}}">
>   {% else %}
>   no images to display
>   {% endif %}
>   
>   
>   
> {{album.album_title}}{{album.genre}}
>   {{album.artist}}   
> 
>   {{album.genre}}
>   
> 
> 
> 
>
>   
>   
>href="#">View All
>href="{% url 'music:song-add' album.id %}">Add new Song
>   
>   
>   
>   All Songs
>   
>   
> 
> 
> Title
> Audio File
> Favorite
> Actions
> 
>   
>   
>   {% for song in 
> album.song_set.all%}
>   
>   
> 
>   {{song.song_title}}
>   
>   
>
>   
>   
> 
> 
>   Play
> 
> 
> 
>   
>
>   
>  class="glyphicon glyphicon-star">
> 
> 
> 
> {% csrf_token %}
>  value="" />
> 
>   Delete
> 
>   
> 
>  
>   {% endfor%}
>   
>   
>   
>   
>   
>   
>   
>   
>   
> 
> 
> {% endblock %}
> 
> URLS.py 
> 
> 
> from django.conf.urls import include, url
> from music import views
> 
> app_name = 'music'
> 
> urlpatterns = [
>#this music url
>url(r'^$', views.IndexView.as_view(), name='index'),
>#registration form
>url(r'^register/$', views.UserFormView.as_view(), name='register'),
>#this music/detail(album_id)
>url(r'^(?P[0-9]+)/$', views.DetailView.as_view(), name='detail'),
>url(r'album/add/$',views.AlbumCreate.as_view(), name='album-add'),
>#this music/id/is_favorite
>#url(r'^(?P[0-9]+)/favorite/$', views.favorite, name='favorite'),
># music/album/2
>url(r'^album/(?P[0-9]+)/$',views.AlbumUpdate.as_view(), 
> name='album-update'),
>#music/album/2
>url(r'^album/(?P[0-9]+)/delete/$',views.AlbumDelete.as_view(), 
> name='album-delete'),
>#music/album/song/
>url(r'^song/add/(?P[0-9]+)/$', views.SongCreate.as_view(), 
> name="song-add"),
>#music/album/song/
>   

Re: Can any one help me with this error "Page not found (404)" ?

2017-01-31 Thread ludovic coues
Could you share your urls.py files and the actual error you get ?

On 31 Jan 2017 1:09 p.m., "Thames Khi"  wrote:

Once the polls app is created there is no reference to the root /project
site!

On Wednesday, April 27, 2011 at 1:48:17 PM UTC+1, Oleg Lomaka wrote:
>
> Go on read 3rd part of tutorial about urls.py configuration
> http://docs.djangoproject.com/en/dev/intro/tutorial03/
>
>
> On Wed, Apr 27, 2011 at 8:13 AM, Maaz Muqri  wrote:
>
>> Page not found (404)
>> Request Method: GET
>> Request URL:http://127.0.0.1:8000/
>> Using the URLconf defined in mysite.urls, Django tried these URL
>> patterns, in this order:
>> ^admin/
>> The current URL, , didn't match any of these.
>> You're seeing this error because you have DEBUG = True in your Django
>> settings file. Change that to False, and Django will display a
>> standard 404 page.
>>
>> 
>> 
>>
>>
>> Iam getting this error when I am running the first Django Polls
>> Application. Can anyone say me where is this Django settings file ? I
>> am using Ubuntu operating system
>>
>> --
You received this message because you are subscribed to the Google Groups
"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/6ca311cf-ae0e-4297-9624-8743d23e03ed%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/CAEuG%2BTbNt6mpHuSb34HNudqMNjEdEk5ihR7Wv3PiWep%2BhnanzQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: How can I solve the broken home page in the root folder?

2017-01-31 Thread ludovic coues
Try "url(r'^/', include('data.urls'))," in url_patterns. This should do
what you want.

Alternatively, you can set a simple view on r'^$' that will redirect to
your main app.


On 31 Jan 2017 1:09 p.m., "Thames Khi"  wrote:

I followed a simple tutorial to create a sample application in DJango. Here
is my code for urls.py in the root folder:

from django.conf.urls import url, include
from django.contrib import admin
#from data import views

urlpatterns = [

url(r'^data/', include('data.urls')),
url(r'^admin/', admin.site.urls),


I get this error:

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

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

   1. ^data/
   2. ^admin/

The current URL, , didn't match any of these.

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



The app http:///data/ works fine.


If I remove the line: url(r'^data/', include('data.urls')),


then the root app works a treat:


It worked!Congratulations on your first Django-powered page.

Is there a way to solve this or is there a way to redirect the page to
another app? I really do not want to give out a website address with /data

Thank you very much.

Khi


-- 
You received this message because you are subscribed to the Google Groups
"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/05cf9421-5481-4e6a-b1a9-0ae874dbe860%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/CAEuG%2BTYiuTtONQc%3DuH5tXEmN6cFg9xzw_t5umuhx5HeCBX70Fg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Link to urls containing slug

2017-01-31 Thread 'dtdave' via Django users
 

Within my model I have the following that links through to a detail page.

def get_absolute_url(self):



kwargs = {

  'job_id': self.job_id,

  'slug': self.slug,

   }

return reverse('job_detail', kwargs=kwargs)


Everything works fine with this.


Within my urls.py I have the following:

url(r'^$', views.JobListView.as_view(), name='job_list'),

url(r'^(?P[-\w]*)/(?P[-\w]*)/$', views.JobDetail.as_view(), 
name='job_detail'),

url(r'^(?P[-\w]*)/(?P[-\w]*)/job_application/$', 
views.job_application, name=‘job_application'),


Then within my views.py the following:

def job_application(request, job_id, slug):

# Retrieve job by id

job = get_object_or_404(Job, job_id=job_id)

“””Other code here


However, I am having problems linking to this from my template in my detail 
page.

What structure should I be using to link to the job application from the 
job detail page?


I can access the url by going to 

http://localhost:8000/jobs/1/name-of-job/job_application/


Any advice would be appreciated

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


Re: How can I solve the broken home page in the root folder?

2017-01-31 Thread Thames Khi
Thank you very much.

I added the following to main site urls.py:

url(r'^$', views.home, name='home'),

and added the following to the /data/views.py file.

def home(request):
return HttpResponse("Main Page")

This somewhat makes sense, just wondering why the main site does not 
require a views.py file


On Tuesday, January 31, 2017 at 1:57:53 PM UTC, ludovic coues wrote:
>
> Try "url(r'^/', include('data.urls'))," in url_patterns. This should do 
> what you want.
>
> Alternatively, you can set a simple view on r'^$' that will redirect to 
> your main app.
>
>
> On 31 Jan 2017 1:09 p.m., "Thames Khi" > 
> wrote:
>
> I followed a simple tutorial to create a sample application in DJango. 
> Here is my code for urls.py in the root folder:
>
> from django.conf.urls import url, include
> from django.contrib import admin
> #from data import views
>
> urlpatterns = [
> 
> url(r'^data/', include('data.urls')),
> url(r'^admin/', admin.site.urls),
>
>
> I get this error:
>
> Page not found (404)
> Request Method: GET
> Request URL: http:///
>
> Using the URLconf defined in stockprices.urls, Django tried these URL 
> patterns, in this order:
>
>1. ^data/
>2. ^admin/
>
> The current URL, , didn't match any of these.
>
> You're seeing this error because you have DEBUG = True in your Django 
> settings file. Change that to False, and Django will display a standard 
> 404 page. 
>
>
>
> The app http:///data/ works fine.
>
>
> If I remove the line: url(r'^data/', include('data.urls')),
>
>
> then the root app works a treat:
>
>
> It worked!Congratulations on your first Django-powered page.
>
> Is there a way to solve this or is there a way to redirect the page to 
> another app? I really do not want to give out a website address with  url>/data
>
> Thank you very much.
>
> Khi
>
>
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to django-users...@googlegroups.com .
> To post to this group, send email to django...@googlegroups.com 
> .
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/django-users/05cf9421-5481-4e6a-b1a9-0ae874dbe860%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/e37f2c55-1b97-4d70-8a9a-5e9d32c9b54b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


RE: Link to urls containing slug

2017-01-31 Thread Matthew Pava
Assuming I’m understanding your question correctly, all you need to do is 
reference get_absolute_url in your template.
Something like so:

{{ job_application }}

From: 'dtdave' via Django users [mailto:django-users@googlegroups.com]
Sent: Tuesday, January 31, 2017 8:46 AM
To: Django users
Subject: Link to urls containing slug


Within my model I have the following that links through to a detail page.

def get_absolute_url(self):



kwargs = {

  'job_id': self.job_id,

  'slug': self.slug,

   }

return reverse('job_detail', kwargs=kwargs)



Everything works fine with this.



Within my urls.py I have the following:

url(r'^$', views.JobListView.as_view(), name='job_list'),

url(r'^(?P[-\w]*)/(?P[-\w]*)/$', views.JobDetail.as_view(), 
name='job_detail'),

url(r'^(?P[-\w]*)/(?P[-\w]*)/job_application/$', 
views.job_application, name=‘job_application'),



Then within my views.py the following:

def job_application(request, job_id, slug):

# Retrieve job by id

job = get_object_or_404(Job, job_id=job_id)

“””Other code here



However, I am having problems linking to this from my template in my detail 
page.

What structure should I be using to link to the job application from the job 
detail page?



I can access the url by going to

http://localhost:8000/jobs/1/name-of-job/job_application/



Any advice would be appreciated
--
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to 
django-users+unsubscr...@googlegroups.com.
To post to this group, send email to 
django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/0e6db077-52a8-4f23-862c-888ae0995e91%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/5e1e214b640c4d4f8c7c5e1d5cf0850b%40ISS1.ISS.LOCAL.
For more options, visit https://groups.google.com/d/optout.


Re: Link to urls containing slug

2017-01-31 Thread 'David Turner' via Django users
I had tried that but unfortunately it doesn't work but thanks anyway.


On 31/01/2017 14:57, Matthew Pava wrote:
>
> Assuming I’m understanding your question correctly, all you need to do
> is reference get_absolute_url in your template.
>
> Something like so:
>
>  
>
> {{ job_application }}
>
>  
>
> *From:*'dtdave' via Django users [mailto:django-users@googlegroups.com]
> *Sent:* Tuesday, January 31, 2017 8:46 AM
> *To:* Django users
> *Subject:* Link to urls containing slug
>
>  
>
> Within my model I have the following that links through to a detail page.
>
> def get_absolute_url(self):
>
> 
>
> kwargs = {
>
>   'job_id': self.job_id,
>
>   'slug': self.slug,
>
>}
>
> return reverse('job_detail', kwargs=kwargs)
>
>  
>
> Everything works fine with this.
>
>  
>
> Within my urls.py I have the following:
>
> url(r'^$', views.JobListView.as_view(), name='job_list'),
>
> url(r'^(?P[-\w]*)/(?P[-\w]*)/$',
> views.JobDetail.as_view(), name='job_detail'),
>
> url(r'^(?P[-\w]*)/(?P[-\w]*)/job_application/$',
> views.job_application, name=‘job_application'),
>
>  
>
> Then within my views.py the following:
>
> def job_application(request, job_id, slug):
>
> # Retrieve job by id
>
> job = get_object_or_404(Job, job_id=job_id)
>
> “””Other code here
>
>  
>
> However, I am having problems linking to this from my template in my
> detail page.
>
> What structure should I be using to link to the job application from
> the job detail page?
>
>  
>
> I can access the url by going to 
>
> http://localhost:8000/jobs/1/name-of-job/job_application/
>
>  
>
> Any advice would be appreciated
>
> -- 
> You received this message because you are subscribed to the Google
> Groups "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to django-users+unsubscr...@googlegroups.com
> .
> To post to this group, send email to django-users@googlegroups.com
> .
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/0e6db077-52a8-4f23-862c-888ae0995e91%40googlegroups.com
> .
> For more options, visit https://groups.google.com/d/optout.
>
> -- 
> You received this message because you are subscribed to a topic in the
> Google Groups "Django users" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/django-users/hlWrp8tzpXQ/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> django-users+unsubscr...@googlegroups.com
> .
> To post to this group, send email to django-users@googlegroups.com
> .
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/5e1e214b640c4d4f8c7c5e1d5cf0850b%40ISS1.ISS.LOCAL
> .
> 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/5412da70-2ee1-9259-1f28-71e85e6e4ab9%40gmail.com.
For more options, visit https://groups.google.com/d/optout.


creating models but its not showing in db

2017-01-31 Thread Kazi Atik
Hi i am creating  a table in my model but its not showing in my sqlite.db 
files i also run migrate command and makemigration
Here is my code



 
from
 django.db import models
from django.contrib.auth.models import User

class Others (models.Model):
education = models.TextField()
aim = models.TextField()
award = models.TextField()

please help me out this


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


Re: creating models but its not showing in db

2017-01-31 Thread Александр Христюхин (roboslone)
Did you run makemigrations first and then migrate?
Also, do you have any instances of your model?

> On 31 Jan 2017, at 19:08, Kazi Atik  wrote:
> 
> Hi i am creating  a table in my model but its not showing in my sqlite.db 
> files i also run migrate command and makemigration
> Here is my code
> 
> 
> 
> 
>  
> from
>  django.db import models
> from django.contrib.auth.models import User
> 
> class Others (models.Model):
> education = models.TextField()
> aim = models.TextField()
> award = models.TextField()
> 
> please help me out this
> 
> 
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to django-users+unsubscr...@googlegroups.com 
> .
> To post to this group, send email to django-users@googlegroups.com 
> .
> Visit this group at https://groups.google.com/group/django-users 
> .
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/django-users/24b80b57-45bc-41ac-ad12-935340139ead%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/A5B972EF-9CBF-4082-865B-5C195D6DA0CF%40gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: creating models but its not showing in db

2017-01-31 Thread rajanmandanka
please confirm whether you register your app in INSTALL_APP in settings.py 
file.

python manage.py makemigrations 
python manage.py migrate 




On Tuesday, January 31, 2017 at 9:38:34 PM UTC+5:30, Kazi Atik wrote:
>
> Hi i am creating  a table in my model but its not showing in my sqlite.db 
> files i also run migrate command and makemigration
> Here is my code
>
>
>
>  
> from
>  django.db import models
> from django.contrib.auth.models import User
>
> class Others (models.Model):
> education = models.TextField()
> aim = models.TextField()
> award = models.TextField()
>
> please help me out this
>
>
>

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


RE: Link to urls containing slug

2017-01-31 Thread Matthew Pava
Hi David,
Please make sure you have a get_absolute_url method on your JobApplication 
model in order for that to work and that you passing job_application in through 
the context in the template.
If you don’t have that method, you could use the {% url %} tag, but you would 
have to provide the pk and slug as arguments.
{{ job_application }}

Good luck!

From: 'David Turner' via Django users [mailto:django-users@googlegroups.com]
Sent: Tuesday, January 31, 2017 9:09 AM
To: django-users@googlegroups.com
Subject: Re: Link to urls containing slug


I had tried that but unfortunately it doesn't work but thanks anyway.

On 31/01/2017 14:57, Matthew Pava wrote:
Assuming I’m understanding your question correctly, all you need to do is 
reference get_absolute_url in your template.
Something like so:

{{ job_application }}

From: 'dtdave' via Django users [mailto:django-users@googlegroups.com]
Sent: Tuesday, January 31, 2017 8:46 AM
To: Django users
Subject: Link to urls containing slug


Within my model I have the following that links through to a detail page.

def get_absolute_url(self):



kwargs = {

  'job_id': self.job_id,

  'slug': self.slug,

   }

return reverse('job_detail', kwargs=kwargs)



Everything works fine with this.



Within my urls.py I have the following:

url(r'^$', views.JobListView.as_view(), name='job_list'),

url(r'^(?P[-\w]*)/(?P[-\w]*)/$', views.JobDetail.as_view(), 
name='job_detail'),

url(r'^(?P[-\w]*)/(?P[-\w]*)/job_application/$', 
views.job_application, name=‘job_application'),



Then within my views.py the following:

def job_application(request, job_id, slug):

# Retrieve job by id

job = get_object_or_404(Job, job_id=job_id)

“””Other code here



However, I am having problems linking to this from my template in my detail 
page.

What structure should I be using to link to the job application from the job 
detail page?



I can access the url by going to

http://localhost:8000/jobs/1/name-of-job/job_application/



Any advice would be appreciated
--
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to 
django-users+unsubscr...@googlegroups.com.
To post to this group, send email to 
django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/0e6db077-52a8-4f23-862c-888ae0995e91%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to a topic in the Google 
Groups "Django users" group.
To unsubscribe from this topic, visit 
https://groups.google.com/d/topic/django-users/hlWrp8tzpXQ/unsubscribe.
To unsubscribe from this group and all its topics, send an email to 
django-users+unsubscr...@googlegroups.com.
To post to this group, send email to 
django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/5e1e214b640c4d4f8c7c5e1d5cf0850b%40ISS1.ISS.LOCAL.
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/5412da70-2ee1-9259-1f28-71e85e6e4ab9%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/ms

Web-based Voting System for our capstone project

2017-01-31 Thread Genaro Lubong
I just want to ask, how can I customize my admin page and make some
dashboard about the students(who have already voted and those who haven't
yet), colleges and everything in my web app. As well as, how to print
reports. I am very willing to be taught and learn from you guys, I am just
a newbie to django, and advance thank you 😊😊😊

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


formset in form_class

2017-01-31 Thread schaf . mh
Hi All,
in a view deriving from UpdateView the form_class attribute gets assigned 
with a formset.
the View then overrides the get_form function.
class RLFormView(LoginRequiredMixin, StaffuserRequiredMixin, UpdateView):
template_name = 'abc/layout.html'
form_class = LayoutFormSet
fields = '__all__'

def get_form(self, form_class=None):
if self.request.POST:
return form_class(self.request.POST)
else:
initial = [{'param': 'a',
'choosen': 'value'}]
return form_class(initial=initial)


I'm just wondering if this is a nice way of using the formset? Normally a 
form is assigned to form_class.

Thanks for hints
Schaf

-- 
You received this message because you are subscribed to the Google Groups 
"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/bd486779-293d-42e8-8148-8562e05f71c3%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django Channels alongside Django Rest Framework

2017-01-31 Thread Andrew Godwin
Hi Adam,

The two should be able to coexist without any problem. If you put channels
into INSTALLED_APPS then "runserver" is actually running Daphne already
anyway, so it's worth noting if that's the case.

You have two options:
 - Run everything via Daphne, which will serve both HTTP and WebSocket
requests
 - Run WebSockets via Daphne, and HTTP to a WSGI server, and use something
like nginx in front to split the traffic based on path or header.

If you let me know the symptoms of how DRF didn't work via Daphne, I can
hopefully help you get things working.

Andrew

On Tue, Jan 31, 2017 at 3:05 AM,  wrote:

> Hi everyone,
>
> We are currently considering using Django Channels for implementing
> WebSockets into a project. I am wondering if it is known that Django
> Channels runs perfectly within the same Django project as DRF?
>
> I have spent a little time investigating this myself and could manage to
> get DRF working on its own, but channels not working, and channels working
> on its own but not DRF (in the same project), depending on whether I ran
> the daphne server or 'runserver' which I assume runs WSGI. Couldn't find
> anything online about getting these two side by side.
>
> Thanks,
> Adam
>
> ==
>
> hedgehog lab is a limited company registered in England and Wales.
> Registered number: 05993194. Registered office: Generator Studios,
> Trafalgar Street, Newcastle Upon Tyne, NE1 2LA
>
> --
> You received this message because you are subscribed to the Google Groups
> "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/f13e0afc-98a4-4b4c-9315-48f95607e681%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/CAFwN1urBCrZS1m1k%2BGyN0BbniEhoG2Phce9cLDcRk%2BM6daVnFw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Making email required

2017-01-31 Thread Larry Martell
I want to make the email field required in the user admin add and
change pages. Following some posts I read on stackoverflow I did this:

class MyUserCreationForm(UserCreationForm):
def __init__(self, *args, **kwargs):
super(MyUserCreationForm, self).__init__(*args, **kwargs)
# make user email field required
self.fields['email'].required = True

class UserAdmin(BaseUserAdmin):
form = MyUserCreationForm
add_form = MyUserCreationForm
add_fieldsets = ((None, {'fields': ('username', 'email',
'password1', 'password2'), 'classes': ('wide',)}),)

admin.site.unregister(User)
admin.site.register(User, UserAdmin)

This works fine in add user, but in change user I get the user's
encrypted password shown in the password field, instead of what you
normally see:

algorithm: pbkdf2_sha256 iterations: 24000 salt: ** hash:
**
Raw passwords are not stored, so there is no way to see this user's
password, but you can change the password using this form.

And when I try to save from the change screen it says "Please correct
the errors below." even though there are no errors shown.

How can I fix these issues in the change form?

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


Re: How to make django sqlite database connection readonly.

2017-01-31 Thread joeg
You just need to read 
doc: https://docs.djangoproject.com/en/1.10/topics/db/multi-db/

在 2017年1月31日星期二 UTC+13上午5:19:02,Chetan Gupta写道:
>
> Hi,
>
> I am new to django.
> My requirement is django application i have 3 db connection.
> I want 2 db connection is readonly.
>
> Please let me know how to do that.
>
> Regards
> Chetan
>

-- 
You received this message because you are subscribed to the Google Groups 
"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/764088e3-a473-418f-99be-8901636db07d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Send mail bug needs password passed as bytearray

2017-01-31 Thread elliot
myMail = EmailMessage('subject', 'message', 'someem...@address.com', 
['myem...@address.com'])
myMail.send()

The error I'm getting:

  File 
"/Users/Elliot/.virtualenvs/allright/lib/python2.7/site-packages/django/core/mail/message.py"
, line 342, in send

return self.get_connection(fail_silently).send_messages([self])

  File 
"/Users/Elliot/.virtualenvs/allright/lib/python2.7/site-packages/django/core/mail/backends/smtp.py"
, line 100, in send_messages

new_conn_created = self.open()

  File 
"/Users/Elliot/.virtualenvs/allright/lib/python2.7/site-packages/django/core/mail/backends/smtp.py"
, line 67, in open

self.connection.login(self.username, self.password)

  File 
"/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/smtplib.py"
, line 607, in login

(code, resp) = self.docmd(encode_cram_md5(resp, user, password))

  File 
"/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/smtplib.py"
, line 571, in encode_cram_md5

response = user + " " + hmac.HMAC(password, challenge).hexdigest()

  File 
"/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/hmac.py"
, line 75, in __init__

self.outer.update(key.translate(trans_5C))

TypeError: character mapping must return integer, None or unicode

There was solution from this ticket 
 with the same problem. But 
then the fixed commit was removed here 

.

The settings needed to send emails now

EMAIL_USE_TLS = True
EMAIL_HOST = 'smtp.webfaction.com'
EMAIL_HOST_USER = ''
EMAIL_HOST_PASSWORD = bytearray('**', 'utf-8')
EMAIL_PORT = 587

So 2 questions:

Am I missing something simple?

Is this a bug and needs a ticket?

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/87c6ac90-d579-4588-a4d2-f0f0e674095b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Send mail bug needs password passed as bytearray

2017-01-31 Thread Tim Graham
I've never seen a password as a bytearray. Is there webfaction 
documentation about this?

On Tuesday, January 31, 2017 at 6:06:04 PM UTC-5, 
ell...@makecollective.co.nz wrote:
>
> myMail = EmailMessage('subject', 'message', 'some...@address.com 
> ', ['mye...@address.com '])
> myMail.send()
>
> The error I'm getting:
>
>   File 
> "/Users/Elliot/.virtualenvs/allright/lib/python2.7/site-packages/django/core/mail/message.py"
> , line 342, in send
>
> return self.get_connection(fail_silently).send_messages([self])
>
>   File 
> "/Users/Elliot/.virtualenvs/allright/lib/python2.7/site-packages/django/core/mail/backends/smtp.py"
> , line 100, in send_messages
>
> new_conn_created = self.open()
>
>   File 
> "/Users/Elliot/.virtualenvs/allright/lib/python2.7/site-packages/django/core/mail/backends/smtp.py"
> , line 67, in open
>
> self.connection.login(self.username, self.password)
>
>   File 
> "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/smtplib.py"
> , line 607, in login
>
> (code, resp) = self.docmd(encode_cram_md5(resp, user, password))
>
>   File 
> "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/smtplib.py"
> , line 571, in encode_cram_md5
>
> response = user + " " + hmac.HMAC(password, challenge).hexdigest()
>
>   File 
> "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/hmac.py"
> , line 75, in __init__
>
> self.outer.update(key.translate(trans_5C))
>
> TypeError: character mapping must return integer, None or unicode
>
> There was solution from this ticket 
>  with the same problem. But 
> then the fixed commit was removed here 
> 
> .
>
> The settings needed to send emails now
>
> EMAIL_USE_TLS = True
> EMAIL_HOST = 'smtp.webfaction.com'
> EMAIL_HOST_USER = ''
> EMAIL_HOST_PASSWORD = bytearray('**', 'utf-8')
> EMAIL_PORT = 587
>
> So 2 questions:
>
> Am I missing something simple?
>
> Is this a bug and needs a ticket?
>
> 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/0bbf3721-2571-40a5-bb05-c970c96c9e8a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Send mail bug needs password passed as bytearray

2017-01-31 Thread elliot
Neither.

I haven't seen anything with webfaction and I have used webfaction in the 
past on several projects and not had any trouble.

On Wednesday, February 1, 2017 at 12:12:56 PM UTC+13, Tim Graham wrote:
>
> I've never seen a password as a bytearray. Is there webfaction 
> documentation about this?
>
> On Tuesday, January 31, 2017 at 6:06:04 PM UTC-5, 
> ell...@makecollective.co.nz wrote:
>>
>> myMail = EmailMessage('subject', 'message', 'some...@address.com', ['
>> mye...@address.com'])
>> myMail.send()
>>
>> The error I'm getting:
>>
>>   File 
>> "/Users/Elliot/.virtualenvs/allright/lib/python2.7/site-packages/django/core/mail/message.py"
>> , line 342, in send
>>
>> return self.get_connection(fail_silently).send_messages([self])
>>
>>   File 
>> "/Users/Elliot/.virtualenvs/allright/lib/python2.7/site-packages/django/core/mail/backends/smtp.py"
>> , line 100, in send_messages
>>
>> new_conn_created = self.open()
>>
>>   File 
>> "/Users/Elliot/.virtualenvs/allright/lib/python2.7/site-packages/django/core/mail/backends/smtp.py"
>> , line 67, in open
>>
>> self.connection.login(self.username, self.password)
>>
>>   File 
>> "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/smtplib.py"
>> , line 607, in login
>>
>> (code, resp) = self.docmd(encode_cram_md5(resp, user, password))
>>
>>   File 
>> "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/smtplib.py"
>> , line 571, in encode_cram_md5
>>
>> response = user + " " + hmac.HMAC(password, challenge).hexdigest()
>>
>>   File 
>> "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/hmac.py"
>> , line 75, in __init__
>>
>> self.outer.update(key.translate(trans_5C))
>>
>> TypeError: character mapping must return integer, None or unicode
>>
>> There was solution from this ticket 
>>  with the same problem. But 
>> then the fixed commit was removed here 
>> 
>> .
>>
>> The settings needed to send emails now
>>
>> EMAIL_USE_TLS = True
>> EMAIL_HOST = 'smtp.webfaction.com'
>> EMAIL_HOST_USER = ''
>> EMAIL_HOST_PASSWORD = bytearray('**', 'utf-8')
>> EMAIL_PORT = 587
>>
>> So 2 questions:
>>
>> Am I missing something simple?
>>
>> Is this a bug and needs a ticket?
>>
>> 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/a1218ddb-4b8b-4cac-a23b-df25f8419903%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Send mail bug needs password passed as bytearray

2017-01-31 Thread Tim Graham
Oh, I see, you're using bytearray to try to workaround the issue. Well, 
Django master no longer supports Python 2.7, that's why force_str() was 
removed. Is there a problem with Django master and Python 3?

On Tuesday, January 31, 2017 at 7:16:41 PM UTC-5, 
ell...@makecollective.co.nz wrote:
>
> Neither.
>
> I haven't seen anything with webfaction and I have used webfaction in the 
> past on several projects and not had any trouble.
>
> On Wednesday, February 1, 2017 at 12:12:56 PM UTC+13, Tim Graham wrote:
>>
>> I've never seen a password as a bytearray. Is there webfaction 
>> documentation about this?
>>
>> On Tuesday, January 31, 2017 at 6:06:04 PM UTC-5, 
>> ell...@makecollective.co.nz wrote:
>>>
>>> myMail = EmailMessage('subject', 'message', 'some...@address.com', ['
>>> mye...@address.com'])
>>> myMail.send()
>>>
>>> The error I'm getting:
>>>
>>>   File 
>>> "/Users/Elliot/.virtualenvs/allright/lib/python2.7/site-packages/django/core/mail/message.py"
>>> , line 342, in send
>>>
>>> return self.get_connection(fail_silently).send_messages([self])
>>>
>>>   File 
>>> "/Users/Elliot/.virtualenvs/allright/lib/python2.7/site-packages/django/core/mail/backends/smtp.py"
>>> , line 100, in send_messages
>>>
>>> new_conn_created = self.open()
>>>
>>>   File 
>>> "/Users/Elliot/.virtualenvs/allright/lib/python2.7/site-packages/django/core/mail/backends/smtp.py"
>>> , line 67, in open
>>>
>>> self.connection.login(self.username, self.password)
>>>
>>>   File 
>>> "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/smtplib.py"
>>> , line 607, in login
>>>
>>> (code, resp) = self.docmd(encode_cram_md5(resp, user, password))
>>>
>>>   File 
>>> "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/smtplib.py"
>>> , line 571, in encode_cram_md5
>>>
>>> response = user + " " + hmac.HMAC(password, challenge).hexdigest()
>>>
>>>   File 
>>> "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/hmac.py"
>>> , line 75, in __init__
>>>
>>> self.outer.update(key.translate(trans_5C))
>>>
>>> TypeError: character mapping must return integer, None or unicode
>>>
>>> There was solution from this ticket 
>>>  with the same problem. 
>>> But then the fixed commit was removed here 
>>> 
>>> .
>>>
>>> The settings needed to send emails now
>>>
>>> EMAIL_USE_TLS = True
>>> EMAIL_HOST = 'smtp.webfaction.com'
>>> EMAIL_HOST_USER = ''
>>> EMAIL_HOST_PASSWORD = bytearray('**', 'utf-8')
>>> EMAIL_PORT = 587
>>>
>>> So 2 questions:
>>>
>>> Am I missing something simple?
>>>
>>> Is this a bug and needs a ticket?
>>>
>>> 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/4a1f44d9-4310-4b4c-a9a2-a688f6d75111%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


video tutorial dating site

2017-01-31 Thread engrosswebhost
am new using python(django) i built an app lately but i want to build a 
dating site using django. I will be comfortable with video tutorials. Any 
help 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/2818f361-d0d0-46bb-bd5d-02d643f45232%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: video tutorial dating site

2017-01-31 Thread 'Aaron C. de Bruyn' via Django users
One of the first results when Googling 'Django video tutorials' is
this: https://www.quora.com/Are-there-any-good-Django-video-tutorials

There are many links provided there.

-A

On Tue, Jan 31, 2017 at 5:28 PM,   wrote:
> am new using python(django) i built an app lately but i want to build a
> dating site using django. I will be comfortable with video tutorials. Any
> help 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/2818f361-d0d0-46bb-bd5d-02d643f45232%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/CAEE%2BrGrq8_tnhy2NWTz9Y6wVM_5f1k1bBXTDX%3Dp1s-WVi5TrJg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Send mail bug needs password passed as bytearray

2017-01-31 Thread elliot
Really? I should look at moving to python 3 but my understanding was that 
python 2.7 would be supported until Django 2.0 according to the docs 


On Wednesday, February 1, 2017 at 1:21:21 PM UTC+13, Tim Graham wrote:
>
> Oh, I see, you're using bytearray to try to workaround the issue. Well, 
> Django master no longer supports Python 2.7, that's why force_str() was 
> removed. Is there a problem with Django master and Python 3?
>
> On Tuesday, January 31, 2017 at 7:16:41 PM UTC-5, 
> ell...@makecollective.co.nz wrote:
>>
>> Neither.
>>
>> I haven't seen anything with webfaction and I have used webfaction in the 
>> past on several projects and not had any trouble.
>>
>> On Wednesday, February 1, 2017 at 12:12:56 PM UTC+13, Tim Graham wrote:
>>>
>>> I've never seen a password as a bytearray. Is there webfaction 
>>> documentation about this?
>>>
>>> On Tuesday, January 31, 2017 at 6:06:04 PM UTC-5, 
>>> ell...@makecollective.co.nz wrote:

 myMail = EmailMessage('subject', 'message', 'some...@address.com', ['
 mye...@address.com'])
 myMail.send()

 The error I'm getting:

   File 
 "/Users/Elliot/.virtualenvs/allright/lib/python2.7/site-packages/django/core/mail/message.py"
 , line 342, in send

 return self.get_connection(fail_silently).send_messages([self])

   File 
 "/Users/Elliot/.virtualenvs/allright/lib/python2.7/site-packages/django/core/mail/backends/smtp.py"
 , line 100, in send_messages

 new_conn_created = self.open()

   File 
 "/Users/Elliot/.virtualenvs/allright/lib/python2.7/site-packages/django/core/mail/backends/smtp.py"
 , line 67, in open

 self.connection.login(self.username, self.password)

   File 
 "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/smtplib.py"
 , line 607, in login

 (code, resp) = self.docmd(encode_cram_md5(resp, user, password))

   File 
 "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/smtplib.py"
 , line 571, in encode_cram_md5

 response = user + " " + hmac.HMAC(password, challenge).hexdigest()

   File 
 "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/hmac.py"
 , line 75, in __init__

 self.outer.update(key.translate(trans_5C))

 TypeError: character mapping must return integer, None or unicode

 There was solution from this ticket 
  with the same problem. 
 But then the fixed commit was removed here 
 
 .

 The settings needed to send emails now

 EMAIL_USE_TLS = True
 EMAIL_HOST = 'smtp.webfaction.com'
 EMAIL_HOST_USER = ''
 EMAIL_HOST_PASSWORD = bytearray('**', 'utf-8')
 EMAIL_PORT = 587

 So 2 questions:

 Am I missing something simple?

 Is this a bug and needs a ticket?

 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/40d9f4eb-b7e6-4120-b6d1-0254577ec36a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Limiting choices in a lookup by exclusion

2017-01-31 Thread Gordon R. Burgess

I have this code, and with Django 1.10 it works as expected:

class Location(models.Model):
name = models.CharField(max_length = 32, unique = True)
street = models.CharField(max_length = 32)
detail = models.CharField(max_length = 32, blank = True, null = True)
city = models.CharField(max_length = 32)
state = USStateField()
zip = USZipCodeField()
phone = models.ManyToManyField(Phone, limit_choices_to = {'type_id':'H'})

but what I'd like to do is restrict the choices of phone numbers for Locations
to those that aren't 'C' (cell phones) - I've found some hints, but they're all
for older versions of Django - it seems like:

    phone = models.ManyToManyField(Phone, limit_choices_to =
{'type_id__ne':'C'})

ought to work - but this provokes a TypeError:

Related Field got invalid lookup: ne

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/1485922364.17463.7.camel%40parasamgate.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django 1.9 ./manage.py migrate error

2017-01-31 Thread Owen Chung
That works for me. You save my life. Thank you!

On Friday, June 3, 2016 at 12:26:04 PM UTC-4, Tejesh Papineni wrote:
>
> its working when already have a db because views.py are using Models from 
> already existing db. But when creating new db, code in views.py is trying 
> to access Models that have not yet been built using ./manage.py migrate. My 
> solution is to comment code in views.py that accesses Models or try except 
> with OperationalError , then run migrations (which will work now). 
> Afterwards revert to old views.py code.
>
> On Monday, March 7, 2016 at 4:20:16 AM UTC+5:30, Xuton Ion wrote:
>>
>> Hi, thanks for the reply.
>> So, did you have a db in the project? I cloned the project again and 
>> tried to create the db from the model, but using your suggestion doesn't 
>> work.
>> I can only get 1.9 working if I already have a db from 1.8, but not 
>> creating a new one from scratch.
>>
>> Neither the first or second line runs, they both exit with the same 
>> error. Table doesn't exist
>>
>> On Monday, 18 January 2016 08:08:38 UTC+13, Marisa DeMeglio wrote:
>>>
>>> Ok I had to run these commands to make it work:
>>>
>>> $manage.py makemigrations  
>>> $migrate --fake-initial.
>>>
>>> (for reference: django 1.9.1 / sqlite / OSX / python 3.4)
>>>
>>> On Sunday, January 17, 2016 at 9:48:22 AM UTC-8, Marisa DeMeglio wrote:

 Did you ever figure this out? I just upgraded from Django 1.8 to 1.9 
 and I'm having the same issue.

 On Saturday, December 12, 2015 at 10:01:39 PM UTC-8, Xuton Ion wrote:
>
> Thanks for the assistance so far.
>
> Reading https://docs.djangoproject.com/en/1.9/topics/migrations/ it 
> says I should be able to run migrate to apply migrations.
> But does this mean I have to manually do something, or should that 
> work the same as it did on 1.8?
>
> I am assuming that it should also be able to create the database from 
> the model with just running that one command.
>
> When creating a new project the migrate line runs fine, so it seems to 
> be something specific to the project. I cant share the project though
>
> On Saturday, 12 December 2015 19:14:55 UTC+2, Tim Graham wrote:
>>
>> Is there a reason you can't use migrations? --run-syncdb is really 
>> only meant for huge projects (hundreds or thousands of models) where 
>> migrations are too slow. Not sure why it's not working though. You'd 
>> have 
>> to project a sample project for me to debug further.
>>
>> On Saturday, December 12, 2015 at 11:53:37 AM UTC-5, Xuton Ion wrote:
>>>
>>> No, I haven't added any migrations. 
>>>
>>> I did try with --run-syncdb though, and still had the same error 
>>> though
>>>
>>> On Saturday, 12 December 2015 16:26:15 UTC+2, Tim Graham wrote:

 Does your application have migrations? Quoting the 1.9 release 
 notes, "Automatic syncing of apps without migrations is removed. 
 Migrations 
 are compulsory for all apps unless you pass the --run-syncdb 
 
  
 option to migrate."

 On Saturday, December 12, 2015 at 8:42:58 AM UTC-5, Xuton Ion wrote:
>
> Hi
>
> I seem to have an issue with running migrate and have been 
> googling all day without any luck
>
> I have an app which works and runs on 1.8
> After cloning the repo and creating a new ve, I ended up with 
> Django 1.9
>
> Running the ./manage.py migrate creates the database, but none of 
> the tables from the model. It returns
> django.db.utils.OperationalError: no such table: table_name
>
> If I delete the db.sqlite3 (still in dev so not postgress yet), 
> deactivate my ve and use my ve with django 1.8, the migrate line runs 
> fine. 
> If I then re-activate my ve with 1.9, everything works fine. I can 
> make changes and run makemigrations, and it works. But the initial 
> state 
> seems to not work
>
> Anyone else have the same issue, or have some advice for me?
>


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


Re: Link to urls containing slug

2017-01-31 Thread 'David Turner' via Django users
Hi Matthew

I think I might not have explained my issue fully.
Within my jobs models.py I have the following:
def get_absolute_url(self):
kwargs = {
  'job_id': self.job_id,
  'slug': self.slug,
   }
return reverse('job_detail', kwargs=kwargs)

I have the following urls patterns:
url(r'^$', views.JobListView.as_view(), name='job_list'),
url(r'^(?P[-\w]*)/(?P[-\w]*)/$', views.JobDetail.as_view(),
name='job_detail'),

At this stage everything works fine so that clicking on a job in the job
list takes you through to the detail for that job.
I have then created an application form for the jobs as follows:
def job_application(request, job_id, slug):
# Retrieve job by id
job = get_object_or_404(Job, job_id=job_id)
sent = False

if request.method == 'POST':
# Form was submitted
form = JobForm(request.POST)
if form.is_valid():
# Form fields passed validation
cd = form.cleaned_data
job_url = request.build_absolute_uri(job.get_absolute_url())
subject = '{} ({}) Application for  "{}"'.format(cd['name'],
cd['email'], job.title)
message = 'Application for "{}" at {}\n\n{}\'s comments:
{}'.format(job.title,  job_url, cd['name'], cd['comments'])
from_email = ''
to_list = ['']
send_mail(subject, message, from_email, to_list)
sent = True
else:
form = JobForm()
return render(request, 'jobs/job_application.html', {'job': job,
'form': form, 'sent': sent})

The url for this form is:
url(r'^(?P[-\w]*)/(?P[-\w]*)/job_application/$',
views.job_application, name='job_application'),

I can go to this link directly in my browser as follows:
http://localhost:8000/jobs/1/slug-name/job_application/
What I am looking to achieve is a link within the job detail page for that
specific job that takes you through to the application fom for that job.

Any advice gratefully appreciated.

On 31 January 2017 at 16:32, Matthew Pava  wrote:

> Hi David,
>
> Please make sure you have a get_absolute_url method on your JobApplication
> model in order for that to work and that you passing job_application in
> through the context in the template.
>
> If you don’t have that method, you could use the {% url %} tag, but you
> would have to provide the pk and slug as arguments.
>
>  slug=job_application.slug %}”>{{ job_application }}
>
>
>
> Good luck!
>
>
>
> *From:* 'David Turner' via Django users [mailto:django-users@
> googlegroups.com]
> *Sent:* Tuesday, January 31, 2017 9:09 AM
> *To:* django-users@googlegroups.com
> *Subject:* Re: Link to urls containing slug
>
>
>
> I had tried that but unfortunately it doesn't work but thanks anyway.
>
>
>
> On 31/01/2017 14:57, Matthew Pava wrote:
>
> Assuming I’m understanding your question correctly, all you need to do is
> reference get_absolute_url in your template.
>
> Something like so:
>
>
>
> {{ job_application }}
>
>
>
> *From:* 'dtdave' via Django users [mailto:django-users@googlegroups.com
> ]
> *Sent:* Tuesday, January 31, 2017 8:46 AM
> *To:* Django users
> *Subject:* Link to urls containing slug
>
>
>
> Within my model I have the following that links through to a detail page.
>
> def get_absolute_url(self):
>
>
>
> kwargs = {
>
>   'job_id': self.job_id,
>
>   'slug': self.slug,
>
>}
>
> return reverse('job_detail', kwargs=kwargs)
>
>
>
> Everything works fine with this.
>
>
>
> Within my urls.py I have the following:
>
> url(r'^$', views.JobListView.as_view(), name='job_list'),
>
> url(r'^(?P[-\w]*)/(?P[-\w]*)/$', views.JobDetail.as_view(),
> name='job_detail'),
>
> url(r'^(?P[-\w]*)/(?P[-\w]*)/job_application/$',
> views.job_application, name=‘job_application'),
>
>
>
> Then within my views.py the following:
>
> def job_application(request, job_id, slug):
>
> # Retrieve job by id
>
> job = get_object_or_404(Job, job_id=job_id)
>
> “””Other code here
>
>
>
> However, I am having problems linking to this from my template in my
> detail page.
>
> What structure should I be using to link to the job application from the
> job detail page?
>
>
>
> I can access the url by going to
>
> http://localhost:8000/jobs/1/name-of-job/job_application/
>
>
>
> Any advice would be appreciated
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/django-users/0e6db077-52a8-4f23-862c-888ae0995e91%40googlegroups.com
> 

Re: Limiting choices in a lookup by exclusion

2017-01-31 Thread C. Kirby
django doesn't have an ne operator in the orm. You want to use a negated Q 
object for your limit_choices_to. try:

from django.db.models import Q

phone = models.ManyToManyField(Phone, limit_choices_to = ~Q(type_id = 'C'))

On Wednesday, February 1, 2017 at 6:17:52 AM UTC+2, Gordon Burgess wrote:
>
>
> I have this code, and with Django 1.10 it works as expected:
>
> class Location(models.Model):
> name = models.CharField(max_length = 32, unique = True)
> street = models.CharField(max_length = 32)
> detail = models.CharField(max_length = 32, blank = True, null = True)
> city = models.CharField(max_length = 32)
> state = USStateField()
> zip = USZipCodeField()
> phone = models.ManyToManyField(Phone, limit_choices_to = 
> {'type_id':'H'})
>
> but what I'd like to do is restrict the choices of phone numbers for 
> Locations to those that aren't 'C' (cell phones) - I've found some hints, 
> but they're all for older versions of Django - it seems like:
>
> phone = models.ManyToManyField(Phone, limit_choices_to = 
> {'type_id__ne':'C'})
>
> ought to work - but this provokes a TypeError:
>
> Related Field got invalid lookup: ne
>
> 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/37b94253-fd0e-479f-8c0d-ffe262b1dcd4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.