Re: NEW USER

2023-06-05 Thread Jeff Kingsley
Hello Jawad Khan! It's great to hear that you've started working with
Django and are looking for guidance on how to start and complete a proper
website. Django is a powerful web framework that can help you build robust
and scalable websites.

To help you get started and complete your website, here are some general
steps to follow:

   1.

   Planning and Requirements Gathering:
   - Define the purpose and goals of your website.
  - Identify the target audience and their needs.
  - Gather requirements and determine the core features and
  functionality.
   2.

   Designing the Database:
   - Identify the data entities and relationships needed for your website.
  - Design the database schema using Django's Object-Relational Mapping
  (ORM) features.
  - Define models in Django to represent the database structure.
   3.

   Setting up the Django Project:
   - Install Django using pip.
  - Create a new Django project using the django-admin command.
  - Configure the project settings, such as database connection and
  static files.
   4.

   Creating Django Apps:
   - Divide your website's functionality into smaller, reusable components
  called apps.
  - Create Django apps for each major functionality of your website.
  - Define models, views, and templates specific to each app.
   5.

   Implementing Views and Templates:
   - Define views that handle user requests and render the appropriate
  templates.
  - Create HTML templates using Django's template language, which
  allows dynamic rendering of data.
   6.

   Implementing URLs and Routing:
   - Define URL patterns in your Django project's URL configuration file (
  urls.py).
  - Map URLs to appropriate views and apps.
   7.

   Testing and Debugging:
   - Write tests to ensure your website's functionality works as expected.
  - Use Django's built-in testing framework to run tests and identify
  any issues.
  - Debug and fix any errors or bugs that arise during development.
   8.

   Adding User Authentication and Security:
   - Implement user authentication and authorization using Django's
  built-in authentication system.
  - Apply security measures like input validation, CSRF protection, and
  secure handling of user data.
   9.

   Styling and Front-end Development:
   - Apply CSS styles and design elements to enhance the visual appearance
  of your website.
  - Use front-end frameworks like Bootstrap to create responsive and
  user-friendly interfaces.
   10.

   Deployment and Hosting:
   - Choose a hosting platform or server to deploy your Django website.
  - Configure the production settings, including database, static
  files, and security measures.
  - Deploy your Django project to the chosen server and ensure it is
  accessible to users.


On Sat, Jun 3, 2023 at 5:16 PM Jawad khan  wrote:

> I hope you are all doing well, I am Jawad Khan from Peshawar Pakistan,
> recently start working in Django. Please can any one help how to start and
> complete a proper website.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/aa14b313-d077-4992-a56b-994ea6b5cca9n%40googlegroups.com
> 
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAA9WjmF%2BmRZqPc%2BkAeWfduuohazLGAH7vrsJo59yG7KVLJ78gg%40mail.gmail.com.


Re: NEW USER

2023-06-05 Thread Jeff Kingsley
Hello Jawad Khan! It's great to hear that you've started working with
Django and are looking for guidance on how to start and complete a proper
website. Django is a powerful web framework that can help you build robust
and scalable websites.

To help you get started and complete your website, here are some general
steps to follow:

   1.

   Planning and Requirements Gathering:
   - Define the purpose and goals of your website.
  - Identify the target audience and their needs.
  - Gather requirements and determine the core features and
  functionality.
   2.

   Designing the Database:
   - Identify the data entities and relationships needed for your website.
  - Design the database schema using Django's Object-Relational Mapping
  (ORM) features.
  - Define models in Django to represent the database structure.
   3.

   Setting up the Django Project:
   - Install Django using pip.
  - Create a new Django project using the django-admin command.
  - Configure the project settings, such as database connection and
  static files.
   4.

   Creating Django Apps:
   - Divide your website's functionality into smaller, reusable components
  called apps.
  - Create Django apps for each major functionality of your website.
  - Define models, views, and templates specific to each app.
   5.

   Implementing Views and Templates:
   - Define views that handle user requests and render the appropriate
  templates.
  - Create HTML templates using Django's template language, which
  allows dynamic rendering of data.
   6.

   Implementing URLs and Routing:
   - Define URL patterns in your Django project's URL configuration file (
  urls.py).
  - Map URLs to appropriate views and apps.
   7.

   Testing and Debugging:
   - Write tests to ensure your website's functionality works as expected.
  - Use Django's built-in testing framework to run tests and identify
  any issues.
  - Debug and fix any errors or bugs that arise during development.
   8.

   Adding User Authentication and Security:
   - Implement user authentication and authorization using Django's
  built-in authentication system.
  - Apply security measures like input validation, CSRF protection, and
  secure handling of user data.
   9.

   Styling and Front-end Development:
   - Apply CSS styles and design elements to enhance the visual appearance
  of your website.
  - Use front-end frameworks like Bootstrap to create responsive and
  user-friendly interfaces.
   10.

   Deployment and Hosting:
   - Choose a hosting platform or server to deploy your Django website.
  - Configure the production settings, including database, static
  files, and security measures.
  - Deploy your Django project to the chosen server and ensure it is
  accessible to users.


On Sat, Jun 3, 2023 at 5:37 PM Abubakar Siddique 
wrote:

> Hi jawad,
> Yes, I can help you to achieve your goal
>
> Contct me
> Whatstapp
> 03158090326
>
> Thanks
>
> On Sat, Jun 3, 2023, 7:17 PM Jawad khan  wrote:
>
>> I hope you are all doing well, I am Jawad Khan from Peshawar Pakistan,
>> recently start working in Django. Please can any one help how to start and
>> complete a proper website.
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to django-users+unsubscr...@googlegroups.com.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/aa14b313-d077-4992-a56b-994ea6b5cca9n%40googlegroups.com
>> 
>> .
>>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAL2GMxSFXx6NFepKbijNaqVKD-JTwL_SCstd-Q-OoghboX1k0g%40mail.gmail.com
> 
> .
>

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


Re: Serving Media and Static files on Shared Hosting

2023-01-13 Thread Jeff Kingsley
Why

On Fri, Jan 13, 2023 at 11:56 AM Namanya Daniel 
wrote:

> Hello members,
>
> Has anyone ever used Namecheap shared hosting to serve static and media
> files? Apparently nginx can't be used, i only have WhiteNoise which serves
> static files only.
>
> kindly  share you've done it before.. thanks in advance
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/44a6e29d-65f1-443f-94d4-c9d119abbf77n%40googlegroups.com
> 
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAA9WjmFd%3DC-eOv%3DeKw5%3DKg7JMCPLiFs%3DwNv0zU07_vDMw59woQ%40mail.gmail.com.


Re: NEW BIE HERE HOW CAN I LEARN DJANGO FAST

2022-12-28 Thread Jeff Kingsley
can teach you


On Sun, Dec 25, 2022 at 12:08 PM Namanya Daniel 
wrote:

> While learning Django, pay attention to URLs and settings and models, the
> rest you need basic python skills
>
> On Sunday, December 25, 2022 at 2:14:06 AM UTC+3 guru...@gmail.com wrote:
>
>> Hey, I just want to know how you've learned django framework and what
>> resources did you use. It would be great if anyone can suggest me some
>> studying resources.
>> 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/1dd19704-2e56-47b9-815a-6d76b0e9adfen%40googlegroups.com
> 
> .
>

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


Re: Reply: Re: Hosting django with Namecheap

2022-11-08 Thread Jeff Kingsley
Do you have root access oba you are just using cpanel. I do think you will
be able to succeed with cpanel, you need VSP.

On Tue, Nov 8, 2022 at 3:58 PM bradie poa  wrote:

> its not a good idea
>
> i have settings.py in the same folder with wsgi.py
>
>
> On Tuesday, November 8, 2022 at 4:07:09 AM UTC-8 Kasper Laudrup wrote:
>
>> On 08/11/2022 10.41, Namanya Daniel wrote:
>> > Hello, am hosting a django application with namecheap for the very
>> first
>> > time and am getting " Internal Server ErrorError 500" , in the error
>> > log, wsgi.py shows that there's not settings
>> >
>> > how do i handle this
>> >
>>
>> You add the settings.
>>
>> Kind regards,
>> Kasper Laudrup
>>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/9f4bfc65-8319-4c19-85b2-7ac7ff1d7ff9n%40googlegroups.com
> 
> .
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/03931t9smoccio3p86jn4id8.1667912304054%40email.vivo.com
> 
> .
>

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


Re: Hosting django with Namecheap

2022-11-08 Thread Jeff Kingsley
Which web server do you use?

On Tue, Nov 8, 2022 at 3:55 PM Namanya Daniel 
wrote:

> i have settings.py in the same folder with wsgi.py
>
>
> On Tuesday, November 8, 2022 at 4:07:09 AM UTC-8 Kasper Laudrup wrote:
>
>> On 08/11/2022 10.41, Namanya Daniel wrote:
>> > Hello, am hosting a django application with namecheap for the very
>> first
>> > time and am getting " Internal Server ErrorError 500" , in the error
>> > log, wsgi.py shows that there's not settings
>> >
>> > how do i handle this
>> >
>>
>> You add the settings.
>>
>> Kind regards,
>> Kasper Laudrup
>>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/9f4bfc65-8319-4c19-85b2-7ac7ff1d7ff9n%40googlegroups.com
> 
> .
>

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


Populate script not working

2020-04-01 Thread Jeff Waters
I've created a population script to test my website - please see below - but I 
get the following error message: django.contrib.auth.models.DoesNotExist: User 
matching query does not exist.

Given that I've created a hypothetical user, I'm not sure why this is?

Any suggestions would much appreciated.

Thank you.

Jeff

EDIT : I have done both makemigrations and migrate.

import os
import django

os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'mynowandthen.settings')
django.setup()

from django.contrib.auth.models import User
from nowandthen.models import Picture, Comment, UserProfile

def populate():
banana_user = [{'username': 'Banana','email': 'ban...@cat.com', 
'password': 'Banana1234'},]
johann_user = [{'username': 'Banana', 'email': 'ban...@cat.com', 
'password': 'Banana1234'},]
wmffre_user = [{'username': 'Wmffre', 'email': 'wmf...@cat.com', 
'password': 'Wmffre1234'},]


maryhill_comments = [{'user': banana_user,
'body': 'wowo I love this photo - reminds me of when I used to live 
there!'},
{'user': johann_user,'body': 'I love Maryhill - its such a pretty part 
of Glasgow lol'},
{'user': wmffre_user,'body': 'gonnae no dae that lol', 'user_id': 3}]

fireworks_comments = [{'user': banana_user,'body': 'amazing fireworks - 
thanks for sharing :)'},
{'user': johann_user,'body': 'love fireworks, love this, love YOU!'},
{'user': wmffre_user,'body': 'whoop!'}]

cityscape_comments = [{'user': banana_user,'body': 'more pics like this one 
please!!'},
{'user': johann_user,'body': 'what a sucky picture hahah'},
{'user': wmffre_user,'body': 'great - love it!'}]

pics = {'Maryhill': {'comments': maryhill_comments,
 'image': 
'shared_pics/View-from-kitchen-window-of-Maryhill-tenements.1970.jpg',
 'title': 'Maryhill Laundry',
 'description': 'back view',
 'tag_one': 'Maryhill',
 'tag_two': 'Laundry',
 'era': '1970s',
 'likes': 64},
'Fireworks': {'comments': fireworks_comments,
  'image': 'shared_pics/fireworks.jpg',
  'title': 'Glasgow Fireworks',
  'description': 'Fireworks at Glasgow Green',
  'tag_one': 'Glasgow',
  'tag_two': 'Fireworks',
  'era': '2010s',
  'likes': 32},
'Cityscape': {'comments': cityscape_comments,
  'image': 'shared_pics/glasgow_cityscape_copy.jpg',
  'title': 'Glasgow Cityscape',
  'descrpition': 'View over Glasgow',
  'tag_one': 'Cityscape',
  'tag_two': 'Glasgow',
  'era': '1990s',
  'likes': 16}}

for pic, pic_data in pics.items():
p = add_picture(pic,
pic_data['image'],
pic_data['title'],
pic_data['description'],
pic_data['tag_one'],
pic_data['tag_two'],
pic_data['era'])
for c in pic_data['comments']:
add_comment(c[0], c[1])

for p in Picture.objects.all():
for c in Comment.objects.filter(picture=p):
print(f' - {p}: {c}')


def add_user(name, email, password):
u = User.objects.get_or_create(username=name, first_name='Test', 
last_name='User', email=email)[0]
u.set_password(password)
up = UserProfile.objects.get_or_create(user=u)[0]
u.save()
return up


def add_picture(image, title, description, tag_one, tag_two, era, likes=0):
p = Picture.objects.get_or_create(image=image, title=title)[0]
p.description = description
p.tag_one = tag_one
p.tag_two = tag_two
p.era = era
p.like = likes
p.save()
return p


def add_comment(user, body):
u = User.objects.get(username=user)
up = UserProfile.objects.get(user=u)
c = Comment.objects.get_or_create(user=up, body=body)[0]
c.save()
return c


if __name__ == '__main__':
print('Starting Now And Then population script...')
populate()

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/d5bfae89-4351-4760-9539-923c1b398a13%40googlegroups.com.


Re: Associating comments with images

2020-04-01 Thread Jeff Waters
Thanks Andreas

When I do that, I get an error message: NoReverseMatch at /photo_feed/

Could the problem be with my add_comment.html?

The code for that is as follows:

{% extends 'nowandthen/base.html' %}
{% load staticfiles %}
{% block title_block %}
Add self
{% endblock %}
{% block body_block %}
Add a Comment


{% csrf_token %}
{{ form.as_p }}



{% endblock %}

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/493eaf33-0918-4f6c-9dcb-59465ff2c616%40googlegroups.com.


Re: Associating comments with images

2020-04-01 Thread Jeff Waters
Thank you Andreas.

This is the views.py - 
https://github.com/EmilyQuimby/my_now_and_then/blob/master/nowandthen/views.py

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/944c9708-34f5-497a-a877-ecd66cd0fbca%40googlegroups.com.


Re: Associating comments with images

2020-04-01 Thread Jeff Waters
Thanks Andreas

I think that one of the mistakes I'd made previously was to not associate 
particular comments with particular pictures. 

I've tried to rectify that using the code below. However, when I do this, the 
page I get is empty. 

Any advice would be appreciated:

{% extends 'nowandthen/base.html' %}
{% block body_block %}


{% if pictures %}

{% for p in Picture.objects.all %}

  



  





  
{{ p.title 
}}
  
{{ 
p.when_added }}



  







  



  
{{ 
p.description }}
  
Click for description







comments
{% if not p.comments %}
No comments
{% endif %}
{% for x in p.comment %}


Comment by {{ x.user }}

{{ x.created_on }}


{{ x.body | linebreaks }}

{% endfor %}


{% if new_comment %}
Your comment has been posted.
{% else %}
Leave a comment

{{ comment_form.as_p }}
{% csrf_token %}
Submit
{% endif %}


  


{% endfor %}

{% else %}
There are no photographs present.
{% endif %}

{% endblock %}


Thanks

Jeff

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/7a56b57b-42e9-42be-bc9f-3ed8714cf444%40googlegroups.com.


Re: NoReverseMatch error message - Please help

2020-03-31 Thread Jeff Waters
Thanks Ryan.

I've just tried that, but I still get an error message. 

By the way, is it definitely .id and not _id? I've seen both, and Django docs 
says: 'Behind the scenes, Django appends "_id" to the field name to create its 
database column name, which makes me wonder if it might be _id.

Incidentally, I've also tried amending the relevant URL path to 
path('add_comment/', views.add_comment, name='add_comment') - 
with underscore and with a dot before the id - but that doesn't work.

Jeff



-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/4473f031-abfa-428a-8804-debaf5a41c93%40googlegroups.com.


Associating comments with images

2020-03-31 Thread Jeff Waters
I am creating a website where users can comment on photos in a gallery. The 
challenge I currently have is that Django is not able to determine which of the 
photos the comment 'submit' button relates to. 

This is my HTML code for the photo gallery:

comments
{% if not comments %}
No comments
{% endif %}
{% for x in comment %}


Comment by {{ x.user }}

{{ x.created_on }}


{{ x.body | linebreaks }}

{% endfor %}


{% if new_comment %}
Your comment has been posted.
{% else %}
Leave a comment

{{ comment_form.as_p }}
{% csrf_token %}
Submit
{% endif %}

How do you suggest I overcome this problem, please?

Thanks

Jeff

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/cabe2b94-bf00-4394-b699-8a15d48247d2%40googlegroups.com.


NoReverseMatch error message - Please help

2020-03-31 Thread Jeff Waters
I am putting together a website which has a photo gallery where users can add 
comments. When I go to the photo gallery page, I get the following error 
message:

NoReverseMatch at /photo_feed/ Reverse for 'add_comment' with arguments '('',)' 
not found. 1 pattern(s) tried: ['add_comment/$']

The code for the relevant part of the HTML document is as follows:

comments
{% if not comments %}
No comments
{% endif %}
{% for x in comment %}


Comment by {{ x.user }}

{{ x.created_on }}


{{ x.body | linebreaks }}

{% endfor %}


{% if new_comment %}
Your comment has been posted.
{% else %}
Leave a comment

{{ comment_form.as_p }}
{% csrf_token %}
Submit
{% endif %}
The URLs.py entry for add_comment is path('add_comment/', 
views.add_comment, name='add_comment'). Removing the int: image_id doesn't fix 
the problem.

When I go into admin, no ids appear to have been generated for the photos. 
Could it be that the problem is that there are missing IDs? If so, how do I fix 
this?

The repository URL is https://github.com/EmilyQuimby/my_now_and_then.

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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/bb078990-f0e1-484a-a3dc-366f018b1df6%40googlegroups.com.


Re: HTML code not being read

2020-03-30 Thread Jeff Waters
I've modified my code a bit to try (unsuccessfully!) to get this working.

My views.py is now as follows:

@login_required
def add_comment(request, image_id):
new_comment = None
template_name = 'add_comment.html'
image = get_object_or_404(Picture, id=image_id)
comment = image.comments.filter(active=True)
new_comment = None
# Comment posted
if request.method == 'POST':
comment_form = CommentForm(request.POST)
if comment_form.is_valid():
# Create Comment object and don't save to database yet
new_comment = comment_form.save(commit=False)
# Assign the current post to the comment
new_comment.post = post
# Save the comment to the database
new_comment.save()
else:
comment_form = CommentForm()

context = {'image': image,'comment': comment, 'new_comment': 
new_comment,'comment_form': comment_form}

return render(request, template_name, context)

My html code for the gallery is now:

comments
{% if not comments %}
No comments
{% endif %}
{% for comment in comment %}


Comment by {{ comment.user }}

{{ comment.created_on }}


{{ comment.body | linebreaks }}

{% endfor %}

The problem I now have is that I now get the following error message: Reverse 
for 'add_comment' with arguments '('',)' not found. 1 pattern(s) tried: 
['add_comment/(?P[0-9]+)$']

Any suggestions would be much appreciated.

Thanks

Jeff

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/e2212e12-d379-4bcb-8c96-eff4c89c5245%40googlegroups.com.


Re: HTML code not being read

2020-03-30 Thread Jeff Waters
Thanks guys

I previously had 'comments' in the plural in views.py, but had the same 
problem. 

Am I right in thinking that Django recognises that 'comments' is the plural of 
'comment', so if it knows from the view what a comment is, it knows what 
comments are?

Thanks,

Jeff

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/055a99d8-a18f-4235-b133-feb9dd206930%40googlegroups.com.


Re: HTML code not being read

2020-03-30 Thread Jeff Waters
Hi 

I'm not sure what you mean by 'Have you all ready use a content that define 
your content'.

I'm new to Django, so am not familiar with all of the terminology yet.

Can you elaborate please?

Thanks

Jeff

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/5e97ab38-2663-4943-b4b8-bf6e3ea744a5%40googlegroups.com.


Re: HTML code not being read

2020-03-30 Thread Jeff Waters
Hi 

Thanks for getting back to me.

This is from my views.py:

@login_required
def add_comment(request, image_id):
new_comment = None
template_name = 'add_comment.html'
image = get_object_or_404(Picture, id=image_id)
comment = image.comment.filter(active=True)
new_comment = None
# Comment posted
if request.method == 'POST':
comment_form = CommentForm(data=request.POST)
if comment_form.is_valid():
# Create Comment object and don't save to database yet
new_comment = comment_form.save(commit=False)
# Assign the current post to the comment
new_comment.post = post
# Save the comment to the database
new_comment.save()
else:
comment_form = CommentForm()

context = {'comment_form': comment_form, 'image': image,'comment': comment, 
'new_comment': new_comment,'comment_form': comment_form}

return render(request, template_name, context)

Does that look correct to you?

Jeff

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/7f92c0a3-07cc-4b33-ba37-e32bc24c5386%40googlegroups.com.


HTML code not being read

2020-03-30 Thread Jeff Waters
Hi

I have written some code that allows users of a website to comment on photos in 
a picture gallery, using a form. However, when I test the code, no comments are 
displayed.

It would appear that Django is not processing the following code (from my HTML 
file for the photo gallery), given that 'Comment by' is not displayed on screen:

{% for comment in comments %}


Comment by {{ comment.user }}

{{ comment.created_on }}


{{ comment.body | linebreaks }}

{% endfor %}

Does anyone have any suggestions as to how I can fix this, please?

Thank you.

Jeff

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/4666d2ec-e4d8-492d-8203-03dfecd29d6a%40googlegroups.com.


Re: Form not displaying

2020-03-30 Thread Jeff Waters
Will do, 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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/0969e788-8cea-40a0-acc8-655bfa8ab2ce%40googlegroups.com.


Re: Form not displaying

2020-03-30 Thread Jeff Waters
Thanks Ernest.

I'm not sure I follow (forgive me, I am very new to Django).

Given that template_name is defined earlier in the method as 
'add_comment.html', surely what I've written is equivalent to:

return render(request, add_comment.html, {'image': image,
   'comments': comments,
   'new_comment': new_comment,
   'comment_form': comment_form})

What should the code be instead?

Thanks

Jeff

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/8e5fcc67-5a91-4371-a51a-9860a6cc78e3%40googlegroups.com.


Re: Form not displaying

2020-03-30 Thread Jeff Waters
Sure. It's as follows:

@login_required
def add_comment(request, image_id):
template_name = 'add_comment.html'
image = get_object_or_404(Picture, id=image_id)
comments = image.comments.filter(active=True)
new_comment = None
# Comment posted
if request.method == 'POST':
comment_form = CommentForm(data=request.POST)
if comment_form.is_valid():
# Create Comment object and don't save to database yet
new_comment = comment_form.save(commit=False)
# Assign the current post to the comment
new_comment.post = post
# Save the comment to the database
new_comment.save()
else:
comment_form = CommentForm()

return render(request, template_name, {'image': image,
   'comments': comments,
   'new_comment': new_comment,
   'comment_form': comment_form})



Thanks

Jeff

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/8e0f5a28-7a48-4037-aba5-ea591a81d397%40googlegroups.com.


Form not displaying

2020-03-29 Thread Jeff Waters
Apologies if I'm posting this twice - my original message isn't displayed in 
the list of messages.

I am creating a website using Django. I'd like to give users the chance to 
comment on pictures they have posted. I have created a comment model and a 
comment form, and put the following code into the HTML document for the photo 
gallery:

Leave a comment

{{ comment_form.as_p }}
{% csrf_token %}
Submit
s.
return self._html_output(
normal_row='%(field)s',
error_row='%s',
row_ender='',
help_text_html=' %s',
errors_on_separate_row=True)`
So does my model in models.py:

class Comment(models.Model):
COMMENT_MAX_LENGTH = 1000
image = models.ForeignKey(Picture, on_delete=models.CASCADE, 
related_name="comments")
user = models.ForeignKey(UserProfile, on_delete=models.CASCADE)
body = models.TextField(max_length=COMMENT_MAX_LENGTH)
created_on = models.DateTimeField(auto_now_add=True)
active = models.BooleanField(default=False)

class Meta:
ordering = ['created_on']

def __str__(self):
return 'Comment {} by {}'.format(self.body, self.user)

When I go into the source code on the site, it shows that the form is hidden. 
Also, when I change comment_form.as_p to something random, no error messages 
are generated. It's like something is causing Django to skip past that bit of 
code.

I'd really appreciate any suggestions anyone could please offer.

Thanks

Jeff

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/ac7ac525-9bc4-4043-a142-b97b1d3d0e5c%40googlegroups.com.


Form not being published

2020-03-29 Thread Jeff Waters
I am creating a website using Django. I'd like to give users the chance to 
comment on pictures they have posted. I have created a comment model and a 
comment form, and put the following code into the HTML document for the photo 
gallery:

Leave a comment

{{ comment_form.as_p }}
{% csrf_token %}
Submit


However, the form is not displaying - there is nothing between 'Leave a 
comment' and the submit button on the page. I don't understand this as my form 
in forms.py appears to be configured correctly:

class CommentForm(forms.ModelForm):
body = forms.CharField(help_text="What is your comment?", 
widget=forms.TextInput(attrs={'size': '1000'}),
   required=True)

class Meta:
model = Comment
fields = ('body',)
def as_p(self):
# Returns this form rendered as HTML s.
return self._html_output(
normal_row='%(field)s',
error_row='%s',
row_ender='',
help_text_html=' %s',
errors_on_separate_row=True)`

So does my model in models.py:

class Comment(models.Model):
COMMENT_MAX_LENGTH = 1000
image = models.ForeignKey(Picture, on_delete=models.CASCADE, 
related_name="comments")
user = models.ForeignKey(UserProfile, on_delete=models.CASCADE)
body = models.TextField(max_length=COMMENT_MAX_LENGTH)
created_on = models.DateTimeField(auto_now_add=True)
active = models.BooleanField(default=False)

class Meta:
ordering = ['created_on']

def __str__(self):
return 'Comment {} by {}'.format(self.body, self.user)

When I go into the source code on the site, it shows that the form is hidden. 
Also, when I change comment_form.as_p to something random, no error messages 
are generated. It's like something is causing Django to skip past that bit of 
code.

I'd really appreciate any suggestions anyone could please offer.

Thanks

Jeff

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/4be7728e-ef60-45a9-8a35-1920ee5d5143%40googlegroups.com.


Re: Python Django Training

2020-02-03 Thread Jeff Kramer
I am interested too. Please add me!

Thank you-

Jeff

> On Feb 3, 2020, at 4:32 AM, Ethan Liu <1230...@gmail.com> wrote:
> 
> 
> I am interested, mark me up.
>> On Feb 1, 2020, 21:42 +0800, Srikanth K , wrote:
>> Hi,
>> 
>> I am from Hyderabad. I am Python Developer by Profession. I am eager take up 
>> any Python , Django Training (online Preferrable or Weekends). Members who 
>> require can contact me or share me  there idea.
>> 
>> Regards,
>> Srikanth.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 view this discussion on the web visit 
>> https://groups.google.com/d/msgid/django-users/CACPyz-gXb7wo9E0Uhs_pnxF9X52uA10__Fq1xt4trjXUaN3ehQ%40mail.gmail.com.
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/django-users/404cf18b-d797-4b84-852a-9cf603532792%40Spark.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/610C139F-FD7D-4E4A-B5D1-AF432C347393%40gmail.com.


Re: Pip installation

2019-01-12 Thread Jeff Kramer
E.I Kenneth,

Thank you. I too was having an issue with my PC/Win10 and Pip install. Anaconda 
seems to be working much smoother for me.

Thanks-

Jeff


> On Jan 12, 2019, at 6:25 AM, kennedy kay  wrote:
> 
> What you can also do is install Python from Anaconda. 
> It comes with inbuilt pip
> 
> goto: https://www.anaconda.com/download/
> 
> After installation: Open Ananaconda prompt and install any pip package
> Kind regards,
> E.I Kenneth
> [Python developer/Machine Learner]
> @www.wolfiegrabber.in
> [Developer Program Member] @Github
> [Mobile:] (+33)758401546
>(+33)767962527
> [e-mail:] kennedyc...@gmail.com
> [Git REPO:]
> 
> [Open Collaborator for OpenSource]
> 
> 
>> On Sat, Jan 12, 2019 at 2:16 PM Kasper Laudrup  wrote:
>> Hi Kidwell,
>> 
>> On 12/01/2019 13.37, Kidwell Nyatsambo wrote:
>> > Pip installation refusing to install on Windows 10.
>> > Coming with this message;
>> > image.png
>> > 
>> 
>> I have zero experience with Windows 10, but have you had a look a this 
>> guide:
>> 
>> https://matthewhorne.me/how-to-install-python-and-pip-on-windows-10/
>> 
>> Seems to be just what you need.
>> 
>> Kind regards,
>> 
>> Kasper Laudrup
>> 
>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send 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/289e2d1e-c246-0cc1-2cc1-929a7c6dbb73%40stacktrace.dk.
>> 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/CAJvXZPpfG52_LkAQ1ZoqxjQNpXwadMwcFzi%3DJzO7KzqbXzZtcQ%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/7244F287-CBA4-4AC4-B0B7-4BF5AEB2D252%40gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: file URL missing project name

2018-11-21 Thread Jeff Williams
I *had* added the above, but I put them in the 'lower down' URLS.PY file.
As soon as I added them to the higher-level one everything worked!

Thanks Roham!  Thanks Akash!  I really appreciate your time and help here.
Jeff



‪On Wed, Nov 21, 2018 at 8:38 AM ‫رهام صادقی‬‎ 
wrote:‬

> Hi,
> add these two lines to your settings.py file
>
> MEDIA_URL = '/media/'
> MEDIA_ROOT = os.path.join(BASE_DIR, 'media')
>
> after that in your base urls.py (a file along with settings.py)
> add the following url:
>
> from django.conf.urls.static import static
> from django.conf import settings
>
>
>
> if settings.DEBUG:
> urlpatterns += static(settings.MEDIA_URL, 
> document_root=settings.MEDIA_ROOT)
>
> urlpatterns += static(settings.STATIC_URL, 
> document_root=settings.STATICFILES_DIRS)
>
>
> ‫‪Jeff Williams‬‏ <‪jeff99willi...@gmail.com‬‏> در تاریخ چهارشنبه ۲۱
> نوامبر ۲۰۱۸ ساعت ۴:۳۸ نوشت:‬
>
>> Hey Akash,
>> I did figure out the enctype="multipart/form-data" issue (I had that for
>> a while but figured it out).  My files are loading.they just aren't
>> displaying.
>>
>> I just loaded an image using the Admin interface as you suggested (I
>> hadn't thought of trying that) and the load is working.  The URL and path
>> are still (relatively) the same:
>> http://127.0.0.1:8000/media/documents/reciper_rK1KS3j.jpg
>> D:\DjangoStuff\familyrecipies\media\documents\reciper_rK1KS3j.jpg
>>
>> Still getting this when I try to display.
>> Page not found (404)
>> Request Method: GET
>> Request URL: http://127.0.0.1:8000/media/documents/reciper_rK1KS3j.jpg
>>
>> Using the URLconf defined in familyrecipies.urls, Django tried these URL
>> patterns, in this order:
>>
>>1. admin/
>>2. oldgrub/
>>3.
>>4. accounts/
>>
>> The current path, media/documents/reciper_rK1KS3j.jpg, 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.
>>
>> I think I mentioned before that I took another picture-upload project,
>> built it, and made it work (which it did).
>> When I took the relevant parts into my own appit stopped working :-(.
>>
>> On Tue, Nov 20, 2018 at 3:06 AM Akash Purandare 
>> wrote:
>>
>>> Hey Jeff
>>>
>>> It is completely alright to try until we find a solution to this.
>>> I quote from the Django Documentation:
>>> Note that request.FILES
>>> <https://docs.djangoproject.com/en/2.1/ref/request-response/#django.http.HttpRequest.FILES>
>>>  will
>>> only contain data if the request method was POST and the  that
>>> posted the request has the attribute enctype="multipart/form-data".
>>> Otherwise, request.FILES will be empty.
>>>
>>> Can you ensure that the particular requirements are fulfilled?
>>>
>>> Also, I would like to ask you to try to upload a file from the Django
>>> admin panel and tell me if it is working. If not, can you send me the URL
>>> and the uploaded path of the Admin panel uploaded file?
>>>
>>> Regards
>>> Akash Purandare
>>>
>>> On Sunday, November 18, 2018 at 8:48:04 PM UTC+5:30, Jeff Williams wrote:
>>>
>>>> Hi All,
>>>> I'm new to django, so sorry if this is a newbie issue.
>>>>
>>>> I've managed to upload an ImageFieldbut when I try to display it in
>>>> my template using object.pic.url...the URL I'm getting back is missing my
>>>> project name from the URL and the pic is not loading.
>>>>
>>>> Specifically I'm getting
>>>> http://127.0.0.1:8000/media/media/56288852934__75FACD12-1711-4655-96D5-716198FE10B7.JPG
>>>>  back.and
>>>> I need
>>>>
>>>> http://127.0.0.1:8000/*oldgrub*
>>>> /media/media/56288852934__75FACD12-1711-4655-96D5-716198FE10B7.JPG
>>>>
>>>> back to have it work.
>>>>
>>>> What am I missing?  I've poured over my configs.
>>>> Jeff
>>>>
>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "Django users" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to django-users+unsubscr...@googlegroups.com.
>>> To post to this group, send email to django-users@googlegroups.com.
>>> Visit this group at 

Re: file URL missing project name

2018-11-20 Thread Jeff Williams
Hey Akash,
I did figure out the enctype="multipart/form-data" issue (I had that for a
while but figured it out).  My files are loading.they just aren't
displaying.

I just loaded an image using the Admin interface as you suggested (I hadn't
thought of trying that) and the load is working.  The URL and path are
still (relatively) the same:
http://127.0.0.1:8000/media/documents/reciper_rK1KS3j.jpg
D:\DjangoStuff\familyrecipies\media\documents\reciper_rK1KS3j.jpg

Still getting this when I try to display.
Page not found (404)
Request Method: GET
Request URL: http://127.0.0.1:8000/media/documents/reciper_rK1KS3j.jpg

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

   1. admin/
   2. oldgrub/
   3.
   4. accounts/

The current path, media/documents/reciper_rK1KS3j.jpg, 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.

I think I mentioned before that I took another picture-upload project,
built it, and made it work (which it did).
When I took the relevant parts into my own appit stopped working :-(.

On Tue, Nov 20, 2018 at 3:06 AM Akash Purandare 
wrote:

> Hey Jeff
>
> It is completely alright to try until we find a solution to this.
> I quote from the Django Documentation:
> Note that request.FILES
> <https://docs.djangoproject.com/en/2.1/ref/request-response/#django.http.HttpRequest.FILES>
>  will
> only contain data if the request method was POST and the  that
> posted the request has the attribute enctype="multipart/form-data".
> Otherwise, request.FILES will be empty.
>
> Can you ensure that the particular requirements are fulfilled?
>
> Also, I would like to ask you to try to upload a file from the Django
> admin panel and tell me if it is working. If not, can you send me the URL
> and the uploaded path of the Admin panel uploaded file?
>
> Regards
> Akash Purandare
>
> On Sunday, November 18, 2018 at 8:48:04 PM UTC+5:30, Jeff Williams wrote:
>
>> Hi All,
>> I'm new to django, so sorry if this is a newbie issue.
>>
>> I've managed to upload an ImageFieldbut when I try to display it in
>> my template using object.pic.url...the URL I'm getting back is missing my
>> project name from the URL and the pic is not loading.
>>
>> Specifically I'm getting
>> http://127.0.0.1:8000/media/media/56288852934__75FACD12-1711-4655-96D5-716198FE10B7.JPG
>>  back.and
>> I need
>>
>> http://127.0.0.1:8000/*oldgrub*
>> /media/media/56288852934__75FACD12-1711-4655-96D5-716198FE10B7.JPG
>>
>> back to have it work.
>>
>> What am I missing?  I've poured over my configs.
>> Jeff
>>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send 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/7a1672c8-0f53-41f3-88c0-e3d7a70e7ae3%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/7a1672c8-0f53-41f3-88c0-e3d7a70e7ae3%40googlegroups.com?utm_medium=email_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>

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


Re: file URL missing project name

2018-11-19 Thread Jeff Williams
Hey Akash,
Appreciate you still thinking about this.  I've tried moving my Media
folder to copy a working project (still no luck).

Here is the file: http://127.0.0.1:8000/media/documents/dsBuffer_rQWWvO9.jpg


This is the media folder: D:\DjangoStuff\familyrecipies\media\documents

My current guess is that I have something wrong in my HTML that is somehow
causing an errorI think I've noticed that Dango gives a 404 error if it
sees an HTML error (?).

I copied a small working file-upload example and it worked.  I can't see
any difference between the example and my code.
Jeff


On Mon, Nov 19, 2018 at 8:16 PM Akash Purandare 
wrote:

> Hey Jeff
>
> Can you send me the URL of the file and the Location of the uploaded media
> file?
>
> Regards
> Akash Purandare
>
> On Sunday, November 18, 2018 at 8:48:04 PM UTC+5:30, Jeff Williams wrote:
>
>> Hi All,
>> I'm new to django, so sorry if this is a newbie issue.
>>
>> I've managed to upload an ImageFieldbut when I try to display it in
>> my template using object.pic.url...the URL I'm getting back is missing my
>> project name from the URL and the pic is not loading.
>>
>> Specifically I'm getting
>> http://127.0.0.1:8000/media/media/56288852934__75FACD12-1711-4655-96D5-716198FE10B7.JPG
>>  back.and
>> I need
>>
>> http://127.0.0.1:8000/*oldgrub*
>> /media/media/56288852934__75FACD12-1711-4655-96D5-716198FE10B7.JPG
>>
>> back to have it work.
>>
>> What am I missing?  I've poured over my configs.
>> Jeff
>>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send 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/5c9ebd72-bb98-49b8-81eb-dd9da3e7796e%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/5c9ebd72-bb98-49b8-81eb-dd9da3e7796e%40googlegroups.com?utm_medium=email_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>

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


Re: file URL missing project name

2018-11-18 Thread Jeff Williams
That part is added by urlpatterns += static(settings.MEDIA_URL,
document_root=settings.MEDIA_ROOT)so I doubt that is the issue.

This is going to sound odd.but I've had some files display and then
stop working when I don't think I changed anything.  very odd.


On Sun, Nov 18, 2018 at 6:46 PM Jason  wrote:

> (?P.*)
>
> in your url is probably the reason why.  remove that bit
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/92369a7c-6d1b-4b6a-a38d-38151bb10772%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/CAMgbqCcPgGc3SPLOMmhJXfFZiJ-N%3DVzBrfZV463r2Ljtu2TvNQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: file URL missing project name

2018-11-18 Thread Jeff Williams
MEDIA_ROOT and MEDIA_URL both seem fine.and the URL I'm getting in the
template looks fine...but URLS.PY is kicking it out.
I changed the security on the directory to full access to everyone.  Any
ideas on how to debug this?  I can't see why the path isn't matching the
pattern.


Page not found (404)
Request Method: GET
Request URL:
http://127.0.0.1:8000/oldgrub/media/56288593216__746F513A-D6F6-446D-949F-D0C09E7C4419_sU3W0z5.JPG

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

   1. admin/
   2. oldgrub/ [name='index']
   3. oldgrub/ cookbooks/ [name='cookbooks']
   4. oldgrub/ cookbook/ [name='cookbook']
   5. oldgrub/ recipe/ [name='recipes']
   6. oldgrub/ recipe/ [name='recipe']
   7. oldgrub/ family/ [name='family']
   8. oldgrub/ recipe/add/ [name='addrecipe']
   9. oldgrub/ ^static/(?P.*)$
   10. oldgrub/ ^oldgrub/media/(?P.*)$
   11.
   12. accounts/

The current path,
oldgrub/media/56288593216__746F513A-D6F6-446D-949F-D0C09E7C4419_sU3W0z5.JPG,
didn't match any of these.


On Sun, Nov 18, 2018 at 5:24 PM Jason  wrote:

> Seems like there might be some confusion on what exactly `MEDIA_ROOT`
> means.
>
> you can do
>
> import logging
> logger = logging.getLogger(__name__)
> logger.info(MEDIA_ROOT)
>
> in settings after declaring MEDIA_ROOT
>
> if that path lines up with what you have in the server, then I suspect
> permission issue might be at play as well.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send 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/070f631f-d327-47c7-b283-b3bec62b44a6%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/CAMgbqCfyA7A8rZL4Phs20X6MFumRBP7XmgaaEF3_heCj%2B4wb_g%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: file URL missing project name

2018-11-18 Thread Jeff Williams
Akash,
You are good.but I already changed that to get to the error I have
now.  Still not working :-(
The file is in the right place but the URL matching is messing up somehow.


On Sun, Nov 18, 2018 at 1:00 PM Akash Purandare 
wrote:

> Hey Jeff
>
> I tried the models that you were creating and I found out the error that
> you are having is with the Model. The upload_to of the pic variable is set
> to 'media/', which uploads the file to the url
> http://localhost:8000/oldgrub/media/media/56288852088__208FCEF9-5890-
> 4633-8BF6-C5C9A82D87EE.JPG. So if you change the upload_to to '', the URL
> will be http://localhost:8000/oldgrub/media/56288852088__208FCEF9-5890-
> 4633-8BF6-C5C9A82D87EE.JPG.
>
> Hope this fixes the issue that you are facing.
>
> Regards
> Akash Purandare
>
> On Sunday, November 18, 2018 at 10:57:31 PM UTC+5:30, Jeff Williams wrote:
>
>> Nope.  Same error.  I can see the file being loaded.  Doesn't like the
>> URL still.
>>
>> On Sun, Nov 18, 2018 at 11:30 AM Akash Purandare 
>> wrote:
>>
> Hey Jeff
>>>
>>> I think that you might need to upload the file again and try.
>>>
>>> Let me know if it works out.
>>>
>>> Regards
>>> Akash Purandare
>>>
>>>
>>> On Sunday, November 18, 2018 at 9:56:13 PM UTC+5:30, Jeff Williams wrote:
>>>
>>>> OK this is almost fixed:
>>>>
>>>> Why isn't this path matching?
>>>>
>>>> Page not found (404)
>>>> Request Method: GET
>>>> Request URL:
>>>> http://127.0.0.1:8000/oldgrub/media/56288852088__208FCEF9-5890-4633-8BF6-C5C9A82D87EE.JPG
>>>>
>>>> Using the URLconf defined in familyrecipies.urls, Django tried these
>>>> URL patterns, in this order:
>>>>
>>>>1. admin/
>>>>2. oldgrub/ [name='index']
>>>>3. oldgrub/ cookbooks/ [name='cookbooks']
>>>>4. oldgrub/ cookbook/ [name='cookbook']
>>>>5. oldgrub/ recipe/ [name='recipes']
>>>>6. oldgrub/ recipe/ [name='recipe']
>>>>7. oldgrub/ family/ [name='family']
>>>>8. oldgrub/ recipe/add/ [name='addrecipe']
>>>>9. oldgrub/ ^oldgrub/media/(?P.*)$
>>>>10.
>>>>11. accounts/
>>>>
>>>> The current path,
>>>> oldgrub/media/56288852088__208FCEF9-5890-4633-8BF6-C5C9A82D87EE.JPG,
>>>> didn't match any of these.
>>>>
>>>> On Sun, Nov 18, 2018 at 11:08 AM Jeff Williams 
>>>> wrote:
>>>>
>>> Thanks Akash.
>>>>> Haven't quite fixed it yet but this is definitely the right area.
>>>>> Jeff
>>>>>
>>>>> On Sun, Nov 18, 2018 at 10:52 AM Akash Purandare 
>>>>> wrote:
>>>>>
>>>> Hi Jeff
>>>>>>
>>>>>> I believe that the URL that you want to show is completely irrelevant
>>>>>> as the Django's FileField does that for you. However, in case you really
>>>>>> want your project name to be included in your URL, you can change the
>>>>>> MEDIA_URL in your settings.py to '/oldgrub/media' to reflect the 
>>>>>> necessary
>>>>>> changes for you.
>>>>>>
>>>>>> Also, I believe that the problem you are facing is because you want
>>>>>> to serve your files online by using the MEDIA_URL and MEDIA_ROOT. Hence,
>>>>>> you must add this URL pattern at the end of your urls.py file of your 
>>>>>> main
>>>>>> project folder.
>>>>>>
>>>>>> from django.conf import settings
>>>>>> from django.conf.urls.static import static
>>>>>> urlpatterns = [
>>>>>> ...(Your Urls)
>>>>>> ]+static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
>>>>>>
>>>>>> Regards
>>>>>> Akash Purandare
>>>>>>
>>>>>>
>>>>>> On Sunday, November 18, 2018 at 8:48:04 PM UTC+5:30, Jeff Williams
>>>>>> wrote:
>>>>>>>
>>>>>>> Hi All,
>>>>>>> I'm new to django, so sorry if this is a newbie issue.
>>>>>>>
>>>>>>> I've managed to upload an ImageFieldbut when I try to display it
>>>>>>> in my template using object.pic.url...the URL I'm getting back is 
>>>>>>> missing
>>>&

Re: file URL missing project name

2018-11-18 Thread Jeff Williams
Nope.  Same error.  I can see the file being loaded.  Doesn't like the URL
still.

On Sun, Nov 18, 2018 at 11:30 AM Akash Purandare 
wrote:

> Hey Jeff
>
> I think that you might need to upload the file again and try.
>
> Let me know if it works out.
>
> Regards
> Akash Purandare
>
>
> On Sunday, November 18, 2018 at 9:56:13 PM UTC+5:30, Jeff Williams wrote:
>
>> OK this is almost fixed:
>>
>> Why isn't this path matching?
>>
>> Page not found (404)
>> Request Method: GET
>> Request URL:
>> http://127.0.0.1:8000/oldgrub/media/56288852088__208FCEF9-5890-4633-8BF6-C5C9A82D87EE.JPG
>>
>> Using the URLconf defined in familyrecipies.urls, Django tried these URL
>> patterns, in this order:
>>
>>1. admin/
>>2. oldgrub/ [name='index']
>>3. oldgrub/ cookbooks/ [name='cookbooks']
>>4. oldgrub/ cookbook/ [name='cookbook']
>>5. oldgrub/ recipe/ [name='recipes']
>>6. oldgrub/ recipe/ [name='recipe']
>>7. oldgrub/ family/ [name='family']
>>8. oldgrub/ recipe/add/ [name='addrecipe']
>>9. oldgrub/ ^oldgrub/media/(?P.*)$
>>10.
>>11. accounts/
>>
>> The current path,
>> oldgrub/media/56288852088__208FCEF9-5890-4633-8BF6-C5C9A82D87EE.JPG,
>> didn't match any of these.
>>
>> On Sun, Nov 18, 2018 at 11:08 AM Jeff Williams 
>> wrote:
>>
> Thanks Akash.
>>> Haven't quite fixed it yet but this is definitely the right area.
>>> Jeff
>>>
>>> On Sun, Nov 18, 2018 at 10:52 AM Akash Purandare 
>>> wrote:
>>>
>> Hi Jeff
>>>>
>>>> I believe that the URL that you want to show is completely irrelevant
>>>> as the Django's FileField does that for you. However, in case you really
>>>> want your project name to be included in your URL, you can change the
>>>> MEDIA_URL in your settings.py to '/oldgrub/media' to reflect the necessary
>>>> changes for you.
>>>>
>>>> Also, I believe that the problem you are facing is because you want to
>>>> serve your files online by using the MEDIA_URL and MEDIA_ROOT. Hence, you
>>>> must add this URL pattern at the end of your urls.py file of your main
>>>> project folder.
>>>>
>>>> from django.conf import settings
>>>> from django.conf.urls.static import static
>>>> urlpatterns = [
>>>> ...(Your Urls)
>>>> ]+static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
>>>>
>>>> Regards
>>>> Akash Purandare
>>>>
>>>>
>>>> On Sunday, November 18, 2018 at 8:48:04 PM UTC+5:30, Jeff Williams
>>>> wrote:
>>>>>
>>>>> Hi All,
>>>>> I'm new to django, so sorry if this is a newbie issue.
>>>>>
>>>>> I've managed to upload an ImageFieldbut when I try to display it
>>>>> in my template using object.pic.url...the URL I'm getting back is missing
>>>>> my project name from the URL and the pic is not loading.
>>>>>
>>>>> Specifically I'm getting
>>>>> http://127.0.0.1:8000/media/media/56288852934__75FACD12-1711-4655-96D5-716198FE10B7.JPG
>>>>>  back.and
>>>>> I need
>>>>>
>>>>> http://127.0.0.1:8000/*oldgrub*
>>>>> /media/media/56288852934__75FACD12-1711-4655-96D5-716198FE10B7.JPG
>>>>>
>>>>> back to have it work.
>>>>>
>>>>> What am I missing?  I've poured over my configs.
>>>>> Jeff
>>>>>
>>>> --
>>>> You received this message because you are subscribed 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/ca83632a-89d5-4186-873e-8ef6bf552cc5%40googlegroups.com
>>>> <https://groups.google.com/d/msgid/django-users/ca83632a-89d5-4186-873e-8ef6bf552cc5%40googlegroups.com?utm_medium=email_source=footer>
>>>> .
>>>> For more options, visit https://groups.google.com/d/optout.
>>>>
>>> --
> You received this message becau

Re: file URL missing project name

2018-11-18 Thread Jeff Williams
OK this is almost fixed:

Why isn't this path matching?

Page not found (404)
Request Method: GET
Request URL:
http://127.0.0.1:8000/oldgrub/media/56288852088__208FCEF9-5890-4633-8BF6-C5C9A82D87EE.JPG

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

   1. admin/
   2. oldgrub/ [name='index']
   3. oldgrub/ cookbooks/ [name='cookbooks']
   4. oldgrub/ cookbook/ [name='cookbook']
   5. oldgrub/ recipe/ [name='recipes']
   6. oldgrub/ recipe/ [name='recipe']
   7. oldgrub/ family/ [name='family']
   8. oldgrub/ recipe/add/ [name='addrecipe']
   9. oldgrub/ ^oldgrub/media/(?P.*)$
   10.
   11. accounts/

The current path,
oldgrub/media/56288852088__208FCEF9-5890-4633-8BF6-C5C9A82D87EE.JPG, didn't
match any of these.

On Sun, Nov 18, 2018 at 11:08 AM Jeff Williams 
wrote:

> Thanks Akash.
> Haven't quite fixed it yet but this is definitely the right area.
> Jeff
>
> On Sun, Nov 18, 2018 at 10:52 AM Akash Purandare 
> wrote:
>
>> Hi Jeff
>>
>> I believe that the URL that you want to show is completely irrelevant as
>> the Django's FileField does that for you. However, in case you really want
>> your project name to be included in your URL, you can change the MEDIA_URL
>> in your settings.py to '/oldgrub/media' to reflect the necessary changes
>> for you.
>>
>> Also, I believe that the problem you are facing is because you want to
>> serve your files online by using the MEDIA_URL and MEDIA_ROOT. Hence, you
>> must add this URL pattern at the end of your urls.py file of your main
>> project folder.
>>
>> from django.conf import settings
>> from django.conf.urls.static import static
>> urlpatterns = [
>> ...(Your Urls)
>> ]+static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
>>
>> Regards
>> Akash Purandare
>>
>>
>> On Sunday, November 18, 2018 at 8:48:04 PM UTC+5:30, Jeff Williams wrote:
>>>
>>> Hi All,
>>> I'm new to django, so sorry if this is a newbie issue.
>>>
>>> I've managed to upload an ImageFieldbut when I try to display it in
>>> my template using object.pic.url...the URL I'm getting back is missing my
>>> project name from the URL and the pic is not loading.
>>>
>>> Specifically I'm getting
>>> http://127.0.0.1:8000/media/media/56288852934__75FACD12-1711-4655-96D5-716198FE10B7.JPG
>>>  back.and
>>> I need
>>>
>>> http://127.0.0.1:8000/*oldgrub*
>>> /media/media/56288852934__75FACD12-1711-4655-96D5-716198FE10B7.JPG
>>>
>>> back to have it work.
>>>
>>> What am I missing?  I've poured over my configs.
>>> Jeff
>>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send 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/ca83632a-89d5-4186-873e-8ef6bf552cc5%40googlegroups.com
>> <https://groups.google.com/d/msgid/django-users/ca83632a-89d5-4186-873e-8ef6bf552cc5%40googlegroups.com?utm_medium=email_source=footer>
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>

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


Re: file URL missing project name

2018-11-18 Thread Jeff Williams
Thanks Akash.
Haven't quite fixed it yet but this is definitely the right area.
Jeff

On Sun, Nov 18, 2018 at 10:52 AM Akash Purandare 
wrote:

> Hi Jeff
>
> I believe that the URL that you want to show is completely irrelevant as
> the Django's FileField does that for you. However, in case you really want
> your project name to be included in your URL, you can change the MEDIA_URL
> in your settings.py to '/oldgrub/media' to reflect the necessary changes
> for you.
>
> Also, I believe that the problem you are facing is because you want to
> serve your files online by using the MEDIA_URL and MEDIA_ROOT. Hence, you
> must add this URL pattern at the end of your urls.py file of your main
> project folder.
>
> from django.conf import settings
> from django.conf.urls.static import static
> urlpatterns = [
> ...(Your Urls)
> ]+static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
>
> Regards
> Akash Purandare
>
>
> On Sunday, November 18, 2018 at 8:48:04 PM UTC+5:30, Jeff Williams wrote:
>>
>> Hi All,
>> I'm new to django, so sorry if this is a newbie issue.
>>
>> I've managed to upload an ImageFieldbut when I try to display it in
>> my template using object.pic.url...the URL I'm getting back is missing my
>> project name from the URL and the pic is not loading.
>>
>> Specifically I'm getting
>> http://127.0.0.1:8000/media/media/56288852934__75FACD12-1711-4655-96D5-716198FE10B7.JPG
>>  back.and
>> I need
>>
>> http://127.0.0.1:8000/*oldgrub*
>> /media/media/56288852934__75FACD12-1711-4655-96D5-716198FE10B7.JPG
>>
>> back to have it work.
>>
>> What am I missing?  I've poured over my configs.
>> Jeff
>>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send 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/ca83632a-89d5-4186-873e-8ef6bf552cc5%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/ca83632a-89d5-4186-873e-8ef6bf552cc5%40googlegroups.com?utm_medium=email_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>

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


Re: file URL missing project name

2018-11-18 Thread Jeff Williams
OK here are what I think are the relevant parts:

settings.py

STATIC_URL = '/static/'
STATICFILES_DIRS = (
os.path.join(BASE_DIR,'static'), # if your static files
folder is named "staticfiles"
)

# Redirect to home URL after login (Default redirects to /accounts/profile/)
LOGIN_REDIRECT_URL = '/'

MEDIA_URL = '/media/'
MEDIA_ROOT = os.path.join(BASE_DIR, 'media')


urls.py


urlpatterns = [
path('', views.index, name='index'),
path('cookbooks/', views.CookBookListView.as_view(), name='cookbooks'),
path('cookbook/', views.CookBookDetailView.as_view(),
name='cookbook'),
path('recipe/', views.RecipeListView.as_view(), name='recipes'),
path('recipe/', views.RecipeDetailView.as_view(), name='recipe'),
path('family/', views.FamilyDetailView.as_view(), name='family'),
path('recipe/add/', views.RecipeAdd, name='addrecipe'),
#Add Django site authentication urls (for login, logout, password
management)
]

if settings.DEBUG:
urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)

models.py

class Recipe(models.Model):
id = models.UUIDField(primary_key=True, default=uuid.uuid4,
help_text='Unique ID for this particular recipe across whole library')
cookbook = models.ForeignKey(CookBook,on_delete=models.SET_NULL,
null=True, related_name='recipies')
title = models.TextField(max_length=1000, help_text='Enter a brief
description of the Recipe')
author = models.TextField(max_length=1000, help_text='Enter the
creator of the Recipie', blank=True)
text = models.TextField(max_length=1, help_text='Enter the recipe')
notes = models.TextField(max_length=1, help_text='Enter notes
on the recipe',blank=True)
pic = models.ImageField(upload_to='media/',blank=True, null=True)


views.py

def RecipeAdd(request):
template_name = 'recipe_add.html'

r = Recipe(cookbook=Family.objects.get(members=request.user).FamilyCookbook)
# If this is a POST request then process the Form data
if request.method == 'POST':

# Create a form instance and populate it with data from the
request (binding):
add_recipe_form = AddRecipeForm(request.POST, request.FILES)

# Check if the form is valid:
if add_recipe_form.is_valid():
# process the data in form.cleaned_data as required (here
we just write it to the model due_back field)
# book_instance.due_back =
book_renewal_form.cleaned_data['renewal_date']
r.author = add_recipe_form.cleaned_data['author']
r.notes = add_recipe_form.cleaned_data['notes']
r.text = add_recipe_form.cleaned_data['text']
r.title = add_recipe_form.cleaned_data['title']
# r.pic=add_recipe_form.cleaned_data['pic'] # file not
being returned here
# r.pic = add_recipe_form.data['pic']  # file not being
returned here
r.pic = request.FILES['pic']  #file not here

add_recipe_form.save()  # save the recipe

# redirect to a new URL:
return HttpResponseRedirect(reverse('recipes'))

# If this is a GET (or any other method) create the default form.
else:
# proposed_renewal_date = datetime.date.today() +
datetime.timedelta(weeks=3)
add_recipe_form = AddRecipeForm()

context = {
'form': add_recipe_form,
}

return render(request, 'recipe_add.html', context)


forms.py

class AddRecipeForm( ModelForm ):
pic = ImageField(widget= FileInput)  # was widget=PictureWidget

class Meta:
model = Recipe
fields = ('title', 'author', 'text', 'notes', 'pic')
widgets = {
'title': Textarea( attrs={'cols': 40, 'rows': 1} ),
'author': Textarea( attrs={'cols': 40, 'rows': 1} ),
'text': Textarea( attrs={'cols': 40, 'rows': 1} ),
'notes': Textarea( attrs={'cols': 40, 'rows': 1} ),
# 'pic': Textarea(attrs={'cols': 40, 'rows': 1}),

recipe_list.html

Recipe List
 {% if recipe_list %}
 
   {% for recipe in recipe_list %}
 
  
  {{ recipe.title }} {{recipe.author}}

{{recipe.text}} 
 {{ recipe.notes }}
 {% load static %}
 
   {% if recipe.pic %}
   {{ recipe.title }}
   

   {% endif %}
 
  {{ recipe.pic }}
 
   {% endfor %}


On Sun, Nov 18, 2018 at 10:23 AM Joel Mathew  wrote:

> It's anybody's guess unless you post your code.
> Sincerely yours,
>
>  Joel G Mathew
>
>
>
> On Sun, 18 Nov 2018 at 20:47, Jeff Williams 
> wrote:
>
>> Hi All,
>> I'm new to django, so sorry if this is a newbie issue.
>>
>> I've managed to upload an ImageFieldbut when I try to display it in
>> my template using object.pic.url...the URL I'm getting back is missing my
>> project name from the URL and the pic is not loading.
>>
>> Specifically I'm getting
>> http://127.0.0.1:8000/media/media/56288852934__7

file URL missing project name

2018-11-18 Thread Jeff Williams
Hi All,
I'm new to django, so sorry if this is a newbie issue.

I've managed to upload an ImageFieldbut when I try to display it in my
template using object.pic.url...the URL I'm getting back is missing my
project name from the URL and the pic is not loading.

Specifically I'm getting
http://127.0.0.1:8000/media/media/56288852934__75FACD12-1711-4655-96D5-716198FE10B7.JPG
back.and
I need

http://127.0.0.1:8000/*oldgrub*
/media/media/56288852934__75FACD12-1711-4655-96D5-716198FE10B7.JPG

back to have it work.

What am I missing?  I've poured over my configs.
Jeff

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send 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/CAMgbqCe3UzvrWFg4fiRSPXp6HtLJoPJmGs8oPSZjAd%3Dxx4ygNQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: How to connect mysql with django

2018-11-11 Thread Jeff Williams
You have to use the path of where you! downloaded the file.
On Sun, Nov 11, 2018 at 4:28 PM Ansh Srivastava 
wrote:

> Ahhh! not working:
> C:\Users\ansh>pip install c:\downloads\mysqlclient-1.3.13-cp37-cp3
> Invalid requirement: 'c:\downloads\mysqlclient-1.3.13-cp37-cp3'
> It looks like a path. File 'c:\downloads\mysqlclient-1.3.13-cp37-cp3' does
> not e
> xist.
> I just simply pasted your command !
>
> [image: Mailtrack]
> <https://mailtrack.io?utm_source=gmail_medium=signature_campaign=signaturevirality5;>
>  Sender
> notified by
> Mailtrack
> <https://mailtrack.io?utm_source=gmail_medium=signature_campaign=signaturevirality5;>
>  11/12/18,
> 2:57:02 AM
>
> On Mon, Nov 12, 2018 at 2:11 AM Jeff Williams 
> wrote:
>
>> sorry.  I meant the full path to the file.like below if you
>> downloaded it into C:\downloads.
>>
>> pip install c:\downloads\mysqlclient-1.3.13-cp37-cp3
>>
>> On Sun, Nov 11, 2018 at 2:58 PM Ansh Srivastava <
>> ansh.srivastav...@gmail.com> wrote:
>>
>>> Full path means? If you can send the screenshot or command instead @Jeff
>>> Williams
>>>
>>> [image: Mailtrack]
>>> <https://mailtrack.io?utm_source=gmail_medium=signature_campaign=signaturevirality5;>
>>>  Sender
>>> notified by
>>> Mailtrack
>>> <https://mailtrack.io?utm_source=gmail_medium=signature_campaign=signaturevirality5;>
>>>  11/12/18,
>>> 1:28:00 AM
>>>
>>> On Mon, Nov 12, 2018 at 1:07 AM Jeff Williams 
>>> wrote:
>>>
>>>> give it the full path to the file.  I had the same issue yesterday and
>>>> this fixed it for me.
>>>>
>>>> On Sun, Nov 11, 2018 at 2:27 PM Ansh Srivastava <
>>>> ansh.srivastav...@gmail.com> wrote:
>>>>
>>>>> Yes @,Jeff Williams , I did but it still prompts the same:
>>>>>
>>>>> C:\Users\ansh>pip install mysqlclient-1.3.13-cp37-cp37m-win_amd64.whl
>>>>> Requirement 'mysqlclient-1.3.13-cp37-cp37m-win_amd64.whl' looks like a
>>>>> filename,
>>>>>  but the file does not exist
>>>>> mysqlclient-1.3.13-cp37-cp37m-win_amd64.whl is not a supported wheel
>>>>> on this pla
>>>>> tform.
>>>>>
>>>>> -- Forwarded message -
>>>>> From: Jeff Williams 
>>>>> Date: Sun, Nov 11, 2018 at 11:43 PM
>>>>> Subject: Re: How to connect mysql with django
>>>>> To: 
>>>>>
>>>>>
>>>>> Did you download the .whl file first?
>>>>>
>>>>> On Sun, Nov 11, 2018 at 11:57 AM Ansh Srivastava <
>>>>> ansh.srivastav...@gmail.com> wrote:
>>>>>
>>>>>> Thank you @pujiarahman. I have tried out the above command but it
>>>>>> didn't work!It says::C:\Users\ansh\Desktop\Dje\p1\marvellous> pip
>>>>>> install mysqlclient-1.3.13-cp37-cp37m-win_amd64.whlRequirement
>>>>>> 'mysqlclient-1.3.13-cp37-cp37m-win_amd64.whl' looks like a filename, but
>>>>>> the file does not existmysqlclient-1.3.13-cp37-cp37m-win_amd64.whl
>>>>>> is not a supported wheel on this platform.Furthermore appreciated.
>>>>>>
>>>>>>
>>>>>> [image: Mailtrack]
>>>>>> <https://mailtrack.io?utm_source=gmail_medium=signature_campaign=signaturevirality5;>
>>>>>>  Sender
>>>>>> notified by
>>>>>> Mailtrack
>>>>>> <https://mailtrack.io?utm_source=gmail_medium=signature_campaign=signaturevirality5;>
>>>>>>  11/11/18,
>>>>>> 10:26:27 PM
>>>>>>
>>>>>> On Sun, Nov 11, 2018 at 8:46 PM pujiarahman 
>>>>>> wrote:
>>>>>>
>>>>>>> Hi,
>>>>>>>
>>>>>>> Go to this site
>>>>>>> https://www.lfd.uci.edu/~gohlke/pythonlibs/#mysqlclient
>>>>>>> i use this for my python 3.7 and windows x64  :
>>>>>>> mysqlclient-1.3.13-cp37-cp37m-win_amd64.whl
>>>>>>> try :  pip install mysqlclient-1.3.13-cp37-cp37m-win_amd64.whl
>>>>>>>
>>>>>>> regards
>>>>>>>
>>>>>>> Pada Minggu, 11 November 2018 18.57.11 UTC+7, ansh.srivastav999
>>>>>>> menulis:
>>>>>>>>
>>>>>&

Re: How to connect mysql with django

2018-11-11 Thread Jeff Williams
sorry.  I meant the full path to the file.like below if you downloaded
it into C:\downloads.

pip install c:\downloads\mysqlclient-1.3.13-cp37-cp3

On Sun, Nov 11, 2018 at 2:58 PM Ansh Srivastava 
wrote:

> Full path means? If you can send the screenshot or command instead @Jeff
> Williams
>
> [image: Mailtrack]
> <https://mailtrack.io?utm_source=gmail_medium=signature_campaign=signaturevirality5;>
>  Sender
> notified by
> Mailtrack
> <https://mailtrack.io?utm_source=gmail_medium=signature_campaign=signaturevirality5;>
>  11/12/18,
> 1:28:00 AM
>
> On Mon, Nov 12, 2018 at 1:07 AM Jeff Williams 
> wrote:
>
>> give it the full path to the file.  I had the same issue yesterday and
>> this fixed it for me.
>>
>> On Sun, Nov 11, 2018 at 2:27 PM Ansh Srivastava <
>> ansh.srivastav...@gmail.com> wrote:
>>
>>> Yes @,Jeff Williams , I did but it still prompts the same:
>>>
>>> C:\Users\ansh>pip install mysqlclient-1.3.13-cp37-cp37m-win_amd64.whl
>>> Requirement 'mysqlclient-1.3.13-cp37-cp37m-win_amd64.whl' looks like a
>>> filename,
>>>  but the file does not exist
>>> mysqlclient-1.3.13-cp37-cp37m-win_amd64.whl is not a supported wheel on
>>> this pla
>>> tform.
>>>
>>> -- Forwarded message -
>>> From: Jeff Williams 
>>> Date: Sun, Nov 11, 2018 at 11:43 PM
>>> Subject: Re: How to connect mysql with django
>>> To: 
>>>
>>>
>>> Did you download the .whl file first?
>>>
>>> On Sun, Nov 11, 2018 at 11:57 AM Ansh Srivastava <
>>> ansh.srivastav...@gmail.com> wrote:
>>>
>>>> Thank you @pujiarahman. I have tried out the above command but it
>>>> didn't work!It says::C:\Users\ansh\Desktop\Dje\p1\marvellous> pip
>>>> install mysqlclient-1.3.13-cp37-cp37m-win_amd64.whlRequirement
>>>> 'mysqlclient-1.3.13-cp37-cp37m-win_amd64.whl' looks like a filename, but
>>>> the file does not existmysqlclient-1.3.13-cp37-cp37m-win_amd64.whl is
>>>> not a supported wheel on this platform.Furthermore appreciated.
>>>>
>>>>
>>>> [image: Mailtrack]
>>>> <https://mailtrack.io?utm_source=gmail_medium=signature_campaign=signaturevirality5;>
>>>>  Sender
>>>> notified by
>>>> Mailtrack
>>>> <https://mailtrack.io?utm_source=gmail_medium=signature_campaign=signaturevirality5;>
>>>>  11/11/18,
>>>> 10:26:27 PM
>>>>
>>>> On Sun, Nov 11, 2018 at 8:46 PM pujiarahman 
>>>> wrote:
>>>>
>>>>> Hi,
>>>>>
>>>>> Go to this site
>>>>> https://www.lfd.uci.edu/~gohlke/pythonlibs/#mysqlclient
>>>>> i use this for my python 3.7 and windows x64  :
>>>>> mysqlclient-1.3.13-cp37-cp37m-win_amd64.whl
>>>>> try :  pip install mysqlclient-1.3.13-cp37-cp37m-win_amd64.whl
>>>>>
>>>>> regards
>>>>>
>>>>> Pada Minggu, 11 November 2018 18.57.11 UTC+7, ansh.srivastav999
>>>>> menulis:
>>>>>>
>>>>>> I m tryin' to connect mysql database with django, for that, I did
>>>>>> this:-
>>>>>>
>>>>>>   python manage.py runserver
>>>>>>
>>>>>> but, this new mess came around sayin' :-
>>>>>>
>>>>>>  (django.core.exceptions.ImproperlyConfigured: Error loading MySQLdb 
>>>>>> module.
>>>>>>  Did you install mysqlclient?).
>>>>>>
>>>>>> But when I m tryin' to install mysqlclient through pip as:-
>>>>>>
>>>>>>   pip install mysqlclient
>>>>>>
>>>>>> another creepy thing comes up:-
>>>>>>
>>>>>>   _mysql.c(29): fatal error C1083: Cannot open include file: 'mysql.h': 
>>>>>> No
>>>>>>such file or directory
>>>>>>   error: command 'C:\\Program Files (x86)\\Microsoft Visual
>>>>>>   Studio\\2017\\Comm
>>>>>>   unity\\VC\\Tools\\MSVC\\14.15.26726\\bin\\HostX86\\x86\\cl.exe' failed
>>>>>>   with exit status 2
>>>>>>
>>>>>> For installing mysql.h, I have downloaded mysql connector too, but
>>>>>> the error continues. I don't know how to proceed furher. Any help would 
>>>>>> be
>>>>>> appreciated.
>>

Re: How to connect mysql with django

2018-11-11 Thread Jeff Williams
give it the full path to the file.  I had the same issue yesterday and this
fixed it for me.

On Sun, Nov 11, 2018 at 2:27 PM Ansh Srivastava 
wrote:

> Yes @,Jeff Williams , I did but it still prompts the same:
>
> C:\Users\ansh>pip install mysqlclient-1.3.13-cp37-cp37m-win_amd64.whl
> Requirement 'mysqlclient-1.3.13-cp37-cp37m-win_amd64.whl' looks like a
> filename,
>  but the file does not exist
> mysqlclient-1.3.13-cp37-cp37m-win_amd64.whl is not a supported wheel on
> this pla
> tform.
>
> -- Forwarded message -
> From: Jeff Williams 
> Date: Sun, Nov 11, 2018 at 11:43 PM
> Subject: Re: How to connect mysql with django
> To: 
>
>
> Did you download the .whl file first?
>
> On Sun, Nov 11, 2018 at 11:57 AM Ansh Srivastava <
> ansh.srivastav...@gmail.com> wrote:
>
>> Thank you @pujiarahman. I have tried out the above command but it
>> didn't work!It says::C:\Users\ansh\Desktop\Dje\p1\marvellous> pip
>> install mysqlclient-1.3.13-cp37-cp37m-win_amd64.whlRequirement
>> 'mysqlclient-1.3.13-cp37-cp37m-win_amd64.whl' looks like a filename, but
>> the file does not existmysqlclient-1.3.13-cp37-cp37m-win_amd64.whl is
>> not a supported wheel on this platform.Furthermore appreciated.
>>
>>
>> [image: Mailtrack]
>> <https://mailtrack.io?utm_source=gmail_medium=signature_campaign=signaturevirality5;>
>>  Sender
>> notified by
>> Mailtrack
>> <https://mailtrack.io?utm_source=gmail_medium=signature_campaign=signaturevirality5;>
>>  11/11/18,
>> 10:26:27 PM
>>
>> On Sun, Nov 11, 2018 at 8:46 PM pujiarahman 
>> wrote:
>>
>>> Hi,
>>>
>>> Go to this site  https://www.lfd.uci.edu/~gohlke/pythonlibs/#mysqlclient
>>> i use this for my python 3.7 and windows x64  :
>>> mysqlclient-1.3.13-cp37-cp37m-win_amd64.whl
>>> try :  pip install mysqlclient-1.3.13-cp37-cp37m-win_amd64.whl
>>>
>>> regards
>>>
>>> Pada Minggu, 11 November 2018 18.57.11 UTC+7, ansh.srivastav999 menulis:
>>>>
>>>> I m tryin' to connect mysql database with django, for that, I did this:-
>>>>
>>>>   python manage.py runserver
>>>>
>>>> but, this new mess came around sayin' :-
>>>>
>>>>  (django.core.exceptions.ImproperlyConfigured: Error loading MySQLdb 
>>>> module.
>>>>  Did you install mysqlclient?).
>>>>
>>>> But when I m tryin' to install mysqlclient through pip as:-
>>>>
>>>>   pip install mysqlclient
>>>>
>>>> another creepy thing comes up:-
>>>>
>>>>   _mysql.c(29): fatal error C1083: Cannot open include file: 'mysql.h': No
>>>>such file or directory
>>>>   error: command 'C:\\Program Files (x86)\\Microsoft Visual
>>>>   Studio\\2017\\Comm
>>>>   unity\\VC\\Tools\\MSVC\\14.15.26726\\bin\\HostX86\\x86\\cl.exe' failed
>>>>   with exit status 2
>>>>
>>>> For installing mysql.h, I have downloaded mysql connector too, but the
>>>> error continues. I don't know how to proceed furher. Any help would be
>>>> appreciated.
>>>>
>>>>
>>>> [image: Mailtrack]
>>>> <https://mailtrack.io?utm_source=gmail_medium=signature_campaign=signaturevirality5;>
>>>>  Sender
>>>> notified by
>>>> Mailtrack
>>>> <https://mailtrack.io?utm_source=gmail_medium=signature_campaign=signaturevirality5;>
>>>>  11/11/18,
>>>> 5:26:30 PM
>>>>
>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "Django users" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> 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/396993f8-9e9d-4e4e-ac6f-0e687576627d%40googlegroups.com
>>> <https://groups.google.com/d/msgid/django-users/396993f8-9e9d-4e4e-ac6f-0e687576627d%40googlegroups.com?utm_medium=email_source=footer>
>>> .
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails

Re: How to connect mysql with django

2018-11-11 Thread Jeff Williams
Did you download the .whl file first?

On Sun, Nov 11, 2018 at 11:57 AM Ansh Srivastava <
ansh.srivastav...@gmail.com> wrote:

> Thank you @pujiarahman. I have tried out the above command but it
> didn't work!It says::C:\Users\ansh\Desktop\Dje\p1\marvellous> pip install
> mysqlclient-1.3.13-cp37-cp37m-win_amd64.whlRequirement
> 'mysqlclient-1.3.13-cp37-cp37m-win_amd64.whl' looks like a filename, but
> the file does not existmysqlclient-1.3.13-cp37-cp37m-win_amd64.whl is not
> a supported wheel on this platform.Furthermore appreciated.
>
>
> [image: Mailtrack]
> 
>  Sender
> notified by
> Mailtrack
> 
>  11/11/18,
> 10:26:27 PM
>
> On Sun, Nov 11, 2018 at 8:46 PM pujiarahman  wrote:
>
>> Hi,
>>
>> Go to this site  https://www.lfd.uci.edu/~gohlke/pythonlibs/#mysqlclient
>> i use this for my python 3.7 and windows x64  :
>> mysqlclient-1.3.13-cp37-cp37m-win_amd64.whl
>> try :  pip install mysqlclient-1.3.13-cp37-cp37m-win_amd64.whl
>>
>> regards
>>
>> Pada Minggu, 11 November 2018 18.57.11 UTC+7, ansh.srivastav999 menulis:
>>>
>>> I m tryin' to connect mysql database with django, for that, I did this:-
>>>
>>>   python manage.py runserver
>>>
>>> but, this new mess came around sayin' :-
>>>
>>>  (django.core.exceptions.ImproperlyConfigured: Error loading MySQLdb module.
>>>  Did you install mysqlclient?).
>>>
>>> But when I m tryin' to install mysqlclient through pip as:-
>>>
>>>   pip install mysqlclient
>>>
>>> another creepy thing comes up:-
>>>
>>>   _mysql.c(29): fatal error C1083: Cannot open include file: 'mysql.h': No
>>>such file or directory
>>>   error: command 'C:\\Program Files (x86)\\Microsoft Visual
>>>   Studio\\2017\\Comm
>>>   unity\\VC\\Tools\\MSVC\\14.15.26726\\bin\\HostX86\\x86\\cl.exe' failed
>>>   with exit status 2
>>>
>>> For installing mysql.h, I have downloaded mysql connector too, but the
>>> error continues. I don't know how to proceed furher. Any help would be
>>> appreciated.
>>>
>>>
>>> [image: Mailtrack]
>>> 
>>>  Sender
>>> notified by
>>> Mailtrack
>>> 
>>>  11/11/18,
>>> 5:26:30 PM
>>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send 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/396993f8-9e9d-4e4e-ac6f-0e687576627d%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/CAHMQ533731OMH6UwgJDA__JpkP0d1_gR3OY0ek2tPMh7JN%3DuKQ%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/CAMgbqCe8Hkrbfh3YZ2aR_6ErJZgKSwJaJUqyP46ct3tHhsfeUQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Clarification on __in when attribute on left is a many to many field

2018-01-15 Thread Jeff Tchang

In the documentation on this page:
https://docs.djangoproject.com/en/2.0/topics/db/examples/many_to_many/

you have the following example:

>>> Article.objects.filter(publications__in=[1,2]).distinct()>> [, >> Python>]>


Does the __in for many to many fields mean for ANY publication in [1,2]. So 
does Django go through every publication in every article and if any of them 
are in the list on the right that Article is included in the result?



-Jeff

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send 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/331d1f73-ce56-4296-a9e3-bcbd033a1530%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Problem with Crispy-Forms

2016-09-26 Thread Jeff Silverman
I was able to fumble my way through to the solution.  What I think was 
missing from the TEASER example was to add "CRISPY_TEMPLATE_PACK = 
'bootstrap3'
" to the settings.py file.  Once this was added, the radio buttons properly 
displayed under one another.  

It was kind of fun picking my way through the users group, which is where I 
found the necessary option.

Thanks much for your assistance.

On Monday, September 26, 2016 at 6:21:49 AM UTC-4, Jeff Silverman wrote:

> I created an example application using Crispy-Forms.  In forms.py I am 
> using 
>
> radio_buttons = forms.ChoiceField(
> choices = (('option_one', 'Option one is this and that be sure to 
> include why it is great'),('option_two', 'Option two can is something else 
> and selecting it will deselect option one')),
> widget = forms.RadioSelect,
> initial = 'option_two',
> )
>
> However, when I execute, the two options appear on the same line.  can 
> anyone tell me what I did wrong?
>

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


Re: Problem with Crispy-Forms

2016-09-26 Thread Jeff Silverman
Thanks for the explanation.  I think I get it.  Does that, however, explain 
why the Radio buttons don't display on separate lines?  The "teaser" 
example on GITHUB shows the output cleanly space on separate lines.  That's 
the part I don't quite understand.

On Monday, September 26, 2016 at 6:21:49 AM UTC-4, Jeff Silverman wrote:
>
> I created an example application using Crispy-Forms.  In forms.py I am 
> using 
>
> radio_buttons = forms.ChoiceField(
> choices = (('option_one', 'Option one is this and that be sure to 
> include why it is great'),('option_two', 'Option two can is something else 
> and selecting it will deselect option one')),
> widget = forms.RadioSelect,
> initial = 'option_two',
> )
>
> However, when I execute, the two options appear on the same line.  can 
> anyone tell me what I did wrong?
>

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


Re: Problem with Crispy-Forms

2016-09-26 Thread Jeff Silverman
Followup.  I am playing with the teaser application on GITHUB.

One more thing, which may be the problem, and keep in mind I am new to 
DJANGO and Python...  What goes into the base.html file?

On Monday, September 26, 2016 at 6:21:49 AM UTC-4, Jeff Silverman wrote:

> I created an example application using Crispy-Forms.  In forms.py I am 
> using 
>
> radio_buttons = forms.ChoiceField(
> choices = (('option_one', 'Option one is this and that be sure to 
> include why it is great'),('option_two', 'Option two can is something else 
> and selecting it will deselect option one')),
> widget = forms.RadioSelect,
> initial = 'option_two',
> )
>
> However, when I execute, the two options appear on the same line.  can 
> anyone tell me what I did wrong?
>

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


Problem with Crispy-Forms

2016-09-26 Thread Jeff Silverman
I created an example application using Crispy-Forms.  In forms.py I am 
using 

radio_buttons = forms.ChoiceField(
choices = (('option_one', 'Option one is this and that be sure to 
include why it is great'),('option_two', 'Option two can is something else 
and selecting it will deselect option one')),
widget = forms.RadioSelect,
initial = 'option_two',
)

However, when I execute, the two options appear on the same line.  can 
anyone tell me what I did wrong?

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


How to create a database for my website in Django

2016-08-30 Thread Jeff Goes
I have little knowledge when it comes to the creation of databases. I would 
like to know if someone can help me set a database for my website step by 
step since I have a deadline due to next month to finish a project that 
requires that kind of knowledge. The idea is to input information on the 
website and save them into an internal database. I already have MySql and 
Sequel Pro installed but don't know how to link them to my website.

I appreciate it.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send 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/500d5d57-6c92-4f3e-947d-cfb5d74092d9%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: sqlite3.NotSupportedError: URIs not supported

2016-08-24 Thread Jeff Silverman
Well I may have answered my own question. Seems it may be a version
incompatibility. I built another virtual environment at Python 2.7 and the
error is gone. Also I am using the pycontrol module which is also not work
g with Python 3.4.



On Wednesday, August 24, 2016, Jeff Silverman <jsjazzj...@gmail.com> wrote:

> Can anyone point me in the right direction to solve this?  I am running
> DJANGO with python3.4 in virtualenv.  I get this error running manage.py.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com
> <javascript:_e(%7B%7D,'cvml','django-users%2bunsubscr...@googlegroups.com');>
> .
> To post to this group, send email to django-users@googlegroups.com
> <javascript:_e(%7B%7D,'cvml','django-users@googlegroups.com');>.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/django-users/0bce8a95-b735-4f45-ad41-13f1e7429ed7%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/0bce8a95-b735-4f45-ad41-13f1e7429ed7%40googlegroups.com?utm_medium=email_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>

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


sqlite3.NotSupportedError: URIs not supported

2016-08-24 Thread Jeff Silverman
Can anyone point me in the right direction to solve this?  I am running 
DJANGO with python3.4 in virtualenv.  I get this error running manage.py.

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


Re: Django simple Captacha

2016-07-20 Thread Jeff Willette
I wrote a simple app to use googles recaptcha, you can read about how to 
install it here... http://jrwillette.com/post/how-to-use-django-g-recaptcha/

On Tuesday, July 19, 2016 at 11:54:32 PM UTC+9, Ajay Kumar wrote:
>
> hi Guys
>
> I tried django-simple-captcha on refering 
> http://django-simple-captcha.readthedocs.io/…/la…/usage.html 
> . Every 
> thing works well and goes fine, I need few suggestion on it.
>
> 1. How efficiency is this?
> 2. How strong is this?
> 3. How easy/hard to cark this captcha?
> 4. Can we use this to high end applications?
>
> Guys please suggest me for above line items or any this else there please 
> let me know about django-simple-captcha, please explain me the pros and 
> cons of django-simple-captcha. Thanks in advance.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send 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/492af8c4-eccf-4948-9063-f457ab7482b0%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


why am I able to create and save a user via the shell without any username?

2016-07-19 Thread Jeff Willette
I have a custom user model via AbstractUser and I think the django-app 
`spirit` (which is a forum) has also modified my user model a bit. I am 
trying to write some tests and I do not know if this behavior is normal or 
not. 

Here is my model.py file that defines the user with the extra fields that I 
wanted personally...

from django.contrib.auth.models import AbstractUser


class CustomUserProfile(AbstractUser):
 '''When I was defining the custom user model for the first time I had to 
migrate things in
 a very specific order for them to work. I had to migrate the main app 
first (the one with this model)
 then the sites app and then the main again and then everything else.'''


 topic = models.ManyToManyField(MyModel, through='Info')


class Info(models.Model):
 user = models.ForeignKey(CustomUserProfile, on_delete=models.CASCADE)
 topic = models.ForeignKey(MyModel, on_delete=models.CASCADE)
 level = models.IntegerField()

so when i start a shell I am able to do...

from topic.models import *
user = CustomUserProfile()
user.save()

and then if I pull all of my user objects I indeed see a blank user without 
a username. Is this normal behavior? Should I do something to change 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/6f82ced2-2aed-413b-ae58-d68f73d3fc0d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Basic M2M Self Reference Through Question

2015-09-02 Thread jeff newburn
I apologize if this is basic and I am just missing something in the django 
docs.  The Django ORM allows you to do a self reference through another 
table.  I understand everything about this process EXCEPT how Django 
determines which of the foreign keys to use for each side of the M2M 
relationship.

class MyUser(...):
connections = models.ManyToManyField('self', through=Relationship, 
symmetrical=False)

class Relationship(...):
follower = models.ForeignKey(MyUser)
following = models.ForeignKey(MyUser)

So in the psuedocode example above how does Django ORM know which of the 2 
foreign key fields to connect to?  Does it just assume the first field is 
the one to use?  Thanks for any help on 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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/ce496175-fdd6-4a7b-9e7c-e306bbd527c4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: NoReverseMatch in Django (url ploblem)

2015-07-05 Thread Jeff Gaoey
James - Thank You Very Much

that true it doesn't need /. everything work fine as I want :D.

เมื่อ วันศุกร์ที่ 3 กรกฎาคม ค.ศ. 2015 7 นาฬิกา 38 นาที 54 วินาที UTC+7, 
James Schneider เขียนว่า:
>
>
> > > I'm a beginner of Django I want to set my url with database field_name
> > > instead of use primary key from Django tutorial. This is my code.
> > >
> > > *mysite*
> > > **dwru/urls.py**
> > > urlpatterns = [
> > > url(r'^$', include('product.urls', namespace="product")),
> > > ]
> >
> > This regex is incorrect, and will only match a URL of '/', which is
> > probably not what you want (since you are making other URL's like
> > '/TestCA01' down below). You need to remove the $ from the regex to
> > pass along the entire URL string to the include. You probably need a
> > slash in there also to remove it as a prefix when it is passed along
> > to the include:
> >
> > url(r'^/', include('product.urls', namespace="product")),
> >
>
> I was thinking about this and you may not need the /, if it doesn't work, 
> try without it. I'm not in front of a computer to verify.
>
> -James
>  

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


NoReverseMatch in Django (url ploblem)

2015-07-02 Thread Jeff Gaoey


I'm a beginner of Django I want to set my url with database field_name 
instead of use primary key from Django tutorial. This is my code.

*mysite***dwru/urls.py**
urlpatterns = [
url(r'^$', include('product.urls', namespace="product")),]
*myapp***product/urls.py**
urlpatterns = [
   url(r'^$', views.index, name='index'),
   url(r'^(?P[-_\w]+)/$', views.product_list_from_index, 
name='catalog'),]
**product/views.py**def product_list_from_index(request, name_catalog):
   catalog = get_object_or_404(Catalog, name_catalog=name_catalog)
   context = {
   'catalog': catalog}
   return render(request,'product/product_list.html', context)

**product/models.py**class Catalog(models.Model):
  name_catalog = models.CharField(max_length=45)
  product = models.ManyToManyField(Product)
**template/product/index.html**{% for catalog in catalog_list %}
{{ 
catalog.name_catalog }}{% endfor %}

Then I add Catalog field with "TestCa01" then it shown an error

NoReverseMatch at /Reverse for 'catalog' with arguments '(u'TestCa01',)' and 
keyword arguments '{}' not found. 1 pattern(s) tried: 
[u'$(?P[-_\\w]+)/$']

it kind of some problem with this line in template

{% url 'product:catalog' catalog.name_catalog %}

any Idea?

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/65b8fb8e-02ae-4441-88cc-114eb662cdee%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Django model for non web applications

2015-07-01 Thread Jeff Fritz
I'm fairly new to Django and making my way through the tutorial.

Knowing what I've learned so far, I'd like to explore using 
django.db.models.Model in a non-web application. I'd like to take the 
entire model layer and use it for database access in a standalone, 
multithreaded python 3.4 application. It is not a web application. I would 
like to be able to take advantage of the migration capabilities in 
manage.py.

Questions:

1. Is it as simple as adding `from djanago.db import models`? Would this 
bring in any unnecessary django packages/modules, considering I will not be 
developing a web application, not using views, templating, etc?

2. Is the django model layer thread safe? Specifically, when using sqlite3 
as a back end?

3. Are there other clean ORM/database model layer frameworks/packages that 
I should consider for python 3.4?

Thanks very much for any assistance,
Jeff

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


DjangoCon US: Call For Proposals: Last Call

2015-05-15 Thread Jeff Triplett
Hello everyone,

We are down to our last call for talk and tutorial submissions for 
DjangoCon US this year.

If you have a talk or tutorial idea then I would encourage you to consider 
submitting 
one today <https://2015.djangocon.us/speaking/cfp/> before it's too late 
because we will not be extending the deadline this year. 

We will accept submissions until midnight Anywhere on Earth 
<http://en.wikipedia.org/wiki/Anywhere_on_Earth> today (May 15th).

Regards,

Jeff Triplett
Chair, DjangoCon US 2015
@webology / @djangocon

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


Looking for remote python/django software engineers

2015-04-06 Thread Jeff
If this post is not allowed, please delete. Thanks

I lead a development team that uses django and python to build an online 
web portal.  I am looking for additional help short or long term, if you 
are **very comfortable with all of the following skills** please let me 
know and send your resume/background.

This can be a work from home position, during the core business hours 
9am-4pm gmt-7 (US Mountain Time Zone)


1) Django managers and querysets (ORM) as database access layer. 
2) Service/API/domain layer via django models.
3) Security (role based authentication and authorization) via class 
permissions and/or 3rd party Djagno apps for role based security, use of 
decorators in URLConf or mixins, etc...
4) Unit and integration testing, tdd and/or bdd 
5) Distributed architecture using multiple instances of web and app 
servers. 
6) Dependency Injection via INSTALLED_APPS or other ways if they exist. 
7) Celery for async queues and Enterprise Integration Patterns. 


We also use Github, jenkins, AWS and Linux, and need engineers that can 
build apps that are easy to maintain, extend, are secure, and can scale out 
to 1000s of concurrent connections.  Also familiar with DRY and YAGNI and 
know how they determine what and how you create solutions. We also use 
scrum and lira to manage our work.  
I can be reached at j-man-gan-@-g-mail.c-om  (remove the dashes - )

Thanks.

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


Enterprise software patterns for django/Python ?

2015-03-30 Thread Jeff Mangan
Looking for info or links on design patterns and architecture references on 
building a web portal using Python and Django. Looking for things like how to 
model your solutions, layers, services, data and business logic, to promote 
scale, security, and performance. I have a Microsoft background and want to 
understand the same concepts of building cloud an app using the onion layer and 
SOLID design principles approach, service layer, domain layer, with unit and 
integration tests, etc... To build an app the could scale using things like 
dependency injection, stateless restful service layer, domain (ddd) layer, 
shared cross cutting concerns, with role based authentication and authoration 
ttl token security, and I think that's about it. That's how I would build an 
enterprise app with .net. Is this similar in python and django and are there 
any examples ?

Any guidance is greatly 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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/e15b136d-edb1-47d1-b4c3-025e53bb1251%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Recommendations for hosting service?

2015-01-06 Thread Jeff Kerr
I'm a total noob, but I was able to get a basic Django app (Postgresql as 
DB) running on DigitalOcean without much trouble. It wasn't *easy--*in 
fact, I was ready to throw my computer out the window a few times--but I'm 
happy that I now have that skill.

DigitalOcean also has a great interface and very reasonable pricing. 

On Tuesday, January 6, 2015 6:30:18 AM UTC-5, Bobby Mozumder wrote:
>
> Anyone have recommendations for hosting services that can do Django, 
> Node.js, Postgreqsl, python3, as well as PHP/MySQL for legacy stuff?  I’m 
> also looking to have IMAP email.  This would be for several domains, with 
> maybe 100GB of data. 
>
> -bobby

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


Re: deploying django

2014-08-05 Thread Jeff Trawick
On Monday, August 4, 2014 6:12:16 PM UTC-4, Adrian Marshall wrote:
>
> I've went through a few different ways. If your set on using apache, 
> Configure Apache with Mod-WSGI on a server.
>
> Here's a Good Tutorial: 
> http://thecodeship.com/deployment/deploy-django-apache-virtualenv-and-mod_wsgi/
>
> If you're having trouble with that and your app isn't too demanding you 
> can easily upload on Heroku and control it easily using Git commands.
>
> check out the docs: 
> https://devcenter.heroku.com/articles/getting-started-with-django
>
> An alternative to both of those would be to use Nginx with uWSGI. If you 
> want to go that route here's a good tutorial:
>
> http://uwsgi-docs.readthedocs.org/en/latest/tutorials/Django_and_nginx.html#concept
>

As if that weren't enough, you can deploy with Apache httpd proxy + uWSGI 
in a very similar manner to Nginx + uWSGI. Some may find that more natural 
than with mod_wsgi.  You can see how similar it can be to an Nginx setup 
at http://emptyhammock.com/projects/info/pyweb/

But the op says "wamp" which usually means Windows.

gunicorn isn't for Windows, uWSGI 1.9 docs mention some experimental Cygwin 
port.  What's a suitable production-ready Python "app server" for Windows 
that would work with Apache httpd or Nginx?  Maybe Apache httpd + mod_wsgi 
is the way to go there.  (shrug)



>
> Good luck!
>
> On Monday, August 4, 2014 4:53:00 AM UTC-4, ngangsia akumbo wrote:
>>
>> I have created a complete site, 
>>
>> i have configured it to run with mysql using wamp
>>
>> i have also configured apache in wamp which is up and running
>>
>> so i want to deploy the site to run as a life page on the internet using 
>> apache
>>
>> what should i 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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/8237ffad-c51b-45d0-b866-4b1c65b10e18%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Opening up multiple database connections per request?

2014-02-04 Thread jeff do
Thank you Russ. Your solution to define multiple database sources to a 
single database was very straightforward

On Tuesday, January 21, 2014 4:11:43 PM UTC-8, Russell Keith-Magee wrote:
>
> Hi Jeff,
>
> Correct - Django has one database connection per request. 
>
> If you want to open multiple connections, you're going to look into 
> Django's support for multiple databases. You're using django.db.connection; 
> this is really just shorthand for django.db.connections['default']. If you 
> define an 'other' database in your settings file, you can connect to 
> django.db.connections['other'] as well, using a separate connection.
>
> Although this was developed with the intention of accessing multiple 
> *different* database sources (e.g., a database master and a slave, or a 
> sharded database), there's no reason you can't have multiple connections to 
> the same database (in fact, this can be a handy way to test logic around 
> master/slave configurations without needing to set up a master/slave 
> database configuration).
>
> The simple approach to this requires pre-declaration of the number of 
> connections you want to have; if you're particularly ingenious, you might 
> be able to mess with the internals of the ConnectionManager object to 
> dynamically create extra connections at runtime based upon the definition 
> of your base database. However, this is undocumented API, so you're on your 
> own if you take this path.
>
> Yours,
> Russ Magee %-)
>
>
> On Wed, Jan 22, 2014 at 7:40 AM, jeff do <jep...@gmail.com 
> >wrote:
>
>> Is it possible to open up multiple database connections inside of one 
>> request in Django? I am using Django 1.6 and Python3.3. 
>>
>> In my use case, I have a web application that executes raw SQL against a 
>> data warehouse we have. For example, one page may require five different 
>> SQL queries to be executed to pull down all the datasets necessary to 
>> display as charts, tables, etc.
>>
>> Using only one database connection and executing the SQL queries 
>> synchronously is too slow, so I am trying to use threads (specifically the 
>> concurrent.futures package in stdlib) to run my queries asynchronously. In 
>> particular, I have code that looks like:
>>
>>   
>>
>> from django.db import connection
>>
>> from concurrent.futures import ThreadPoolExecutor, as_completed 
>>
>> def execute_query(sql):
>>
>>cursor = connection.cursor()
>>
>>…
>>
>>rows = cursor.fetchall() 
>>
>> return rows
>>
>> def execute_queries_asynchronously(list_of_sql_queries):
>>
>> datasets = []
>>
>> with ThreadPoolExecutor(max_workers=3) as executor:
>>
>> futures = [executor.submit(execute_query, query) for query in 
>> list_of_sql_queries]
>>
>> for future in as_completed(futures):
>>
>> datasets.append(future.result())
>>
>> return datasets
>>
>>
>>
>> When I run the above code in shell, total execution time improves 
>> noticeably which is expected (about 2x-3x faster). However, when I put this 
>> code in my web application, I get an almost negligible performance gain, if 
>> any. It doesn’t seem like Django is opening up more DB connections. I’d 
>> like Django to open up a new connection or pull from the connection pool 
>> for every worker thread. Does the Django connection handler limit the 
>> number of available DB connections to a request to only one?
>>
>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to django-users...@googlegroups.com .
>> To post to this group, send email to django...@googlegroups.com
>> .
>> Visit this group at http://groups.google.com/group/django-users.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/django-users/cb7ebe95-1565-4f4b-84cd-e25a36a7497a%40googlegroups.com
>> .
>> For more options, visit https://groups.google.com/groups/opt_out.
>>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/602af76f-99aa-4826-8351-00fa88ca79a9%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Opening up multiple database connections per request?

2014-01-21 Thread jeff do


Is it possible to open up multiple database connections inside of one 
request in Django? I am using Django 1.6 and Python3.3. 

In my use case, I have a web application that executes raw SQL against a 
data warehouse we have. For example, one page may require five different 
SQL queries to be executed to pull down all the datasets necessary to 
display as charts, tables, etc.

Using only one database connection and executing the SQL queries 
synchronously is too slow, so I am trying to use threads (specifically the 
concurrent.futures package in stdlib) to run my queries asynchronously. In 
particular, I have code that looks like:

 

from django.db import connection

from concurrent.futures import ThreadPoolExecutor, as_completed 

def execute_query(sql):

   cursor = connection.cursor()

   …

   rows = cursor.fetchall() 

return rows

def execute_queries_asynchronously(list_of_sql_queries):

datasets = []

with ThreadPoolExecutor(max_workers=3) as executor:

futures = [executor.submit(execute_query, query) for query in 
list_of_sql_queries]

for future in as_completed(futures):

datasets.append(future.result())

return datasets



When I run the above code in shell, total execution time improves 
noticeably which is expected (about 2x-3x faster). However, when I put this 
code in my web application, I get an almost negligible performance gain, if 
any. It doesn’t seem like Django is opening up more DB connections. I’d 
like Django to open up a new connection or pull from the connection pool 
for every worker thread. Does the Django connection handler limit the 
number of available DB connections to a request to only one?

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/cb7ebe95-1565-4f4b-84cd-e25a36a7497a%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


UI Engineer with Django @ Very Early Stage Startup

2013-06-12 Thread jeff

http://www.collegefeed.com/cf/featured-jobs/

*Entry Level UI Engineer @ Zubhium*

*About Us:*

We're a passionate team of accomplished mobile technologists building a 
mobile app framework that helps developers make their apps better - from 
over the air distribution to crash analysis to in app feedback & helpdesk, 
we're used by thousands of developers around the world to make their apps 
better. 

*About You:*

- Hands on experience with  HTML5, CSS3 , jQuery , Photoshop

- Great eye for User interactions and design 

- Familiarity with Git & test driven development

• Passion for quality & Practical perspective on software engineering 
discipline.

- Clear communication skills

- Familiarity with Django is big plus

- Share your past work and portfolio

*The Perks*

- Work with very very smart people 

- Get into a very early stage company and make a big impact 

- All the freedom you can get

- Salary + Equity

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: input data will be lost if there are errors in the form

2013-05-30 Thread Jeff Hsu
Thank you, Tom.  It's exactly what I need.


On Thu, May 30, 2013 at 3:55 AM, Tom Evans <tevans...@googlemail.com> wrote:

> On Thu, May 30, 2013 at 3:31 AM, Jeff Hsu <jyhsu1...@gmail.com> wrote:
> > Hi,
> >
> > I find this very interesting.  In my html template form:
> >
> >  > enctype="multipart/form-data">
> > {% csrf_token %}
> >
> > {{ form.title.errors}}
> > 
> > {{form.title}}
> > .
> > This is fine, and it will show the previous inputs if there are errors in
> > the form, however, if I try to customize the html input field, for
> example,
> > as below, instead of using automatic generated {{form.title}}
> >> placeholder="Question Title" name="title" cols="50" rows="1">
> >
> > The previous inputs will be lost if there are errors in the form.  Does
> > anybody know why?  I need some direction and explanation for this.  Thank
> > you
> >
> > Jeff
>
> If you output the fields yourself, you are responsible for ensuring
> that the value, name, id - everything, in fact - is correct. In this
> case, when you are outputting your textarea manually, you are omitting
> the value, either from the initial value passed in, or from the
> submitted data when redisplaying a bound form that has errors.
>
> So, you can either do all that work yourself for each field, or you
> can allow django to display the field, and manipulate django so that
> it creates  your HTML as you like it. For instance, you can pass
> additional attributes to the widget used to render the field, read
> more about widgets in the docs:
>
> https://docs.djangoproject.com/en/1.5/ref/forms/widgets/
>
> Cheers
>
> Tom
>
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "Django users" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/django-users/2BMKRHHPj38/unsubscribe?hl=en
> .
> To unsubscribe from this group and all its topics, send an email to
> django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




input data will be lost if there are errors in the form

2013-05-29 Thread Jeff Hsu
Hi,

I find this very interesting.  In my html template form:


{% csrf_token %}
   
{{ form.title.errors}}

*{{form.title}}*
.
This is fine, and it will show the previous inputs if there are errors in 
the form, however, if I try to customize the html input field, for example, 
as below, instead of using automatic generated {{form.title}}
 *  *

The previous inputs will be lost if there are errors in the form.  Does 
anybody know why?  I need some direction and explanation for this.  Thank 
you

Jeff



-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: django-social-auth problem with facebook

2013-04-16 Thread Jeff Hsu
First, check to see if you have 3 tables, social_auth_association,
social_auth_nonce, and social_auth_usersocialauth.  If not, you need to
create those DB tables.  SyncDB did not work for me.  I had south
installed.  So, you just do use south to create proper schema for those DB
tables.  Some tutorial on south:
http://south.readthedocs.org/en/latest/tutorial/part1.html

Jeff


On Tue, Apr 16, 2013 at 8:35 AM, Alex Ksenzov <alexhai...@gmail.com> wrote:

> Hi Jeff .I have this problem too, but still can't figure out. Can you
>> please provide resolving more detail and step by step please. Thanks.
>>
>>  --
> 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/9YkrCD2veRQ/unsubscribe?hl=en
> .
> To unsubscribe from this group and all its topics, send an email to
> django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: django-social-auth problem with facebook

2013-04-15 Thread Jeff Hsu
I solved the problem.  The problem is that I set up my project with south.
 So, I have to use south migration to set up the proper database schema for
social_auth.

Thanks,
Jeff


On Mon, Apr 15, 2013 at 10:50 AM, Jeff Hsu <jyhsu1...@gmail.com> wrote:

> Hello Serdar,
>
>Thank you so much, I do use postgresql as my database.  The problem
> might be what you listed above, I'll take deep look at it.  If I have more
> questions, I'll post it in that group.  Thank you!
>
> Jeff
>
>
> On Mon, Apr 15, 2013 at 1:36 AM, Serdar Dalgic <s...@serdardalgic.org>wrote:
>
>> Hi,
>>
>> On Mon, Apr 15, 2013 at 9:01 AM, Jeff Hsu <jyhsu1...@gmail.com> wrote:
>>
>>> Hi, I just pip installed django-social-auth from omab today on
>>> github(beginner here).  I think I can almost get it to work with facebook
>>> login, but I always have this "InternalError: Exception Value: current
>>> transaction is aborted, commands ignored until end of transaction block",
>>> after I log in with my facebook account and before I redirect to the
>>> profile page.  The request url shows
>>>
>>> http://127.0.0.1:8000/complete/facebook/?redirect_state=xxx=xxx=xxx.
>>>  I'm using Django 1.5.  Can anybody give me some directions to debug this?
>>>
>>>
>> Your question is Django-Social-Auth specific. If you ask that question
>> http://groups.google.com/group/django-social-auth you would get more
>> accurate and fast answer. I'd suggest you to do so.
>>
>> I've met the same error while using postgresql as the database, and the
>> reason was that, when a transaction meets an error, it changes its
>> stabilized state. If you do not rollback this transaction, further
>> transactions after this one gives such error. You should find the
>> problematic transaction to get rid of this error. For details, see
>> https://docs.djangoproject.com/en/dev/topics/db/transactions/#handling-exceptions-within-postgresql-transactions
>>
>> More info about this issue from Django Social Auth users/developers would
>> appear on Django Social Auth mailing list.
>>
>> --
>> - Serdar Dalgıç <s...@serdardalgic.org>
>> FLOSS Developer, Life & Nature Hacker
>> twitter: https://twitter.com/serdaroncode
>>
>> --
>> 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/9YkrCD2veRQ/unsubscribe?hl=en
>> .
>> To unsubscribe from this group and all its topics, send an email to
>> django-users+unsubscr...@googlegroups.com.
>> To post to this group, send email to django-users@googlegroups.com.
>> Visit this group at http://groups.google.com/group/django-users?hl=en.
>> For more options, visit https://groups.google.com/groups/opt_out.
>>
>>
>>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: django-social-auth problem with facebook

2013-04-15 Thread Jeff Hsu
Hello Serdar,

   Thank you so much, I do use postgresql as my database.  The problem
might be what you listed above, I'll take deep look at it.  If I have more
questions, I'll post it in that group.  Thank you!

Jeff


On Mon, Apr 15, 2013 at 1:36 AM, Serdar Dalgic <s...@serdardalgic.org> wrote:

> Hi,
>
> On Mon, Apr 15, 2013 at 9:01 AM, Jeff Hsu <jyhsu1...@gmail.com> wrote:
>
>> Hi, I just pip installed django-social-auth from omab today on
>> github(beginner here).  I think I can almost get it to work with facebook
>> login, but I always have this "InternalError: Exception Value: current
>> transaction is aborted, commands ignored until end of transaction block",
>> after I log in with my facebook account and before I redirect to the
>> profile page.  The request url shows
>>
>> http://127.0.0.1:8000/complete/facebook/?redirect_state=xxx=xxx=xxx.
>>  I'm using Django 1.5.  Can anybody give me some directions to debug this?
>>
>>
> Your question is Django-Social-Auth specific. If you ask that question
> http://groups.google.com/group/django-social-auth you would get more
> accurate and fast answer. I'd suggest you to do so.
>
> I've met the same error while using postgresql as the database, and the
> reason was that, when a transaction meets an error, it changes its
> stabilized state. If you do not rollback this transaction, further
> transactions after this one gives such error. You should find the
> problematic transaction to get rid of this error. For details, see
> https://docs.djangoproject.com/en/dev/topics/db/transactions/#handling-exceptions-within-postgresql-transactions
>
> More info about this issue from Django Social Auth users/developers would
> appear on Django Social Auth mailing list.
>
> --
> - Serdar Dalgıç <s...@serdardalgic.org>
> FLOSS Developer, Life & Nature Hacker
> twitter: https://twitter.com/serdaroncode
>
> --
> 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/9YkrCD2veRQ/unsubscribe?hl=en
> .
> To unsubscribe from this group and all its topics, send an email to
> django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: django-social-auth problem with facebook

2013-04-15 Thread Jeff Hsu
Thanks for the reply.  I did sync db before I run the code.  I am actually
on localhost when I test it.  Do I have to be online to test it?  But, I
was successful on authenticating in the Login Dialog.  This error happens
during the code exchanging process for the access token I think.

Thanks,
Jeff


On Mon, Apr 15, 2013 at 8:49 AM, Brad Pitcher <bradpitc...@gmail.com> wrote:

> In my experience, that particular error always means that the database
> doesn't match what you have in your models. Try a syncdb and/or check your
> south migrations to make sure your database is up to date.
>
> -
> Brad Pitcher
> Software Developer
> (702)723-8255
>
>
> On Sun, Apr 14, 2013 at 11:01 PM, Jeff Hsu <jyhsu1...@gmail.com> wrote:
>
>> Hi, I just pip installed django-social-auth from omab today on
>> github(beginner here).  I think I can almost get it to work with facebook
>> login, but I always have this "InternalError: Exception Value: current
>> transaction is aborted, commands ignored until end of transaction block",
>> after I log in with my facebook account and before I redirect to the
>> profile page.  The request url shows
>>
>> http://127.0.0.1:8000/complete/facebook/?redirect_state=xxx=xxx=xxx.
>>  I'm using Django 1.5.  Can anybody give me some directions to debug this?
>>
>> Thank you tons,
>> Jeff
>>
>>
>>  --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to django-users+unsubscr...@googlegroups.com.
>>
>> To post to this group, send email to django-users@googlegroups.com.
>> Visit this group at http://groups.google.com/group/django-users?hl=en.
>> For more options, visit https://groups.google.com/groups/opt_out.
>>
>>
>>
>
>  --
> 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/9YkrCD2veRQ/unsubscribe?hl=en
> .
> To unsubscribe from this group and all its topics, send an email to
> django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




django-social-auth problem with facebook

2013-04-15 Thread Jeff Hsu
Hi, I just pip installed django-social-auth from omab today on 
github(beginner here).  I think I can almost get it to work with facebook 
login, but I always have this "InternalError: Exception Value: current 
transaction is aborted, commands ignored until end of transaction block", 
after I log in with my facebook account and before I redirect to the 
profile page.  The request url shows 
http://127.0.0.1:8000/complete/facebook/?redirect_state=xxx=xxx=xxx. 
 I'm using Django 1.5.  Can anybody give me some directions to debug this?

Thank you tons,
Jeff


-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Django-SEO issue

2013-01-23 Thread Jeff Ammons
Looks like a bug or partial implementation issue. I just submitted a pull 
request, so hopefully it'll get accepted quickly.

https://github.com/willhardy/django-seo/pull/35

-Jeff

On Tuesday, January 22, 2013 1:36:54 PM UTC-7, jondbaker wrote:
>
>  I wasn't. If anyone has a solution I'd still be interested in cleaning 
> up the clutter and removing the backends I'm not using.
>
> On 01/22/2013 12:05 PM, Jeff Ammons wrote:
>  
> Were you able to figure out what was happening here? I'm experiencing the 
> same issue. 
>
> On Friday, August 17, 2012 2:16:53 PM UTC-6, jondbaker wrote: 
>>
>> I've successfully installed Django-SEO, but when I try to limit the 
>> number of backends (I only need/want my admin to have 'path' and not the 
>> other three) I am met with the following error: 
>> AttributeError at /admin/ 'NoneType' object has no attribute '_meta' 
>>
>>  I am using the documentation here: 
>> http://django-seo.readthedocs.org/en/latest/reference/definition.html#Meta.backends
>>  
>>  *seo.py*
>> from rollyourown import seo
>>
>>  class AppMetadata(seo.Metadata):
>> title = seo.Tag(head=True, max_length=68)
>> description = seo.MetaTag(max_length=155)
>>
>>  class Meta:
>> backends = ('path',)
>> #backends = ('path', 'modelinstance', 'model', 'view',) This 
>> works but includes all default backends
>>
>>  *admin.py*
>> from django.contrib import admin
>> from rollyourown.seo.admin import register_seo_admin
>>
>>  from localsite.seo import AppMetadata
>>
>>  register_seo_admin(admin.site, AppMetadata)
>>
>  -- 
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To view this discussion on the web visit 
> https://groups.google.com/d/msg/django-users/-/gB5-ZyRCpHIJ.
> To post to this group, send email to django...@googlegroups.com
> .
> To unsubscribe from this group, send email to 
> django-users...@googlegroups.com .
> For more options, visit this group at 
> http://groups.google.com/group/django-users?hl=en.
>
>
>
> -- 
> Software Developerhttps://github.com/jondbaker
> GPG: 1F6F3FFD
>
>  

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/McxOegohZOEJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Django-SEO issue

2013-01-22 Thread Jeff Ammons
Were you able to figure out what was happening here? I'm experiencing the 
same issue.

On Friday, August 17, 2012 2:16:53 PM UTC-6, jondbaker wrote:
>
> I've successfully installed Django-SEO, but when I try to limit the number 
> of backends (I only need/want my admin to have 'path' and not the other 
> three) I am met with the following error:
> AttributeError at /admin/'NoneType' object has no attribute '_meta'
>
> I am using the documentation here: 
> http://django-seo.readthedocs.org/en/latest/reference/definition.html#Meta.backends
>
> *seo.py*
> from rollyourown import seo
>
> class AppMetadata(seo.Metadata):
> title = seo.Tag(head=True, max_length=68)
> description = seo.MetaTag(max_length=155)
>
> class Meta:
> backends = ('path',)
> #backends = ('path', 'modelinstance', 'model', 'view',) This works 
> but includes all default backends
>
> *admin.py*
> from django.contrib import admin
> from rollyourown.seo.admin import register_seo_admin
>
> from localsite.seo import AppMetadata
>
> register_seo_admin(admin.site, AppMetadata)
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/gB5-ZyRCpHIJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



DateTimeField received a naive datetime (2013-01-10 00:00:00) while time zone support is active.

2013-01-11 Thread Jeff Hsu
Hi all,

   I kept getting DateTimeField received a naive datetime (2013-01-10 
00:00:00) while time zone support is active. but I can't figure out where 
it's receiving a naive datetime.  I have USE_TZ set to True in my setting 
file(stores timezone aware object in mysql?).  My url is as below:

urlpatterns = patterns('django.views.generic.date_based', #add the 
repetitive pattern here
url(r'^$', 'archive_index', entry_info_dict, 
name='coltrane_entry_archive_index'),
url(r'^(?P\d{4})/$','archive_year', entry_info_dict, 
name='coltrane_entry_archive_year'),
url(r'^(?P\d{4})/(?P\w{3})/$','archive_month', 
entry_info_dict, 
name='coltrane_entry_archive_month'),

url(r'^(?P\d{4})/(?P\w{3})/(?P\d{2})/$','archive_day', 
entry_info_dict, 
name='coltrane_entry_archive_day'),

url(r'^(?P\d{4})/(?P\w{3})/(?P\d{2})/(?P[-\w]+)/$',
'object_detail', entry_info_dict, name='coltrane_entry_detail'), 
#the forth arg will this patter a name
 #[-\w] will match letter, number or a hyphen
)

Every time I access a detail page from the archive index page, the error 
will pop out.  I'm using generic view to do my detail page, and I can 
figure out what's wrong.  Can anybody give me some direction?

http://dpaste.com/871999/

Thank you,
Jeff

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/q3z2y6RI3x4J.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Problem with auto tests Get an error creating the test database: (1044, "Access denied for user 'viewbank_django'@'localhost' to database 'test_viewbank_django'")

2012-12-30 Thread Jeff
Thanks Ryan,

That almost worked. The first run of the test script failed with the same 
error, but if I create the database from the mysql client in the server 
control panel, the script then asks if you want to delete the database and 
then continues and runs the tests.

Also the test database is not destroyed by the script when it finishes 
running.

So while not perfect it does seem to work ok.

Again thanks
Jeff

On Sunday, December 30, 2012 3:02:25 AM UTC+8, Ryan Blunden wrote:
>
> Hey Jeff,
>
> There sure is. Just specify a "TEST_NAME" key in the database 
> configuration dictionary and you're good to go.
>
>
> https://docs.djangoproject.com/en/dev/topics/testing/overview/#the-test-database
>
> Cheers,
> Ryan
>
> On 29/12/2012, at 7:27 AM, Jeff <je...@ccmail.co > wrote:
>
> When I run the command - "python manage.py test polls" I get the following 
> error - error creating the test database: (1044, "Access denied for user 
> 'viewbank_django'@'localhost' to database 'test_viewbank_django'")
>
> I am using a shared server that will only allow me to create a database 
> prefixed with viewbank_.
>
> Using the MYSQL client I can create viewbank_django_test or any variation 
> I like as long as it starts with viewbank_.
>
> Is there a way to change the way django names the test database?
>
> Thanks in advance
> Jeff
>
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To view this discussion on the web visit 
> https://groups.google.com/d/msg/django-users/-/oxBvQnPWaJgJ.
> To post to this group, send email to django...@googlegroups.com
> .
> To unsubscribe from this group, send email to 
> django-users...@googlegroups.com .
> For more options, visit this group at 
> http://groups.google.com/group/django-users?hl=en.
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/sV0vQOFbcacJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Problem with auto tests Get an error creating the test database: (1044, "Access denied for user 'viewbank_django'@'localhost' to database 'test_viewbank_django'")

2012-12-29 Thread Jeff
When I run the command - "python manage.py test polls" I get the following 
error - error creating the test database: (1044, "Access denied for user 
'viewbank_django'@'localhost' to database 'test_viewbank_django'")

I am using a shared server that will only allow me to create a database 
prefixed with viewbank_.

Using the MYSQL client I can create viewbank_django_test or any variation I 
like as long as it starts with viewbank_.

Is there a way to change the way django names the test database?

Thanks in advance
Jeff

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/oxBvQnPWaJgJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: New to Django; walking through djangoproject tutorial; can't get poll to work

2012-12-18 Thread Jeff Tchang
My first guess is that

{% for choice in poll.choice_set.all %}

is empty. So you have no choices attached to the poll. You can verify
this by looking at the generated HTML source and seeing if you have
any radio buttons at all. Since you said you didn't that is my guess.

I didn't go back and look at the tutorial but try creating some
choices for the poll.

-Jeff

On Tue, Dec 18, 2012 at 7:56 PM, Deron <dsizemor...@gmail.com> wrote:
> Hi,
>
> First post here. I'm extremely new to Django and I have been fumbling my way
> through the DjangoProject "poll" app tutorial for a couple weeks now. I
> understand a lot of what's going on, but a lot of things are completely lost
> on me as well. That said, I'm to the point of actually using the poll app.
> I've created a view so you can view the poll, select a choice and then click
> "vote." Problem is, when I view the page (/polls/1/) I see my heading which
> is "What's Up?" and I see a "vote" input button, but no radio button. I'm
> not exactly sure why it's not showing up. Anyone want to take a shot in the
> dark on this one? Here's my "detail.html" view (copied straight from the
> tutorial):
>
> {{ poll.question }}
> {% if error_message %}{{ error_message }}{% endif %}
> 
> {% csrf_token %}
> {% for choice in poll.choice_set.all %}
>  value="{{ choice.id }}" />
> {{ choice.choice }} />
> {% endfor %}
> 
> 
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/django-users/-/DtV-YM6VU44J.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Site Architecture

2012-09-07 Thread Jeff Regan
Thanks for the reply.

I wanted to use Django for the templating engine and, in the future, some
of the open source applications (commenting, graphing, and blogs for
example) that were built as Django apps.  Also, I like being able to build
my urls.

After discussing the web architecture with one of the other developers at
my company, we came up with the below.  What do you think?

Database -> Services Project -> Reference to Services Project -> Django
Views -> Django Urls -> HttpPosts to Django with jQuery -> HTML/jQuery

We're debating whether the Django project should talk to the services
project over http requests or by importing the project.  Importing the
project allows us to have secure functionality that we don't have to worry
about exposing to the internet.  Also, it would allow for a faster and more
reliable connection to the backend.  Consuming data over Http requests
gives the web application a similar architecture as the other applications
(phones, outside apps) that do the same.  It also puts the services project
out on it's own island.  It may seem obvious, but the other developer was
in favor of importing the project.  I like to be consistent with the things
I do, and was in favor of accessing resources using Http requests.

Thanks,
Jeff

On Fri, Sep 7, 2012 at 4:34 AM, Babatunde Akinyanmi <tundeba...@gmail.com>wrote:

> I'm hardly a pro but I think the answer to your question will depend
> on why you want to add django to the stack
>
>
> On 9/7/12, Jeff Regan <jeffrega...@gmail.com> wrote:
> > I'm not much of an architect and am pretty new to Django, so I was
> hoping I
> >
> > could get some advice. Currently our site is html/jQuery and all the data
> > is accessed through Javascript calls to rest services.
> > Data -> Rest Services -> HTML/jQuery
> >
> > I was planning on putting a Django layer between the client and the rest
> > services.
> > Data -> Rest Services -> Django -> HTML/jQuery
> >
> > I'd use jQuery to send post requests to Django urls(routed to views).
>  The
> > views would then call the rest layer to retrieve the data, and pass the
> > response to the front end.
> >
> > Does anyone see a problem with this approach?  Is there anything I should
> > be aware of?  Are there other sites that took a similar approach?
> >
> > I appreciate any help.
> >
> > Thanks,
> > Jeff
> >
> > --
> > You received this message because you are subscribed to the Google Groups
> > "Django users" group.
> > To view this discussion on the web visit
> > https://groups.google.com/d/msg/django-users/-/Cpw8-j0ZqlEJ.
> > To post to this group, send email to django-users@googlegroups.com.
> > To unsubscribe from this group, send email to
> > django-users+unsubscr...@googlegroups.com.
> > For more options, visit this group at
> > http://groups.google.com/group/django-users?hl=en.
> >
> >
>
> --
> Sent from my mobile device
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Multiple elements with one element?

2012-09-06 Thread Jeff Regan
You might look into using jQuery to get the results and then post the
results (also using jQuery) to some url.

This approach doesn't really fit the Django pattern, but it should work.

On Thu, Sep 6, 2012 at 9:53 PM, Gchorn  wrote:

> Hi All,
>
> I'm trying to create a form on a web page where the user can select
> choices from multiple drop-down lists ( HTML elements) and then
> submit them all at once with a single submit button.  Is this possible?
>
> I don't want to use a single  element with the "multiple"
> attribute because the list of options may be quite long, and I find it
> quite clunky for the user to have to hold ctrl/command/shift down while
> clicking on multiple options in such a long list (it's easy to accidentally
> release one of the keys and have to start over, etc.).
>
> I've also used this  for
> something similar in the past, but I want to limit the number of selected
> options to only four at once (which is another reason I also don't want to
> use  with "multiple").
>
> So does anyone know how I could make something like the following work,
> both in terms of HTML and views.py (and without JS)?
>
> 
>   
> one
> two
> buckle
> shoe
>   
>   
> three
> four
> shut
> door
>   
>   
> 
>
> I'm guessing that in views.py it would be something like
> request.GET.getlist('q'), but as far as I know you're supposed to give each
>  element a different name, right?
>
> thanks,
> Guillaume
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/django-users/-/dcFM0INbXCAJ.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Site Architecture

2012-09-06 Thread Jeff Regan
I'm not much of an architect and am pretty new to Django, so I was hoping I 
could get some advice. Currently our site is html/jQuery and all the data 
is accessed through Javascript calls to rest services.  
Data -> Rest Services -> HTML/jQuery

I was planning on putting a Django layer between the client and the rest 
services.  
Data -> Rest Services -> Django -> HTML/jQuery

I'd use jQuery to send post requests to Django urls(routed to views).  The 
views would then call the rest layer to retrieve the data, and pass the 
response to the front end.

Does anyone see a problem with this approach?  Is there anything I should 
be aware of?  Are there other sites that took a similar approach? 

I appreciate any help.

Thanks,
Jeff

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/Cpw8-j0ZqlEJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Django Friendly URLs

2012-08-26 Thread Jeff Tchang
Hey all. I've created a Django application that allows you to create
friendly/vanity urls:
https://github.com/tachang/django_friendlyurls

There is still a lot to be desired but it gets the basic job done. It works
by implementing a catch all URL string and then trying to figure out which
view to return.

-Jeff

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Layout and global.css files

2012-08-22 Thread Jeff Tchang
I see some stuff under:

/python/lib/python2.6/site-packages/django/contrib/admin/static/admin/css


On Wed, Aug 22, 2012 at 6:41 PM, Gregory Strydom <
gregory.strydom...@gmail.com> wrote:

> Could anyone perhaps tell me where i could find the layout.css and
> global.css for the base admin site?
>
> Ive tried looking through C:/Python26/site-packages/django but cant seem
> to find anything. What i am trying to do is just change colour where it say
> Users, Groups, Sites etc in the django admin. I managed to change the
> header colors so far but was told i need to edit layout and global.css to
> change the other colors.
>
> Thanks very much for any help with this!
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/django-users/-/N9aDIJzmHngJ.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: View loaded twice / Database entry saved twice

2012-08-22 Thread Jeff Tchang
Is it possible you are testing using a browser and it is doing a request
for the page and for favicon.ico? That would end up being 2 requests. You
can use something like Chrome Developer Tools or Firebug to see.

-Jeff

On Tue, Aug 21, 2012 at 4:07 PM, James Verran <ja...@verran.ca> wrote:

> Hi there, I'm trying to capture all url path data. (Except admin, and a
> couple other paths.)
>
> At the end of my urls.py file, I'm using r'^(.*)$'... On my associated
> view, I make a simple entry into a database - ie:
> Test(path=capturedpath).save()
>
> The problem: my database entry is saved twice! Or rather, my view is being
> loaded twice. I added a global variable to check- if not
> globals()['already_saved']: Test(path=capturedpath).save()
>
> If I adjust the path: r'^test/(.*)$'  all works as expected (here my url
> would be 
> 'mysite.com/test/url/data/to/capture'<http://mysite.com/test/url/data/to/capture%27>
> .)
>
> I'm using django 1.4. Any help/thoughts/suggestions would be much
> appreciated.
>
> Thanks!
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: join models on Timestamp field without foreign keys

2012-08-15 Thread Jeff Dickens


On Tuesday, August 14, 2012 1:43:18 PM UTC-4, Dennis Lee Bieber wrote:
>
> On Mon, 13 Aug 2012 21:58:59 -0700 (PDT), Jeff Dickens 
> <drea...@gmail.com > declaimed the following in 
> gmane.comp.python.django.user: 
>
> > Hi all.  I have a number of models, each of which is based on an 
> abstract 
> > class that includes a Timestamp field.  The model definitions look like 
> > this: 
> > 
> > class Md_model(models.Model): 
> > Timestamp = 
> > models.DateTimeField(auto_now_add=True,unique=True,db_index=True) 
> > def __unicode__(self): 
> > return self.Timestamp.strftime('%Y %m %d %H:%M') 
> > def as_dict(self): 
> > return(model_to_dict(self)) 
> > class Meta: 
> > abstract = True 
> > 
> > class md_10_1(Md_model): 
> > name='md_10_1' 
> > dataSource = 'http://192.168.0.10/auto/001' 
> > n1 = models.DecimalField(max_digits=10,decimal_places=3) 
> > n2 = models.DecimalField(max_digits=10,decimal_places=3) 
> > n3 = models.DecimalField(max_digits=10,decimal_places=3) 
> > 
> > class md_10_2(Md_model): 
> > name='md_10_2' 
> > dataSource = 'http://192.168.0.10/auto/002' 
> > n4 = models.DecimalField(max_digits=10,decimal_places=3) 
> > n5 = models.DecimalField(max_digits=10,decimal_places=3) 
> > 
> This example makes me think the design is faulty... Especially if 
> you mean you have more tables than just the two... 
>

It's not.  Read on... 

>
> Though I think better in SQL -- are "name" and "dataSource" items 
> that would be stored in the database? Right now, all they seem to do is 
> duplicate information as to which "model" the record represents. 
>

No, they are not items that are stored in the database.  They exist because 
the script that populates the table (every minute) is generalized to handle 
an unlimited number of data models. It uses introspection for everything - 
as DRY as it can possibly be.  Otherwise it would very quickly become 
unmanageable.

>
> Given just your example I'd probably have created just one table 
> containing all of n1..n5, with option to permit Null values, and coded 
> to do INSERT if the timestamp didn't exist, and UPDATE if the timestamp 
> was already in the table. 
>
> There are now 8 data models and I have to be able to add more over time 
without having to reprocess the (voluminous) data that has been logged into 
the existing models.
 

> If you do mean you have half a dozen or more all similar I'd try 
> to 
> isolate back to the form that would support the most... If all the data 
> fields are identical (all 10.3 decimal) say... (Again, I'm going to use 
> pseudo SQL) 
>
> create table Sources 
> ( 
> IDinteger auto increment primary key, 
> timestampdatetime, 
> sourcechar(80),#whatever length you need 
> modelchar(20)#ditto 
> ); 
>
> create table Fields 
> ( 
> ID integer auto increment primary key, 
> sourceID integer foreign key Source (ID), 
> fieldID integer, 
> fieldValuedecimal 
> ) 
>
> These wouldn't fit as regular Django form without a lot of 
> logic... 
> Instead of /n/ tables looking like 
>
> timestampn1n2n3 ... 
>
> you'd have 
>
> 1timestamphttp://... 
> 2timestamphttp://... 
>
> and 
>
> 111value 
> 212value 
> 313value 
> 421value 
> 522value 
> ... 
>
> This schema allows for any number of identical datatype values per 
> "record", but putting them /into/ record order requires looping over the 
> result set. 
>
>
>
> > 
> > What I want to do is join them all (actually some programatically 
> defined 
> > subset of them) into a single query set or some other data structure 
> that I 
> > can pass into the template.  This set would have only one Timestamp 
> field, 
> > and all of the other fields from all of the other models that are to be 
> > joined.  She thre result would have Timestamp, n1, n2, n3, n4, n5 in the 
> > example above, 
>
> INNER, LEFT OUTER, or RIGHT OUTER; if you needed both OUTER 
> conditions in one result set you'd have to run a UNION wrapped by a 
> SELECT DISTINCT 
>
> Raw SQL might look like 
>
> select distinct * from 
> (select md_10_1.timestamp as tstamp, n1, ..., n5 from md_10_1 
>   

join models on Timestamp field without foreign keys

2012-08-14 Thread Jeff Dickens
Hi all.  I have a number of models, each of which is based on an abstract 
class that includes a Timestamp field.  The model definitions look like 
this:

class Md_model(models.Model):
Timestamp = 
models.DateTimeField(auto_now_add=True,unique=True,db_index=True)
def __unicode__(self):
return self.Timestamp.strftime('%Y %m %d %H:%M')
def as_dict(self):
return(model_to_dict(self))
class Meta:
abstract = True

class md_10_1(Md_model):
name='md_10_1'
dataSource = 'http://192.168.0.10/auto/001'
n1 = models.DecimalField(max_digits=10,decimal_places=3)
n2 = models.DecimalField(max_digits=10,decimal_places=3)
n3 = models.DecimalField(max_digits=10,decimal_places=3)

class md_10_2(Md_model):
name='md_10_2'
dataSource = 'http://192.168.0.10/auto/002'
n4 = models.DecimalField(max_digits=10,decimal_places=3)
n5 = models.DecimalField(max_digits=10,decimal_places=3)


What I want to do is join them all (actually some programatically defined 
subset of them) into a single query set or some other data structure that I 
can pass into the template.  This set would have only one Timestamp field, 
and all of the other fields from all of the other models that are to be 
joined.  She thre result would have Timestamp, n1, n2, n3, n4, n5 in the 
example above,

Using a foreign key does't make sense to me since I can't predict that any 
particular model will be in every query.

I think that what I need to do is iterate in parallel over three or more 
iterables and merge them, but I don't know how.


-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/jdJnB7mUODMJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Django-registration tutorial + code

2012-07-09 Thread Jeff Silverman
I'm new as well, but I have run into similar issues when I don't have the
environment settings assigned properly.

On Mon, Jul 9, 2012 at 12:03 AM, scoop  wrote:

> i installed registration, added registration to installed apps and used
> your
> templates.
>
> i nav to accounts/register , enter the info and as i continue it breaks
> with
> the following:
>
> DoesNotExist at /accounts/register/
> Site matching query does not exist.
> Request Method: POST
> Request URL:http://spenv.local/accounts/register/
> Django Version: 1.4
> Exception Type: DoesNotExist
> Exception Value:
> Site matching query does not exist.
> Exception Location:
> /usr/lib/python2.7/site-packages/django/db/models/query.py in get, line 366
>
> I'm pretty new to django so I'm slightly confused. I looked at the
> documentation and there doesn't seem to be anything that I understand to
> fix
> this.
>
> --
> View this message in context:
> http://python.6.n6.nabble.com/Django-registration-tutorial-code-tp4974793p4981365.html
> Sent from the django-users mailing list archive at Nabble.com.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Still need help with the 405....please

2012-07-06 Thread Jeff Silverman
Nik I was trying to figure out how to make web services on such a way that
I could import the wsdl into an info path form eventually pulling data from
f5 ltm devices.  Sort of ambitious I think but djamgo is supposed to be
easy.

Not.

On Friday, July 6, 2012, Nikolas Stevenson-Molnar wrote:

> Out of curiosity, what is your end-goal with this?
>
> _Nik
>
> On 7/6/2012 12:44 PM, Jeff Silverman wrote:
> > Nik, I appreciate your help, but I'm about at the end with this.  I'm
> > throwing in the towel.
> >
> > On Jul 6, 1:40 pm, Nikolas Stevenson-Molnar <nik.mol...@consbio.org>
> > wrote:
> >> I'm not exactly sure, I usually try to avoid SOAP. But perhaps something
> >> like this?http://www.w3schools.com/soap/soap_example.asp. You'll have
> >> to modify it to match your SOAP app, of course.
> >>
> >> Depending on what you're trying to accomplish, SOAP may not be your best
> >> option. I tend to prefer REST, and there are some good Django-compatible
> >> libraries for implementing REST interfaces:
> http://django-rest-framework.org/(for example; there are others as well)
> >>
> >> _Nik
> >>
> >> On 7/6/2012 10:32 AM, Jeff Silverman wrote:
> >>
> >>
> >>
> >>> What should the XML look like?
> >>> On Jul 6, 12:03 pm, Nikolas Stevenson-Molnar <nik.mol...@consbio.org>
> >>> wrote:
> >>>> Perhaps it's expecting XML in the request and trying to parse your
> POST data (which is not XML)?
> >>>> _Nik
> >>>> On Jul 6, 2012, at 6:03 AM, Jeff Silverman wrote:
> >>>>> Ok Nik.  I have removed the CSRF middleware and get a brand new
> error.
> >>>>> XMLSyntaxError at /hello/
> >>>>> error parsing attribute name, line 1, column 6Request Method: POST
> >>>>> Request URL:http://piadm42.troweprice.com:/hello/
> >>>>> Django Version: 1.3.1
> >>>>> Exception Type: XMLSyntaxError
> >>>>> Exception Value: error parsing attribute name, line 1, column 6
> >>>>> Exception Location: /usr/lib/python2.6/site-packages/
> >>>>> soaplib-2.0.0_beta1-py2.6.egg/soaplib/core/_base.py in
> >>>>> _parse_xml_string, line 248
> >>>>> Python Executable: /usr/bin/python
> >>>>> Python Version: 2.6.6
> >>>>> The POST in fiddler is something like this ->
> http://mysite.com:/hello/
> >>>>> and the request body contains -> 

Re: Still need help with the 405....please

2012-07-06 Thread Jeff Silverman
Nik, I appreciate your help, but I'm about at the end with this.  I'm
throwing in the towel.

On Jul 6, 1:40 pm, Nikolas Stevenson-Molnar <nik.mol...@consbio.org>
wrote:
> I'm not exactly sure, I usually try to avoid SOAP. But perhaps something
> like this?http://www.w3schools.com/soap/soap_example.asp. You'll have
> to modify it to match your SOAP app, of course.
>
> Depending on what you're trying to accomplish, SOAP may not be your best
> option. I tend to prefer REST, and there are some good Django-compatible
> libraries for implementing REST 
> interfaces:http://django-rest-framework.org/(for example; there are others as 
> well)
>
> _Nik
>
> On 7/6/2012 10:32 AM, Jeff Silverman wrote:
>
>
>
> > What should the XML look like?
>
> > On Jul 6, 12:03 pm, Nikolas Stevenson-Molnar <nik.mol...@consbio.org>
> > wrote:
> >> Perhaps it's expecting XML in the request and trying to parse your POST 
> >> data (which is not XML)?
>
> >> _Nik
>
> >> On Jul 6, 2012, at 6:03 AM, Jeff Silverman wrote:
>
> >>> Ok Nik.  I have removed the CSRF middleware and get a brand new error.
> >>> XMLSyntaxError at /hello/
> >>> error parsing attribute name, line 1, column 6Request Method: POST
> >>> Request URL:http://piadm42.troweprice.com:/hello/
> >>> Django Version: 1.3.1
> >>> Exception Type: XMLSyntaxError
> >>> Exception Value: error parsing attribute name, line 1, column 6
> >>> Exception Location: /usr/lib/python2.6/site-packages/
> >>> soaplib-2.0.0_beta1-py2.6.egg/soaplib/core/_base.py in
> >>> _parse_xml_string, line 248
> >>> Python Executable: /usr/bin/python
> >>> Python Version: 2.6.6
> >>> The POST in fiddler is something like this ->  
> >>> http://mysite.com:/hello/
> >>> and the request body contains -> 

Re: Still need help with the 405....please

2012-07-06 Thread Jeff Silverman
What should the XML look like?

On Jul 6, 12:03 pm, Nikolas Stevenson-Molnar <nik.mol...@consbio.org>
wrote:
> Perhaps it's expecting XML in the request and trying to parse your POST data 
> (which is not XML)?
>
> _Nik
>
> On Jul 6, 2012, at 6:03 AM, Jeff Silverman wrote:
>
>
>
> > Ok Nik.  I have removed the CSRF middleware and get a brand new error.
>
> > XMLSyntaxError at /hello/
> > error parsing attribute name, line 1, column 6Request Method: POST
> > Request URL:http://piadm42.troweprice.com:/hello/
> > Django Version: 1.3.1
> > Exception Type: XMLSyntaxError
> > Exception Value: error parsing attribute name, line 1, column 6
> > Exception Location: /usr/lib/python2.6/site-packages/
> > soaplib-2.0.0_beta1-py2.6.egg/soaplib/core/_base.py in
> > _parse_xml_string, line 248
> > Python Executable: /usr/bin/python
> > Python Version: 2.6.6
>
> > The POST in fiddler is something like this ->  http://mysite.com:/hello/
> > and the request body contains -> 

Re: Still need help with the 405....please

2012-07-06 Thread Jeff Silverman
Ok Nik.  I have removed the CSRF middleware and get a brand new error.

XMLSyntaxError at /hello/
error parsing attribute name, line 1, column 6Request Method: POST
Request URL: http://piadm42.troweprice.com:/hello/
Django Version: 1.3.1
Exception Type: XMLSyntaxError
Exception Value: error parsing attribute name, line 1, column 6
Exception Location: /usr/lib/python2.6/site-packages/
soaplib-2.0.0_beta1-py2.6.egg/soaplib/core/_base.py in
_parse_xml_string, line 248
Python Executable: /usr/bin/python
Python Version: 2.6.6

The POST in fiddler is something like this ->  http://mysite.com:/hello/
 and the request body contains -> 

Re: Still need help with the 405....please

2012-07-05 Thread Jeff Silverman
Nik, if I remove the csrf decorator and leave the middleware in place, I 
get the 403.  Is there a way to add the token on the POST command, or is 
there another way of leaving the middleware in place, but turn off csrf 
without using the decorator?

On Thursday, July 5, 2012 8:33:51 PM UTC-4, Jeff Silverman wrote:
>
> Nik, I will give that a try.  The reason for the decorator was that I was 
> getting 403 forbidden, and the decorator made that one go away.  If I 
> remove the csrf from the settings file, will that solve that problem?
>
>
> On Tuesday, July 3, 2012 9:32:20 AM UTC-4, Jeff Silverman wrote:
>>
>> Below is the code from the views.py 
>>
>> The 405 is retunred from the 'return super(DjangoSoapApp, 
>> self).__init__(Application(services, tns))' statement.  I am using 
>> python 2.6, soaplib20 and django 1.3.  I am struggling to understand 
>> what exactly is wrong here. 
>>
>>
>>
>> class HelloWorldService(DefinitionBase): 
>> @soap(String,Integer,_returns=Array(String)) 
>> def say_smello(self,name,times): 
>> results = [] 
>> for i in range(0,times): 
>> results.append('Hello, %s'%name) 
>> return results 
>>
>> class DjangoSoapApp(WSGIApplication): 
>> csrf_exempt = True 
>>
>> def __init__(self, services, tns): 
>> """Create Django view for given SOAP soaplib services and 
>> tns""" 
>>
>> return super(DjangoSoapApp, 
>> self).__init__(Application(services, tns)) 
>>
>> def __call__(self, request): 
>> django_response = HttpResponse() 
>>
>> def start_response(status, headers): 
>> django_response.status_code = int(status.split(' ', 1)[0]) 
>> for header, value in headers: 
>> django_response[header] = value 
>>
>> response = super(DjangoSoapApp, self).__call__(request.META, 
>> start_response) 
>> django_response.content = '\n'.join(response) 
>>
>> return django_response 
>>
>> # the view to use in urls.py 
>> hello_world_service = DjangoSoapApp([HelloWorldService], '__name__') 
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/WpDQ4UjGEQwJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Still need help with the 405....please

2012-07-05 Thread Jeff Silverman
Nik, I will give that a try.  The reason for the decorator was that I was 
getting 403 forbidden, and the decorator made that one go away.  If I 
remove the csrf from the settings file, will that solve that problem?


On Tuesday, July 3, 2012 9:32:20 AM UTC-4, Jeff Silverman wrote:
>
> Below is the code from the views.py 
>
> The 405 is retunred from the 'return super(DjangoSoapApp, 
> self).__init__(Application(services, tns))' statement.  I am using 
> python 2.6, soaplib20 and django 1.3.  I am struggling to understand 
> what exactly is wrong here. 
>
>
>
> class HelloWorldService(DefinitionBase): 
> @soap(String,Integer,_returns=Array(String)) 
> def say_smello(self,name,times): 
> results = [] 
> for i in range(0,times): 
> results.append('Hello, %s'%name) 
> return results 
>
> class DjangoSoapApp(WSGIApplication): 
> csrf_exempt = True 
>
> def __init__(self, services, tns): 
> """Create Django view for given SOAP soaplib services and 
> tns""" 
>
> return super(DjangoSoapApp, 
> self).__init__(Application(services, tns)) 
>
> def __call__(self, request): 
> django_response = HttpResponse() 
>
> def start_response(status, headers): 
> django_response.status_code = int(status.split(' ', 1)[0]) 
> for header, value in headers: 
> django_response[header] = value 
>
> response = super(DjangoSoapApp, self).__call__(request.META, 
> start_response) 
> django_response.content = '\n'.join(response) 
>
> return django_response 
>
> # the view to use in urls.py 
> hello_world_service = DjangoSoapApp([HelloWorldService], '__name__') 
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/Li-smv_nBIgJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Still need help with the 405....please

2012-07-05 Thread Jeff Silverman
# soaplib v2.0.0beta2 (from memory)
# Django v1.3 (stable)
# NOTE: CSRF middleware has been turned off!
# For urls.py, see: https://gist.github.com/935812

import soaplib
from soaplib.core.service import rpc, DefinitionBase
from soaplib.core.model.primitive import String, Integer
from soaplib.core.model.clazz import Array

from django.views.decorators.csrf import csrf_exempt


class HelloWorldService(DefinitionBase):
@rpc(String,Integer,_returns=Array(String))
def say_hello(self, name, times):
results = []
for i in range(0, times):
results.append('Hellow, %s' %name)
return results


from soaplib.core.server.wsgi import Application
from django.http import HttpResponse

import StringIO
class DumbStringIO(StringIO.StringIO):
def read(self, n):
return self.getvalue()

@csrf_exempt
class DjangoSoapApp(Application):
def __call__(self, request):
django_response = HttpResponse()

def start_response(status, headers):
status, reason = status.split(' ', 1)
django_response.status_code = int(status)
for header, value in headers:
django_response[header] = value

environ = request.META.copy()
environ['CONTENT_LENGTH'] = len(request.raw_post_data)
environ['wsgi.input'] = DumbStringIO(request.raw_post_data)
environ['wsgi.multithread'] = False

#print help(DjangoSoapApp)

response = super(DjangoSoapApp, self).__call__(environ,
start_response)
django_response.content = '\n'.join(response)
return django_response


print type(DjangoSoapApp)
soap_application = soaplib.core.Application([HelloWorldService],
'tns')
#import pdb; pdb.set_trace()
hello_world_service = DjangoSoapApp(soap_application)


On Jul 5, 2:54 pm, Nikolas Stevenson-Molnar <nik.mol...@consbio.org>
wrote:
> Would you please provide the source for mysite.BDSCheckUser.views?
>
> _Nik
>
> On 7/5/2012 11:37 AM, Jeff Silverman wrote:
>
>
>
> > Resulting output,
>
> > Help on function DjangoSoapApp in module mysite.BDSCheckUser.views:
>
> > DjangoSoapApp(*args, **kwargs)
>
> > On Jul 5, 2:31 pm, Nikolas Stevenson-Molnar <nik.mol...@consbio.org>
> > wrote:
> >> Hmmm, I can't think of what may be happening. One more debug thing to
> >> try, print the help of DjangoSoapApp just before the problem line:
>
> >> print help(DjangoSoapApp)
>
> >> That way, if the DjangoSoapApp symbol is getting reassigned to a
> >> function somewhere along the way, that might clue you in.
>
> >> _Nik
>
> >> On 7/5/2012 11:17 AM, Jeff Silverman wrote:
>
> >>> I've been flip flopping my views.py between that snippet, and
> >>>https://gist.github.com/935809, which is a bit different, but easier
> >>> to follow.
> >>> On Jul 5, 2:03 pm, Nikolas Stevenson-Molnar <nik.mol...@consbio.org>
> >>> wrote:
> >>>> Is your code still the same as you posted 
> >>>> earlier:http://djangosnippets.org/snippets/2638/?Andtheerror is occuring 
> >>>> on
> >>>> ln 28?
> >>>> _Nik
> >>>> On 7/5/2012 11:01 AM, Jeff Silverman wrote:
> >>>>> The print output is:
> >>>>> 
> >>>>> On Jul 5, 1:38 pm, Nikolas Stevenson-Molnar <nik.mol...@consbio.org>
> >>>>> wrote:
> >>>>>> Hmmm, not sure about this one. Try printing out the type of
> >>>>>> DjangoSoapApp before that line is called:
> >>>>>> print type(DjangoSoapApp)
> >>>>>> _Nik
> >>>>>> On 7/5/2012 5:20 AM, Jeff Silverman wrote:
> >>>>>>> Ok, I'm further along, I think.  Now I'm getting the following
> >>>>>>> response = super(DjangoSoapApp, self).__call__(environ,
> >>>>>>> start_response)
> >>>>>>> (Pdb) p start_response
> >>>>>>> 
> >>>>>>> (Pdb)  super(DjangoSoapApp, self).__call__(environ, start_response)
> >>>>>>> *** TypeError: super() argument 1 must be type, not function
> >>>>>>> On Jul 3, 3:47 pm, Nikolas Stevenson-Molnar <nik.mol...@consbio.org>
> >>>>>>> wrote:
> >>>>>>>> Looking at the soaplib source, it looks like it required requests to 
> >>>>>>>> be
> >>>>>>>> made using POST. If you're loading this in a web browser to test, 
> >>>>>>>> then
> >>>>>>>> you're making a GET request. Try making a POST request (using 
> >>>>>>>> something
> >

Re: Still need help with the 405....please

2012-07-05 Thread Jeff Silverman
Resulting output,

Help on function DjangoSoapApp in module mysite.BDSCheckUser.views:

DjangoSoapApp(*args, **kwargs)


On Jul 5, 2:31 pm, Nikolas Stevenson-Molnar <nik.mol...@consbio.org>
wrote:
> Hmmm, I can't think of what may be happening. One more debug thing to
> try, print the help of DjangoSoapApp just before the problem line:
>
> print help(DjangoSoapApp)
>
> That way, if the DjangoSoapApp symbol is getting reassigned to a
> function somewhere along the way, that might clue you in.
>
> _Nik
>
> On 7/5/2012 11:17 AM, Jeff Silverman wrote:
>
>
>
> > I've been flip flopping my views.py between that snippet, and
> >https://gist.github.com/935809, which is a bit different, but easier
> > to follow.
>
> > On Jul 5, 2:03 pm, Nikolas Stevenson-Molnar <nik.mol...@consbio.org>
> > wrote:
> >> Is your code still the same as you posted 
> >> earlier:http://djangosnippets.org/snippets/2638/?Andthe error is occuring 
> >> on
> >> ln 28?
>
> >> _Nik
>
> >> On 7/5/2012 11:01 AM, Jeff Silverman wrote:
>
> >>> The print output is:
> >>> 
> >>> On Jul 5, 1:38 pm, Nikolas Stevenson-Molnar <nik.mol...@consbio.org>
> >>> wrote:
> >>>> Hmmm, not sure about this one. Try printing out the type of
> >>>> DjangoSoapApp before that line is called:
> >>>> print type(DjangoSoapApp)
> >>>> _Nik
> >>>> On 7/5/2012 5:20 AM, Jeff Silverman wrote:
> >>>>> Ok, I'm further along, I think.  Now I'm getting the following
> >>>>> response = super(DjangoSoapApp, self).__call__(environ,
> >>>>> start_response)
> >>>>> (Pdb) p start_response
> >>>>> 
> >>>>> (Pdb)  super(DjangoSoapApp, self).__call__(environ, start_response)
> >>>>> *** TypeError: super() argument 1 must be type, not function
> >>>>> On Jul 3, 3:47 pm, Nikolas Stevenson-Molnar <nik.mol...@consbio.org>
> >>>>> wrote:
> >>>>>> Looking at the soaplib source, it looks like it required requests to be
> >>>>>> made using POST. If you're loading this in a web browser to test, then
> >>>>>> you're making a GET request. Try making a POST request (using something
> >>>>>> like Fiddler) instead.
> >>>>>>https://github.com/soaplib/soaplib/blob/master/src/soaplib/core/serve...
> >>>>>> (line 84/85)
> >>>>>> _Nik
> >>>>>> On 7/3/2012 12:20 PM, Jeff Silverman wrote:
> >>>>>>>http://djangosnippets.org/snippets/2638/
> >>>>>>> On Jul 3, 2:56 pm, Nikolas Stevenson-Molnar <nik.mol...@consbio.org>
> >>>>>>> wrote:
> >>>>>>>> Would you please provide a reference to the snippet or to your 
> >>>>>>>> complete
> >>>>>>>> code? It's hard to understand what's going on from this small bit.
> >>>>>>>> _Nik
> >>>>>>>> On 7/3/2012 11:33 AM, Jeff Silverman wrote:
> >>>>>>>>> Thanks for the reply.  Removing that did not change the result.  
> >>>>>>>>> Just
> >>>>>>>>> an FYI, but I copied the code verbatim from the snippet.  that's 
> >>>>>>>>> why I
> >>>>>>>>> cannot understand what's going on.  I continually get the405method
> >>>>>>>>> not allowed error regardless.
> >>>>>>>>> On Jul 3, 1:28 pm, Nikolas Stevenson-Molnar <nik.mol...@consbio.org>
> >>>>>>>>> wrote:
> >>>>>>>>>> I'm not sure that this is the problem, but typically constructors 
> >>>>>>>>>> should
> >>>>>>>>>> not have a return value. Try removing the "return" from your
> >>>>>>>>>> DjangoSoapApp constructor.
> >>>>>>>>>> _Nik
> >>>>>>>>>> On 7/3/2012 6:32 AM, Jeff Silverman wrote:
> >>>>>>>>>>> Below is the code from the views.py
> >>>>>>>>>>> The405is retunred from the 'return super(DjangoSoapApp,
> >>>>>>>>>>> self).__init__(Application(services, tns))' statement.  I am using
> >>>>>>>>>>> python 2.6, soaplib20 and django 1.3.  I 

Re: Still need help with the 405....please

2012-07-05 Thread Jeff Silverman
I've been flip flopping my views.py between that snippet, and
https://gist.github.com/935809, which is a bit different, but easier
to follow.

On Jul 5, 2:03 pm, Nikolas Stevenson-Molnar <nik.mol...@consbio.org>
wrote:
> Is your code still the same as you posted 
> earlier:http://djangosnippets.org/snippets/2638/?And the error is occuring on
> ln 28?
>
> _Nik
>
> On 7/5/2012 11:01 AM, Jeff Silverman wrote:
>
>
>
> > The print output is:
>
> > 
>
> > On Jul 5, 1:38 pm, Nikolas Stevenson-Molnar <nik.mol...@consbio.org>
> > wrote:
> >> Hmmm, not sure about this one. Try printing out the type of
> >> DjangoSoapApp before that line is called:
>
> >> print type(DjangoSoapApp)
>
> >> _Nik
>
> >> On 7/5/2012 5:20 AM, Jeff Silverman wrote:
>
> >>> Ok, I'm further along, I think.  Now I'm getting the following
> >>> response = super(DjangoSoapApp, self).__call__(environ,
> >>> start_response)
> >>> (Pdb) p start_response
> >>> 
> >>> (Pdb)  super(DjangoSoapApp, self).__call__(environ, start_response)
> >>> *** TypeError: super() argument 1 must be type, not function
> >>> On Jul 3, 3:47 pm, Nikolas Stevenson-Molnar <nik.mol...@consbio.org>
> >>> wrote:
> >>>> Looking at the soaplib source, it looks like it required requests to be
> >>>> made using POST. If you're loading this in a web browser to test, then
> >>>> you're making a GET request. Try making a POST request (using something
> >>>> like Fiddler) instead.
> >>>>https://github.com/soaplib/soaplib/blob/master/src/soaplib/core/serve...
> >>>> (line 84/85)
> >>>> _Nik
> >>>> On 7/3/2012 12:20 PM, Jeff Silverman wrote:
> >>>>>http://djangosnippets.org/snippets/2638/
> >>>>> On Jul 3, 2:56 pm, Nikolas Stevenson-Molnar <nik.mol...@consbio.org>
> >>>>> wrote:
> >>>>>> Would you please provide a reference to the snippet or to your complete
> >>>>>> code? It's hard to understand what's going on from this small bit.
> >>>>>> _Nik
> >>>>>> On 7/3/2012 11:33 AM, Jeff Silverman wrote:
> >>>>>>> Thanks for the reply.  Removing that did not change the result.  Just
> >>>>>>> an FYI, but I copied the code verbatim from the snippet.  that's why I
> >>>>>>> cannot understand what's going on.  I continually get the405method
> >>>>>>> not allowed error regardless.
> >>>>>>> On Jul 3, 1:28 pm, Nikolas Stevenson-Molnar <nik.mol...@consbio.org>
> >>>>>>> wrote:
> >>>>>>>> I'm not sure that this is the problem, but typically constructors 
> >>>>>>>> should
> >>>>>>>> not have a return value. Try removing the "return" from your
> >>>>>>>> DjangoSoapApp constructor.
> >>>>>>>> _Nik
> >>>>>>>> On 7/3/2012 6:32 AM, Jeff Silverman wrote:
> >>>>>>>>> Below is the code from the views.py
> >>>>>>>>> The405is retunred from the 'return super(DjangoSoapApp,
> >>>>>>>>> self).__init__(Application(services, tns))' statement.  I am using
> >>>>>>>>> python 2.6, soaplib20 and django 1.3.  I am struggling to understand
> >>>>>>>>> what exactly is wrong here.
> >>>>>>>>> class HelloWorldService(DefinitionBase):
> >>>>>>>>>     @soap(String,Integer,_returns=Array(String))
> >>>>>>>>>     def say_smello(self,name,times):
> >>>>>>>>>         results = []
> >>>>>>>>>         for i in range(0,times):
> >>>>>>>>>             results.append('Hello, %s'%name)
> >>>>>>>>>         return results
> >>>>>>>>> class DjangoSoapApp(WSGIApplication):
> >>>>>>>>>     csrf_exempt = True
> >>>>>>>>>     def __init__(self, services, tns):
> >>>>>>>>>         """Create Django view for given SOAP soaplib services and
> >>>>>>>>> tns"""
> >>>>>>>>>         return super(DjangoSoapApp,
> >>>>>>>>> self).__init__(Application(services, tns))
> >>>>>>>>>     def __call__(self, request):
> >>>>>>>>>         django_response = HttpResponse()
> >>>>>>>>>         def start_response(status, headers):
> >>>>>>>>>             django_response.status_code = int(status.split(' ', 
> >>>>>>>>> 1)[0])
> >>>>>>>>>             for header, value in headers:
> >>>>>>>>>                 django_response[header] = value
> >>>>>>>>>         response = super(DjangoSoapApp, self).__call__(request.META,
> >>>>>>>>> start_response)
> >>>>>>>>>         django_response.content = '\n'.join(response)
> >>>>>>>>>         return django_response
> >>>>>>>>> # the view to use in urls.py
> >>>>>>>>> hello_world_service = DjangoSoapApp([HelloWorldService], 
> >>>>>>>>> '__name__')- Hide quoted text -
> >>>>>>>> - Show quoted text -- Hide quoted text -
> >>>>>> - Show quoted text -- Hide quoted text -
> >>>> - Show quoted text -- Hide quoted text -
> >> - Show quoted text -- Hide quoted text -
>
> - Show quoted text -

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Still need help with the 405....please

2012-07-05 Thread Jeff Silverman
The print output is:




On Jul 5, 1:38 pm, Nikolas Stevenson-Molnar <nik.mol...@consbio.org>
wrote:
> Hmmm, not sure about this one. Try printing out the type of
> DjangoSoapApp before that line is called:
>
> print type(DjangoSoapApp)
>
> _Nik
>
> On 7/5/2012 5:20 AM, Jeff Silverman wrote:
>
>
>
> > Ok, I'm further along, I think.  Now I'm getting the following
>
> > response = super(DjangoSoapApp, self).__call__(environ,
> > start_response)
> > (Pdb) p start_response
> > 
>
> > (Pdb)  super(DjangoSoapApp, self).__call__(environ, start_response)
> > *** TypeError: super() argument 1 must be type, not function
>
> > On Jul 3, 3:47 pm, Nikolas Stevenson-Molnar <nik.mol...@consbio.org>
> > wrote:
> >> Looking at the soaplib source, it looks like it required requests to be
> >> made using POST. If you're loading this in a web browser to test, then
> >> you're making a GET request. Try making a POST request (using something
> >> like Fiddler) instead.
>
> >>https://github.com/soaplib/soaplib/blob/master/src/soaplib/core/serve...
> >> (line 84/85)
>
> >> _Nik
>
> >> On 7/3/2012 12:20 PM, Jeff Silverman wrote:
>
> >>>http://djangosnippets.org/snippets/2638/
> >>> On Jul 3, 2:56 pm, Nikolas Stevenson-Molnar <nik.mol...@consbio.org>
> >>> wrote:
> >>>> Would you please provide a reference to the snippet or to your complete
> >>>> code? It's hard to understand what's going on from this small bit.
> >>>> _Nik
> >>>> On 7/3/2012 11:33 AM, Jeff Silverman wrote:
> >>>>> Thanks for the reply.  Removing that did not change the result.  Just
> >>>>> an FYI, but I copied the code verbatim from the snippet.  that's why I
> >>>>> cannot understand what's going on.  I continually get the405method
> >>>>> not allowed error regardless.
> >>>>> On Jul 3, 1:28 pm, Nikolas Stevenson-Molnar <nik.mol...@consbio.org>
> >>>>> wrote:
> >>>>>> I'm not sure that this is the problem, but typically constructors 
> >>>>>> should
> >>>>>> not have a return value. Try removing the "return" from your
> >>>>>> DjangoSoapApp constructor.
> >>>>>> _Nik
> >>>>>> On 7/3/2012 6:32 AM, Jeff Silverman wrote:
> >>>>>>> Below is the code from the views.py
> >>>>>>> The405is retunred from the 'return super(DjangoSoapApp,
> >>>>>>> self).__init__(Application(services, tns))' statement.  I am using
> >>>>>>> python 2.6, soaplib20 and django 1.3.  I am struggling to understand
> >>>>>>> what exactly is wrong here.
> >>>>>>> class HelloWorldService(DefinitionBase):
> >>>>>>>     @soap(String,Integer,_returns=Array(String))
> >>>>>>>     def say_smello(self,name,times):
> >>>>>>>         results = []
> >>>>>>>         for i in range(0,times):
> >>>>>>>             results.append('Hello, %s'%name)
> >>>>>>>         return results
> >>>>>>> class DjangoSoapApp(WSGIApplication):
> >>>>>>>     csrf_exempt = True
> >>>>>>>     def __init__(self, services, tns):
> >>>>>>>         """Create Django view for given SOAP soaplib services and
> >>>>>>> tns"""
> >>>>>>>         return super(DjangoSoapApp,
> >>>>>>> self).__init__(Application(services, tns))
> >>>>>>>     def __call__(self, request):
> >>>>>>>         django_response = HttpResponse()
> >>>>>>>         def start_response(status, headers):
> >>>>>>>             django_response.status_code = int(status.split(' ', 1)[0])
> >>>>>>>             for header, value in headers:
> >>>>>>>                 django_response[header] = value
> >>>>>>>         response = super(DjangoSoapApp, self).__call__(request.META,
> >>>>>>> start_response)
> >>>>>>>         django_response.content = '\n'.join(response)
> >>>>>>>         return django_response
> >>>>>>> # the view to use in urls.py
> >>>>>>> hello_world_service = DjangoSoapApp([HelloWorldService], '__name__')- 
> >>>>>>> Hide quoted text -
> >>>>>> - Show quoted text -- Hide quoted text -
> >>>> - Show quoted text -- Hide quoted text -
> >> - Show quoted text -- Hide quoted text -
>
> - Show quoted text -

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Still need help with the 405....please

2012-07-05 Thread Jeff Silverman
Ok, I'm further along, I think.  Now I'm getting the following

response = super(DjangoSoapApp, self).__call__(environ,
start_response)
(Pdb) p start_response


(Pdb)  super(DjangoSoapApp, self).__call__(environ, start_response)
*** TypeError: super() argument 1 must be type, not function


On Jul 3, 3:47 pm, Nikolas Stevenson-Molnar <nik.mol...@consbio.org>
wrote:
> Looking at the soaplib source, it looks like it required requests to be
> made using POST. If you're loading this in a web browser to test, then
> you're making a GET request. Try making a POST request (using something
> like Fiddler) instead.
>
> https://github.com/soaplib/soaplib/blob/master/src/soaplib/core/serve...
> (line 84/85)
>
> _Nik
>
> On 7/3/2012 12:20 PM, Jeff Silverman wrote:
>
>
>
> >http://djangosnippets.org/snippets/2638/
>
> > On Jul 3, 2:56 pm, Nikolas Stevenson-Molnar <nik.mol...@consbio.org>
> > wrote:
> >> Would you please provide a reference to the snippet or to your complete
> >> code? It's hard to understand what's going on from this small bit.
>
> >> _Nik
>
> >> On 7/3/2012 11:33 AM, Jeff Silverman wrote:
>
> >>> Thanks for the reply.  Removing that did not change the result.  Just
> >>> an FYI, but I copied the code verbatim from the snippet.  that's why I
> >>> cannot understand what's going on.  I continually get the405method
> >>> not allowed error regardless.
> >>> On Jul 3, 1:28 pm, Nikolas Stevenson-Molnar <nik.mol...@consbio.org>
> >>> wrote:
> >>>> I'm not sure that this is the problem, but typically constructors should
> >>>> not have a return value. Try removing the "return" from your
> >>>> DjangoSoapApp constructor.
> >>>> _Nik
> >>>> On 7/3/2012 6:32 AM, Jeff Silverman wrote:
> >>>>> Below is the code from the views.py
> >>>>> The405is retunred from the 'return super(DjangoSoapApp,
> >>>>> self).__init__(Application(services, tns))' statement.  I am using
> >>>>> python 2.6, soaplib20 and django 1.3.  I am struggling to understand
> >>>>> what exactly is wrong here.
> >>>>> class HelloWorldService(DefinitionBase):
> >>>>>     @soap(String,Integer,_returns=Array(String))
> >>>>>     def say_smello(self,name,times):
> >>>>>         results = []
> >>>>>         for i in range(0,times):
> >>>>>             results.append('Hello, %s'%name)
> >>>>>         return results
> >>>>> class DjangoSoapApp(WSGIApplication):
> >>>>>     csrf_exempt = True
> >>>>>     def __init__(self, services, tns):
> >>>>>         """Create Django view for given SOAP soaplib services and
> >>>>> tns"""
> >>>>>         return super(DjangoSoapApp,
> >>>>> self).__init__(Application(services, tns))
> >>>>>     def __call__(self, request):
> >>>>>         django_response = HttpResponse()
> >>>>>         def start_response(status, headers):
> >>>>>             django_response.status_code = int(status.split(' ', 1)[0])
> >>>>>             for header, value in headers:
> >>>>>                 django_response[header] = value
> >>>>>         response = super(DjangoSoapApp, self).__call__(request.META,
> >>>>> start_response)
> >>>>>         django_response.content = '\n'.join(response)
> >>>>>         return django_response
> >>>>> # the view to use in urls.py
> >>>>> hello_world_service = DjangoSoapApp([HelloWorldService], '__name__')- 
> >>>>> Hide quoted text -
> >>>> - Show quoted text -- Hide quoted text -
> >> - Show quoted text -- Hide quoted text -
>
> - Show quoted text -

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Still need help with the 405....please

2012-07-05 Thread Jeff Silverman
Good call.  I used Fiddler to generate the POST string, however, I get
no response.  It appears to go into the @soap(String, Integer,
_returns=Array(string)) statement and hangs at that point, not
returning.

On Jul 3, 3:47 pm, Nikolas Stevenson-Molnar <nik.mol...@consbio.org>
wrote:
> Looking at the soaplib source, it looks like it required requests to be
> made using POST. If you're loading this in a web browser to test, then
> you're making a GET request. Try making a POST request (using something
> like Fiddler) instead.
>
> https://github.com/soaplib/soaplib/blob/master/src/soaplib/core/serve...
> (line 84/85)
>
> _Nik
>
> On 7/3/2012 12:20 PM, Jeff Silverman wrote:
>
>
>
> >http://djangosnippets.org/snippets/2638/
>
> > On Jul 3, 2:56 pm, Nikolas Stevenson-Molnar <nik.mol...@consbio.org>
> > wrote:
> >> Would you please provide a reference to the snippet or to your complete
> >> code? It's hard to understand what's going on from this small bit.
>
> >> _Nik
>
> >> On 7/3/2012 11:33 AM, Jeff Silverman wrote:
>
> >>> Thanks for the reply.  Removing that did not change the result.  Just
> >>> an FYI, but I copied the code verbatim from the snippet.  that's why I
> >>> cannot understand what's going on.  I continually get the405method
> >>> not allowed error regardless.
> >>> On Jul 3, 1:28 pm, Nikolas Stevenson-Molnar <nik.mol...@consbio.org>
> >>> wrote:
> >>>> I'm not sure that this is the problem, but typically constructors should
> >>>> not have a return value. Try removing the "return" from your
> >>>> DjangoSoapApp constructor.
> >>>> _Nik
> >>>> On 7/3/2012 6:32 AM, Jeff Silverman wrote:
> >>>>> Below is the code from the views.py
> >>>>> The405is retunred from the 'return super(DjangoSoapApp,
> >>>>> self).__init__(Application(services, tns))' statement.  I am using
> >>>>> python 2.6, soaplib20 and django 1.3.  I am struggling to understand
> >>>>> what exactly is wrong here.
> >>>>> class HelloWorldService(DefinitionBase):
> >>>>>     @soap(String,Integer,_returns=Array(String))
> >>>>>     def say_smello(self,name,times):
> >>>>>         results = []
> >>>>>         for i in range(0,times):
> >>>>>             results.append('Hello, %s'%name)
> >>>>>         return results
> >>>>> class DjangoSoapApp(WSGIApplication):
> >>>>>     csrf_exempt = True
> >>>>>     def __init__(self, services, tns):
> >>>>>         """Create Django view for given SOAP soaplib services and
> >>>>> tns"""
> >>>>>         return super(DjangoSoapApp,
> >>>>> self).__init__(Application(services, tns))
> >>>>>     def __call__(self, request):
> >>>>>         django_response = HttpResponse()
> >>>>>         def start_response(status, headers):
> >>>>>             django_response.status_code = int(status.split(' ', 1)[0])
> >>>>>             for header, value in headers:
> >>>>>                 django_response[header] = value
> >>>>>         response = super(DjangoSoapApp, self).__call__(request.META,
> >>>>> start_response)
> >>>>>         django_response.content = '\n'.join(response)
> >>>>>         return django_response
> >>>>> # the view to use in urls.py
> >>>>> hello_world_service = DjangoSoapApp([HelloWorldService], '__name__')- 
> >>>>> Hide quoted text -
> >>>> - Show quoted text -- Hide quoted text -
> >> - Show quoted text -- Hide quoted text -
>
> - Show quoted text -

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Still need help with the 405....please

2012-07-03 Thread Jeff Silverman
http://djangosnippets.org/snippets/2638/

On Jul 3, 2:56 pm, Nikolas Stevenson-Molnar <nik.mol...@consbio.org>
wrote:
> Would you please provide a reference to the snippet or to your complete
> code? It's hard to understand what's going on from this small bit.
>
> _Nik
>
> On 7/3/2012 11:33 AM, Jeff Silverman wrote:
>
>
>
> > Thanks for the reply.  Removing that did not change the result.  Just
> > an FYI, but I copied the code verbatim from the snippet.  that's why I
> > cannot understand what's going on.  I continually get the 405 method
> > not allowed error regardless.
>
> > On Jul 3, 1:28 pm, Nikolas Stevenson-Molnar <nik.mol...@consbio.org>
> > wrote:
> >> I'm not sure that this is the problem, but typically constructors should
> >> not have a return value. Try removing the "return" from your
> >> DjangoSoapApp constructor.
>
> >> _Nik
>
> >> On 7/3/2012 6:32 AM, Jeff Silverman wrote:
>
> >>> Below is the code from the views.py
> >>> The 405 is retunred from the 'return super(DjangoSoapApp,
> >>> self).__init__(Application(services, tns))' statement.  I am using
> >>> python 2.6, soaplib20 and django 1.3.  I am struggling to understand
> >>> what exactly is wrong here.
> >>> class HelloWorldService(DefinitionBase):
> >>>     @soap(String,Integer,_returns=Array(String))
> >>>     def say_smello(self,name,times):
> >>>         results = []
> >>>         for i in range(0,times):
> >>>             results.append('Hello, %s'%name)
> >>>         return results
> >>> class DjangoSoapApp(WSGIApplication):
> >>>     csrf_exempt = True
> >>>     def __init__(self, services, tns):
> >>>         """Create Django view for given SOAP soaplib services and
> >>> tns"""
> >>>         return super(DjangoSoapApp,
> >>> self).__init__(Application(services, tns))
> >>>     def __call__(self, request):
> >>>         django_response = HttpResponse()
> >>>         def start_response(status, headers):
> >>>             django_response.status_code = int(status.split(' ', 1)[0])
> >>>             for header, value in headers:
> >>>                 django_response[header] = value
> >>>         response = super(DjangoSoapApp, self).__call__(request.META,
> >>> start_response)
> >>>         django_response.content = '\n'.join(response)
> >>>         return django_response
> >>> # the view to use in urls.py
> >>> hello_world_service = DjangoSoapApp([HelloWorldService], '__name__')- 
> >>> Hide quoted text -
> >> - Show quoted text -- Hide quoted text -
>
> - Show quoted text -

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Still need help with the 405....please

2012-07-03 Thread Jeff Silverman
Thanks for the reply.  Removing that did not change the result.  Just
an FYI, but I copied the code verbatim from the snippet.  that's why I
cannot understand what's going on.  I continually get the 405 method
not allowed error regardless.

On Jul 3, 1:28 pm, Nikolas Stevenson-Molnar <nik.mol...@consbio.org>
wrote:
> I'm not sure that this is the problem, but typically constructors should
> not have a return value. Try removing the "return" from your
> DjangoSoapApp constructor.
>
> _Nik
>
> On 7/3/2012 6:32 AM, Jeff Silverman wrote:
>
>
>
> > Below is the code from the views.py
>
> > The 405 is retunred from the 'return super(DjangoSoapApp,
> > self).__init__(Application(services, tns))' statement.  I am using
> > python 2.6, soaplib20 and django 1.3.  I am struggling to understand
> > what exactly is wrong here.
>
> > class HelloWorldService(DefinitionBase):
> >     @soap(String,Integer,_returns=Array(String))
> >     def say_smello(self,name,times):
> >         results = []
> >         for i in range(0,times):
> >             results.append('Hello, %s'%name)
> >         return results
>
> > class DjangoSoapApp(WSGIApplication):
> >     csrf_exempt = True
>
> >     def __init__(self, services, tns):
> >         """Create Django view for given SOAP soaplib services and
> > tns"""
>
> >         return super(DjangoSoapApp,
> > self).__init__(Application(services, tns))
>
> >     def __call__(self, request):
> >         django_response = HttpResponse()
>
> >         def start_response(status, headers):
> >             django_response.status_code = int(status.split(' ', 1)[0])
> >             for header, value in headers:
> >                 django_response[header] = value
>
> >         response = super(DjangoSoapApp, self).__call__(request.META,
> > start_response)
> >         django_response.content = '\n'.join(response)
>
> >         return django_response
>
> > # the view to use in urls.py
> > hello_world_service = DjangoSoapApp([HelloWorldService], '__name__')- Hide 
> > quoted text -
>
> - Show quoted text -

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Still need help with the 405....please

2012-07-03 Thread Jeff Silverman
Below is the code from the views.py

The 405 is retunred from the 'return super(DjangoSoapApp,
self).__init__(Application(services, tns))' statement.  I am using
python 2.6, soaplib20 and django 1.3.  I am struggling to understand
what exactly is wrong here.



class HelloWorldService(DefinitionBase):
@soap(String,Integer,_returns=Array(String))
def say_smello(self,name,times):
results = []
for i in range(0,times):
results.append('Hello, %s'%name)
return results

class DjangoSoapApp(WSGIApplication):
csrf_exempt = True

def __init__(self, services, tns):
"""Create Django view for given SOAP soaplib services and
tns"""

return super(DjangoSoapApp,
self).__init__(Application(services, tns))

def __call__(self, request):
django_response = HttpResponse()

def start_response(status, headers):
django_response.status_code = int(status.split(' ', 1)[0])
for header, value in headers:
django_response[header] = value

response = super(DjangoSoapApp, self).__call__(request.META,
start_response)
django_response.content = '\n'.join(response)

return django_response

# the view to use in urls.py
hello_world_service = DjangoSoapApp([HelloWorldService], '__name__')

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Django 1.3 with soaplib2.0

2012-06-26 Thread Jeff Silverman
I'm trying to use the soaplib 2.0 web service snippet example and
continue to receive a 405 method not allowed error when trying to
access the method.  I coded the example as is, with the views.py and
urls.py exactly as shown.  I'm new to web services, so I know i've
missed something, but I cannot seem to determine what?

I would sure appreciate any help or understanding of what's missing.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



  1   2   3   4   5   6   7   >