Re: E-comm live project

2024-03-19 Thread André Lewis
Ooh ooh. Add me too 18763198281

On Mon, 18 Mar 2024, 12:26 pm 1001_prabhjot Singh, 
wrote:

> so i am working on a full stack e-comm website and this project is really
> very big for me because it's a live project am using django for backend
> interested one's can send there number for WhatsApp group
>
> --
> You received this message because you are subscribed to the Google Groups
> "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/1101d563-726a-458e-ad9f-4b91bebf3132n%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/CAJN6x_ihtV8Y7T7C-m%2BU0NuskzvUWDwD6j1z6irYzf7oTa8KZg%40mail.gmail.com.


Re: Student Club Management Web App: Seeking Collaboration and Advice from Experts

2024-03-05 Thread André Lewis
I'm interested, this will be a good opportunity for me. 8763198281

On Mon, 4 Mar 2024, 9:30 am phala mat,  wrote:

> Interested, this will be a good learning opportunity for me
> +27739060158
>
> On Mon, Mar 4, 2024 at 10:00 AM Patient makanga 
> wrote:
>
>> Interested, here is my WhatsApp: +27692415579.
>>
>> On Sun, Mar 3, 2024, 8:28 PM SOLTAN NOURELDIEN 
>> wrote:
>>
>>> The number is incorrect, I Can't find you on the whatsapp.
>>>
>>> On Saturday, March 2, 2024 at 7:06:57 PM UTC+3 kelvin Ace wrote:
>>>
 Interested… 09053116324

 On Sat, Mar 2, 2024 at 4:58 PM SOLTAN NOURELDIEN 
 wrote:

>
> Hello, I am currently working on my Django Project for a specific
> course at my university. I have already finished reading "Django for
> Beginners" by William S. Vincent. Now, I am eager to start this project,
> but I am still in the learning and research phase. Therefore, I will
> provide the requirements for the project and would appreciate feedback or
> any tips from anyone with experience in such projects.
>
> For example, this will be my first time implementing a multi-user
> system. After doing extensive research, I learned about Django's model
> group concept managing this approach. Additionally, I discovered Django
> Channels and signals, which I have never heard of before. I would
> appreciate any advice or guidance on how to approach such a project.
>
> Furthermore, if anyone is interested in joining me on this journey, it
> would be wonderful. We can learn a lot from this project together. The
> deadline is less than two months, so please provide your Discord or
> WhatsApp number, and we can create a group to collaborate on this project.
>
> *The requirements for the project are as follows:*
>
> An app for student clubs:
> *SKS Admin:*
>
>-
>   - Create Club Page
>   - Delete Club Page
>   - Assign Club Manager
>   - Activity Form (Approve, Reject)
>   - Receive notifications (Whenever a change occurs in the club
>   page) (Approve Change, Reject Change)
>   - Request for Publishing Activity Post (Approve, Reject)
>   - Search Club Page
>   - Announce All Activities (Will be displayed on the main page)
>
> *Club Manager:*
>
>-
>   - Fill out the activity form
>   - Request for publishing Activity Post (Sending it to admin,
>   and after approval, the activity will appear on the club main page)
>   - Receive Notification (The response to the Activity Form &
>   Activity Post publishing request)
>   - Edit Activity Post (Admin manager will receive a notification)
>
> *Student:*
>
>-
>   - Display weekly Activity Table
>   - Display Clubs Main Page
>   - Search (by category, by date)
>
> I will only focus on the backend development and integrate it into the
> template. I have other team members who will provide the Static HTML, CSS 
> &
> JS files. I will incorporate them into the Django templates and work on
> making them interactive.
>
> Additionally, if time allows, I can implement additional features such
> as:
>
>- Manager:
>   - Submit an application to SKS to assign a club
>   - Initiate a chat conversation between the manager and the SKS
>- Student:
>   - Become a member of a club
>   - Follow Clubs
>   - Follow the club pages
>   - Like and comment on a post
>
> If you have any ideas or know of existing projects that could serve as
> inspiration, please feel free to comment. I would greatly appreciate it.
>
> Also, if you would like to collaborate with me for learning purposes
> and to work as a team, please don't hesitate to provide your contact
> information, and I will reach out to you. Thank you very much.
>
> --
> You received this message because you are subscribed 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/19da6a17-4c28-41d5-acb1-171fb052c9a1n%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/007fa30a-1448-4b40-8e94-167534a754d7n%40googlegroups.com
>>> 

Re: Về: Exciting Opportunity: Join Our Django WhatsApp Bulk Messaging Project!

2024-02-28 Thread André Lewis
I'm interested. I have experience in Django development, and front end
development. My WhatsApp number is +18763198281

On Sat, 24 Feb 2024, 10:03 am Hoàng Xuân, 
wrote:

> Hi! Please can you add me to join the group ? Thank you !
> --
> *From:* django-users@googlegroups.com  on
> behalf of Benjamin Nwoke 
> *Sent:* Saturday, February 24, 2024 0:52
> *To:* django-users@googlegroups.com 
> *Subject:* Re: Exciting Opportunity: Join Our Django WhatsApp Bulk
> Messaging Project!
>
> I'm interested, I wish to have the details
>
> On Sun, Feb 18, 2024, 5:48 PM SURAJ TIWARI  wrote:
>
>  Join Our Django WhatsApp Bulk Messaging Project!
>
>  Hello everyone,
>
> Are you looking for an exciting opportunity to gain hands-on experience in
> Django development? Do you want to work on a meaningful project that
> leverages WhatsApp for bulk messaging? We're thrilled to invite you to join
> our dynamic team!
>
>  Benefits:
>
>- Get hands-on experience working on a real-world Django project.
>- Learn how to leverage WhatsApp for bulk messaging, a valuable skill
>in today's digital landscape.
>- Opportunities for hybrid work, allowing flexibility in your schedule.
>- Collaborate with experienced developers and gain valuable mentorship.
>- Access to cutting-edge tools and technologies.
>
>  Opportunities Available:
>
>- Django developers
>- Frontend developers
>- UI/UX designers
>- Quality assurance testers
>
> 欄 How to Join: Simply reply to this message expressing your interest,
> and we'll provide you with all the necessary details to get started on our
> project.
>
> Let's work together to create something amazing and gain valuable
> experience along the way! ✨
>
> Best regards,
>
> Suraj Tiwari
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "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/e8a705fd-10d9-4c1a-b4ba-0a7b896dbfean%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/CAN1m8aGoqq8RMKyRpRfozPKcE79m%3DP8N086UXr6EnpGu%3DxTmEA%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/TY2PR04MB37736396116D0403F831CAC2A5542%40TY2PR04MB3773.apcprd04.prod.outlook.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/CAJN6x_iyf_s8j8mqw3%2Bz6_fR9J8VQoHip7K%3D%2BK1BpkwNQot0XA%40mail.gmail.com.


Re: I am interested. +2348162698617 Github: fosajeffRe: Exciting Opportunity: Join Our Django WhatsApp Bulk Messaging Project!

2024-02-24 Thread André Lewis
I'm interested. +8764608874.

On Mon, 19 Feb 2024, 11:20 am Efosa Jeffrey Okooboh, 
wrote:

> I am interested
> On Monday, February 19, 2024 at 4:47:39 PM UTC+1 july quintero wrote:
>
>> Hello, I would like to be part of this work team and thus strengthen my
>> knowledge with this great team of enthusiastic people with a lot of
>> experience in this field of web development. Thank you very much for your
>> attention and I will be waiting for a response.
>>
>>
>> El dom, 18 feb 2024 a la(s) 11:48 a.m., SURAJ TIWARI (suraj1...@gmail.com)
>> escribió:
>>
>>>  Join Our Django WhatsApp Bulk Messaging Project!
>>>
>>>  Hello everyone,
>>>
>>> Are you looking for an exciting opportunity to gain hands-on experience
>>> in Django development? Do you want to work on a meaningful project that
>>> leverages WhatsApp for bulk messaging? We're thrilled to invite you to join
>>> our dynamic team!
>>>
>>>  Benefits:
>>>
>>>- Get hands-on experience working on a real-world Django project.
>>>- Learn how to leverage WhatsApp for bulk messaging, a valuable
>>>skill in today's digital landscape.
>>>- Opportunities for hybrid work, allowing flexibility in your
>>>schedule.
>>>- Collaborate with experienced developers and gain valuable
>>>mentorship.
>>>- Access to cutting-edge tools and technologies.
>>>
>>>  Opportunities Available:
>>>
>>>- Django developers
>>>- Frontend developers
>>>- UI/UX designers
>>>- Quality assurance testers
>>>
>>> 欄 How to Join: Simply reply to this message expressing your interest,
>>> and we'll provide you with all the necessary details to get started on our
>>> project.
>>>
>>> Let's work together to create something amazing and gain valuable
>>> experience along the way! ✨
>>>
>>> Best regards,
>>>
>>> Suraj Tiwari
>>>
>>>
>>> --
>>> You received this message because you are subscribed 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 view this discussion on the web visit
>>> https://groups.google.com/d/msgid/django-users/e8a705fd-10d9-4c1a-b4ba-0a7b896dbfean%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/35101022-f487-42c5-9ae1-74afea0ed56dn%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/CAJN6x_h%2BQjLR9YvJHsC1Zt-OGMgjDxYJgVR5GnWmXoTEH7Q67w%40mail.gmail.com.


Re: Guidepath to learn django

2023-06-27 Thread lewis machilika
Did you already tried the Django official documentation?

Regards,
Lewis
On Tue, 27 Jun 2023 at 2:02 PM, Dilmurod Dilmurod <
dilmuroddilmurod...@gmail.com> wrote:

> https://youtu.be/xO1O0-L8ze0
>
> Sesh, 27-iyn, 2023, 02:00 Mohit Lamba :
>
>> Hello
>>
>> I hope this email finds you well. My name is Mohit Lamba , and I am
>> writing to express my interest in learning Django but not getting the right
>> course that i should follow or a roadmap. I have been an avid member of
>> this Django group for some time now and greatly admire the knowledge and
>> expertise shared within this community.
>>
>>
>> I am a recent graduate from college and wanted to learn and improve my
>> skillset so I could learn more about the industry.
>>
>> It would be grateful if someone could guide me on how and where to start
>> and how to improve.
>> Tech stack I am familiar with:
>> REACTJS,  Javascript, Tailwind CSS, Bootstrap, HTML,CSS,
>> Languages : C++, C, , PYTHON, JAVASCRIPT
>>
>>
>>
>> Thank You
>>
>> Mohit Lamba
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "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/875743ed-3d79-4ce0-a3d1-2879fb63149an%40googlegroups.com
>> <https://groups.google.com/d/msgid/django-users/875743ed-3d79-4ce0-a3d1-2879fb63149an%40googlegroups.com?utm_medium=email_source=footer>
>> .
>>
> --
> You received this message because you are subscribed to the Google Groups
> "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/CANHuyY%2BCJXohbvWU0nbjrj_ZwPFASRAfEJ517zBwa_21JP4DWw%40mail.gmail.com
> <https://groups.google.com/d/msgid/django-users/CANHuyY%2BCJXohbvWU0nbjrj_ZwPFASRAfEJ517zBwa_21JP4DWw%40mail.gmail.com?utm_medium=email_source=footer>
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"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/CAGRTm9H1LXVD%3Dy0%2BtWypsLqG-3iNvpK%2BTC8Mi1wCo1dZMdCkYQ%40mail.gmail.com.


Tokenized Authentication for subdomains

2023-05-24 Thread André Lewis
Hi,

I'm currently working on a project with subdomains, and I wanted to
authenticate the user across the site, regardless of the url. I did some
digging and found some ideas for implementing Oauth/openID connect
authentication in Django (wasn't much help). Seeing, I don't intend on
using third-party providers for this one.

 I have an idea of how it should work 'on paper', but it gets fuzzy when I
start thinking about server-end verification; how the token is generated,
and how I get access to it for later verification.

Any suggestions, would be really helpful?
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/CAJN6x_gEgbE87yg0NpzhS_Rr_BEwWwo7HkWT02JRccfCfWS2Gw%40mail.gmail.com.


Re:

2022-09-26 Thread André Lewis
Hi! could you add me as well,
+18762382482

On Mon, 26 Sept 2022 at 20:45, Adolfo Duque León Fresneda (MisterRevenue) <
duque...@gmail.com> wrote:

> hello if you can send me the link or add me +529381108109.. greeting from
> Mexico
>
> El lunes, 26 de septiembre de 2022 a las 7:54:05 UTC-5, farid...@gmail.com
> escribió:
>
>> Hello fellow developers, I will be creating a WhatsApp group chat later
>> in the day, So I will like my fellow Python Django Developers to join the
>> group. It will be much easier to discuss there and I will sacrifice myself
>> out for anyone who need my service.
>>
>> God bless you all
>> Enjoy your day
>> Biliaminu
>>
> --
> You received this message because you are subscribed to the Google Groups
> "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/1e19374b-65cb-4fd0-8533-7cc5751fc1f2n%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/CAJN6x_jJ8w_QBGWOEaXjgO9fChofhZ28fBZ5t9b%2BWyGipSvmsw%40mail.gmail.com.


Re: 'WSGIRequest' object has no attribute 'is_ajax'

2022-09-16 Thread André Lewis
What version of Django are you using? If it's 4.1, I'm pretty sure it's no
longer supported.

You can check the docs to confirm:
https://docs.djangoproject.com/en/4.1/ref/request-response/

On Thu, 15 Sept 2022 at 16:55, Matheus Bon  wrote:

> Hello guys!
>
> I'm using AJAX in my Django project, as soon as I finished writing the
> code and went to test it, this error always pops up.
>
> The site runs normally, it's only when I send it that this happens.
>
> What should I do?
>
> --
> You received this message because you are subscribed to the Google Groups
> "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/7e8fb2cc-337c-4532-9c54-ae9e2a28e877n%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/CAJN6x_h%2BfPaySJFGLOWKCYzkRiEn63LSqs32ee8S5Jajx0qxqw%40mail.gmail.com.


Re: Support d'aide en Django

2022-04-26 Thread Israel Lewis
hello i am new in django and i would like to use it with react native. and 
for that I have to combine django and postgres . need a guide, any help 
will be precious to me (support, site, course etc...) cordially

Hello 
I think you can go about this in two ways, 
1. you can start your project with the sqlite and later migrate to 
postgress 
2. start with postgress at once 
https://www.calazan.com/migrating-django-app-from-mysql-to-postgresql/  you 
can follow that guide to setup postgress.


On Thursday, 21 April 2022 at 22:48:05 UTC+3 diakitedj...@gmail.com wrote:

> Bonjour je suis nouvelle en django et j'aimerai l'utiliser avec react 
> native. Et pour cela je dois combiner django et postgres . Besoin de guide 
> , tout aide me sera précieuse ( support , site,  cours etc...)
>
> Cordialement
>

-- 
You received this message because you are subscribed to the Google Groups 
"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/6f0f2210-c330-4a3c-af94-ea3d76787864n%40googlegroups.com.


Re: Django FormTools

2022-04-26 Thread Israel Lewis
1. Are you using a model form?
  if so, after you have check the request you can use 
   Post.save()***post as the model name for example.
2. for styling use  https://django-crispy-forms.readthedocs.io/ or create 
widgets with in the for and add the classes for each input. 
 
Hope this help you out.

On Thursday, 21 April 2022 at 22:47:57 UTC+3 ahmeddo...@gmail.com wrote:

> hey everyone i'm using Django with wizard form and everithing work fine 
> but i don't know how to styling inputs
> and i don't know how to save data on my database.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"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/337b5b92-4379-44a6-8c89-0eb65b35e342n%40googlegroups.com.


Error django.db.utils.OperationalError: no such column:

2022-04-26 Thread Israel Lewis
Hello guys,

I'm having an error in my models when I add the FK to the faculty or the 
student.
model.py 
from django.db import models

# Create your models here.


class Student(models.Model):
first_name = models.CharField(max_length=100)
last_name = models.CharField(max_length=100)
reg_no = models.CharField(max_length=20, unique=True)

def __str__(self):
return self.first_name


class Faculty(models.Model):
faculty_name = models.CharField(max_length=100)
student = models.ForeignKey(Student, on_delete=models.CASCADE)

def __str__(self):
return self.faculty_name


class Course(models.Model):
course_name = models.CharField(max_length=100, unique=True)
faculty = models.ForeignKey(Faculty, on_delete=models.CASCADE)

def __str__(self):
return self.course_name


class Dean(models.Model):
dean_name = models.CharField(max_length=100)
faculty = models.OneToOneField(Faculty, on_delete=models.CASCADE)

def __str__(self):
return self.dean_name


class StudentRequest(models.Model):
student_name = models.CharField(max_length=100)
faculty = models.ForeignKey(Faculty, on_delete=models.CASCADE)
course = models.ForeignKey(Course, on_delete=models.CASCADE)
reg_no = models.CharField(max_length=20)
reasons = models.CharField(max_length=300, null=False)

def __str__(self):
return f"{self.student_name}"


class FinancialRecords(models.Model):
ACADENIC_YEAR_CHOICES = [
('Year 3 Sem 2'),
('Year 4 Sem 2')
]
PAYMENT_PLAN_CHOICES = [
('Full'),
('Follow'),
('Fail'),
]

payment_plan_category = models.CharField(
PAYMENT_PLAN_CHOICES, max_length=10)

student_reg = models.ForeignKey(Student, models.CASCADE)
academic_year = models.CharField(ACADENIC_YEAR_CHOICES, max_length=20)
course = models.ForeignKey(Course, on_delete=models.CASCADE)



Errors
Traceback (most recent call last):
  File 
"/home/israel/Desktop/exams-clearance/env/lib/python3.8/site-packages/django/db/backends/utils.py",
 
line 89, in _execute
return self.cursor.execute(sql, params)
  File 
"/home/israel/Desktop/exams-clearance/env/lib/python3.8/site-packages/django/db/backends/sqlite3/base.py",
 
line 477, in execute
return Database.Cursor.execute(self, query, params)
sqlite3.OperationalError: no such column: exams_app_faculty.student_id

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File 
"/home/israel/Desktop/exams-clearance/env/lib/python3.8/site-packages/django/core/handlers/exception.py",
 
line 55, in inner
response = get_response(request)
  File 
"/home/israel/Desktop/exams-clearance/env/lib/python3.8/site-packages/django/core/handlers/base.py",
 
line 197, in _get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs)
  File 
"/home/israel/Desktop/exams-clearance/env/lib/python3.8/site-packages/django/contrib/admin/options.py",
 
line 683, in wrapper
return self.admin_site.admin_view(view)(*args, **kwargs)
  File 
"/home/israel/Desktop/exams-clearance/env/lib/python3.8/site-packages/django/utils/decorators.py",
 
line 133, in _wrapped_view
response = view_func(request, *args, **kwargs)
  File 
"/home/israel/Desktop/exams-clearance/env/lib/python3.8/site-packages/django/views/decorators/cache.py",
 
line 62, in _wrapped_view_func
response = view_func(request, *args, **kwargs)
  File 
"/home/israel/Desktop/exams-clearance/env/lib/python3.8/site-packages/django/contrib/admin/sites.py",
 
line 242, in inner
return view(request, *args, **kwargs)
  File 
"/home/israel/Desktop/exams-clearance/env/lib/python3.8/site-packages/django/utils/decorators.py",
 
line 46, in _wrapper
return bound_method(*args, **kwargs)
  File 
"/home/israel/Desktop/exams-clearance/env/lib/python3.8/site-packages/django/utils/decorators.py",
 
line 133, in _wrapped_view
response = view_func(request, *args, **kwargs)
  File 
"/home/israel/Desktop/exams-clearance/env/lib/python3.8/site-packages/django/contrib/admin/options.py",
 
line 2063, in changelist_view
"selection_note": _("0 of %(cnt)s selected") % {"cnt": 
len(cl.result_list)},
  File 
"/home/israel/Desktop/exams-clearance/env/lib/python3.8/site-packages/django/db/models/query.py",
 
line 302, in __len__
self._fetch_all()
  File 
"/home/israel/Desktop/exams-clearance/env/lib/python3.8/site-packages/django/db/models/query.py",
 
line 1507, in _fetch_all
self._result_cache = list(self._iterable_class(self))
  File 
"/home/israel/Desktop/exams-clearance/env/lib/python3.8/site-packages/django/db/models/query.py",
 
line 57, in __iter__
results = compiler.execute_sql(
  File 
"/home/israel/Desktop/exams-clearance/env/lib/python3.8/site-packages/django/db/models/sql/compiler.py",
 
line 1361, in execute_sql
cursor.execute(sql, params)
  File 
"/home/israel/Desktop/exams-clearance/env/lib/python3.8/site-packages/django/db/backends/utils.py",
 
line 103, in execute
return super().execute(sql, params)
  File 

Django Resources

2022-02-09 Thread Israel Lewis
Hello guys.
I have just completed a tutorial on python. I want to start learning django 
now, can you recommended some great resources for me to use. 

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/12d02446-1079-4418-adb9-e8670b2f35b3n%40googlegroups.com.


Re: Not able to install django-heroku

2019-10-31 Thread lewis machilika
i think you should first check version of both pip and python
u might need pip3 or python 3 to run those commands since you are
trying to install latest version of django using old pip/python

On 10/31/19, soumya sharma  wrote:
> Thanks, Kasper. I don't know what the issue was but it is working fine now.
>
> I added django-heroku==0.3.1 in the requirements.txt file and it worked. :)
>
> On Thursday, October 31, 2019 at 5:50:36 PM UTC+5:30, Kasper Laudrup wrote:
>>
>> Hi Soumya,
>>
>> On 31/10/2019 08.28, soumya sharma wrote:
>> > I tried installing the psycopg-binary as suggested in the error
>> > statement but it is still not working. Please help
>> >
>>
>> I don't know anything about django-heroku, but the reason you get the
>> error is that you are attempting to build the psycopg2 package from
>> source. In order to do that you need to have the python development
>> package installed. You haven't specified which distro you are using
>> (assuming this is on Linux), but it's probably called something like
>> python-devel, python3-dev or similar.
>>
>> 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/6a536e1b-6bfd-43e5-9d74-62f876a1af5d%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/CAGRTm9G8bzWnhnHYXsFatWmAfoZE9ctWAuDYQOOnNGRT7NOP0Q%40mail.gmail.com.


Multiple foreign Field

2019-10-13 Thread lewis machilika
Show us how you implemented the model.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/ddb20ff6-43ac-4b4d-a8fa-0f485c92ffb6%40googlegroups.com.


Re: Two-to-Many Mapping between Models in Django ORM

2015-07-30 Thread Rich Lewis
Hi Tom,

That was approximately what I was planning to do, I shall do some 
experimenting to see if I can do any more.  I was just wondering if there 
was a clever feature for this sort of thing, as ORMs seem pretty magic 
already!

Thanks,
Rich

On Thursday, 30 July 2015 17:15:40 UTC+1, Tom Evans wrote:
>
> On Thu, Jul 30, 2015 at 4:08 PM, Rich Lewis <rich@gmx.co.uk 
> > wrote: 
> > Dear All, 
> > 
> > I'm new to the Django ORM, and quite new to ORMs in general.  I have two 
> > models (lets call them A and B) between which I have an interesting 
> mapping. 
> > There are precisely 2 B instances associated with each A instance.  Each 
> A 
> > instance can have many B instances.  The order of Bs are important for 
> As. 
> > 
> > I want to do something like this: 
> > 
> > class A(models.Model): 
> >   b_1 = models.ForeignKey(B) 
> >   b_2 = models.ForeignKey(B) 
>
> This would fail here, when you have more than one foreign key to the 
> same model, you must supply a related_name argument on one of them, 
> which is used for the inverse relation on the related object. Which 
> leads us in to... 
>
> > 
> > class B(models.Model): 
> >   pass 
> > 
> > Such that i can do: 
> > 
> >>>> b1, b2, b3 = B(), B(), B() 
> >>>> a1, a2 = A(b_1=b1, b_2=b2), A(b_1=b2, b_2=b3) 
> >>>> b2.as 
> > [, ] #(order doesn't matter) 
>
> Typically, B instances would have an attribute named 'a_set' (the 
> lower case model name of the model it is related to, with "_set" 
> appended). When you have multiple relationships with the same model, 
> as I mentioned you must supply your own related_name arguments. In 
> which case, with the models you mentioned, you could then do something 
> like this: 
>
> >>> b2.a1_set.all() | b2.a2_set.all() 
> > [, ] 
>
> > 
> > I expect I could eventually do something a bit hacky that would work, 
> but 
> > what would be the best way to handle this? 
>
> I would say the above is the hacky way. You could have the same B 
> assigned to b_1 and b_2 and would have duplicates in the set, and no 
> way to specify DB constraints to limit it. 
>
> Given that you anticipate being able to retrieve all the A's for a 
> particular B, regardless of how they are related, I would model it as 
> a M2M with a through table holding any additional information about 
> the relationship, using the through table to add DB level constraints. 
>
> Cheers 
>
> Tom 
>

-- 
You received this message because you are subscribed to the Google Groups 
"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/daa601f5-12d5-44fe-8c58-f2f052629261%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Two-to-Many Mapping between Models in Django ORM

2015-07-30 Thread Rich Lewis
Oops sorry I meant every B instance can have multiple A instances.  Sorry!

On Thursday, 30 July 2015 16:21:37 UTC+1, monoBOT monoBOT wrote:
>
>
> 2015-07-30 16:08 GMT+01:00 Rich Lewis <rich@gmx.co.uk >:
>
>> There are precisely 2 B instances associated with each A instance.  Each 
>> A instance can have many B instances
>
>
> Isnt that a contradiction?
>
>
>
> -- 
> *monoBOT*
> Visite mi sitio(Visit my site): monobotsoft.es/blog/
>  

-- 
You received this message because you are subscribed to the Google Groups 
"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/40eadb77-0205-403d-92a8-52859645c4fc%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Two-to-Many Mapping between Models in Django ORM

2015-07-30 Thread Rich Lewis
Dear All,

I'm new to the Django ORM, and quite new to ORMs in general.  I have two 
models (lets call them A and B) between which I have an interesting 
mapping.  There are precisely 2 B instances associated with each A 
instance.  Each A instance can have many B instances.  The order of Bs are 
important for As.

I want to do something like this:

class A(models.Model):
  b_1 = models.ForeignKey(B)
  b_2 = models.ForeignKey(B)

class B(models.Model):
  pass

Such that i can do:

>>> b1, b2, b3 = B(), B(), B()
>>> a1, a2 = A(b_1=b1, b_2=b2), A(b_1=b2, b_2=b3)
>>> b2.as
[, ] #(order doesn't matter)

I expect I could eventually do something a bit hacky that would work, but 
what would be the best way to handle this?

Thanks in advance,

Richard

-- 
You received this message because you are subscribed to the Google Groups 
"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/3250c3c4-7598-4104-8a7b-1a0aa313a253%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: What are some 3rd party good django applications which handle user registration,login and authentication?

2015-06-08 Thread Marcos Lewis
For registration I like to use django-registration-redux.

https://django-registration-redux.readthedocs.org/en/latest/

El lunes, 8 de junio de 2015, 15:55:36 (UTC-3), akshat escribió:
>
> I know some applications and have also used them but I want to know what 
> other django users use and love?
>
> 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/3d0ade58-c8da-49bf-ae05-2386ab29520a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Django Multiple ForeignKey Navigation

2014-12-18 Thread Rodney Lewis
Hey All;

Sorry my question yesterday was poorly assembled.  I'm trying again. 
 Please take a look:

https://stackoverflow.com/questions/27543962/django-multiple-foreignkey-navigation

Thank you so much for any help!

-- 
Rodney Lewis
http://www.youtube.com/pyrodney

-- 
You received this message because you are subscribed to the Google Groups 
"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/9909b7db-6085-4f6e-8724-3e17e62f23f0%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Django ManyToManyField Not Displaying in Template

2014-12-17 Thread Rodney Lewis
Hey All:

I need my template to iterate through each PartModel and then iterate 
through the PartModels associated (through a self-referential 
ManyToManyField) with the PartModel in question. I am doing everything I'm 
supposed to be doing according to my reading of the "entry_set syntax" 
section of the "Making Queries" section of the docs to no avail.
http://stackoverflow.com/questions/27527717/django-manytomanyfield-not-displaying-in-template

Thank you in advance for any assistance!

-- 
Rodney Lewis
http://www.youtube.com/pyrodney

-- 
You received this message because you are subscribed to the Google Groups 
"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/e5684a8d-21e2-4d21-ae94-c235804b35d3%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Tricky Django QuerySet with Complicated ForeignKey Traversals

2014-11-19 Thread Rodney Lewis
Please check out my question on StackOverflow:

http://stackoverflow.com/questions/27016026/tricky-django-queryset-with-complicated-foreignkey-traversals

I really appreciate any help you can offer.

-- 
Rodney Lewis
http://www.youtube.com/pyrodney

-- 
You received this message because you are subscribed to the Google Groups 
"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/b03b2844-9266-49a0-a317-a9e1de27f2f0%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Screenshot pdf from AWS hosted django app

2014-07-25 Thread Ralph Lewis
I am hosting a django webapp in AWS and that is running fine, no errors. I 
now want to be able to take a screenshot of the first page of any pdf that 
is uploaded to the webapp. I have not had any luck trying to screenshot a 
pdf with python. I have heard this can be done with PythonMagick, however, 
I have not been able to get ImageMagick to work on my local dev instance. 
Any guidance would be excellent.

-- 
You received this message because you are subscribed to the Google Groups 
"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/5a43284b-78f5-4b55-b355-a279e303f28c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


How to combine multiple querysets and remove duplicates?

2014-01-09 Thread Rodney Lewis
Please help with my question I posted to StackOverflow:

http://stackoverflow.com/questions/21013973/how-to-combine-multiple-querysets-and-remove-duplicates

Thank you!

-- 
Rodney Lewis
http://www.youtube.com/pyrodney

-- 
You received this message because you are subscribed to the Google Groups 
"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/cda5d890-43d3-46b8-b060-292a73afe5d9%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Storages API modified_time() and timezones.

2013-10-18 Thread Ian Lewis
Hi,

I'm trying to get a handle on the modified_time() method in the Storages
API. I couldn't find any hints in the doc as to what the right way to
implement the modified_time() method was in regard to timezones. Currently
it looks like the default FileSystemStorage backend returns the modified
time as returned from os.path.getmtime() which is in the system timezone.

Should the modified time as returned by modified_time() be in the system
timezone (this is not the TIME_ZONE setting)? i.e. the FileSystemStorage is
the de-facto standard?

The reason I ask this is because it raises an issue when using other
different backends together since the collectstatic command will compare
modified times of files from the different backends to determine if it
needs to update the file. We have problems with this because some systems
like AWS's S3 will return the modified time in UTC or some other timezone
and need to be converted.

-- 
Ian

http://www.ianlewis.org/

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


PyCon APAC CFP

2013-07-03 Thread Ian Lewis
Hey Django users!

I wanted to get the word out that we are accepting talks for this year's
PyCon APAC in Tokyo Japan. If you have ever wanted to visit Tokyo and you
have a Python topic you are passionate about then this is your chance!

The conference is formatted into 4 tracks, 2 Japanese and 2 English tracks.
We are especially looking for English speakers to give talks so be sure
submit a talk proposal. I was a bit late getting the word out to the U.S.
mailing lists so there is only a week left to submit proposals. Don't sit
on it!
http://apac-2013.pycon.jp/speakers/cfp.html

More info about PyCon APAC

The conference is being held on Sept. 14th-15th with tutorials on the 13th
and development sprints being held on the 16th. We are hoping to have up to
500 participants this year (PyCon JP sold out at 400 last year). George
Brandl (@birkenfeld) is our first keynote speaker. We have another really
exciting keynote speaker lined up.

You can find out more about the conference details on the about page:
http://apac-2013.pycon.jp/about/index.html

The conference venue is the Kogakuin University Shinjuku Campus in the
heart of Tokyo. Anyone coming to the conference won't be at a loss for
things to do :)
http://apac-2013.pycon.jp/venue/index.html

...Or if you would just like to come and participate we welcome that too!
Conference registration is currently open:

Early Bird Registration: http://connpass.com/event/2703/
Patron Sponsor Registration: http://connpass.com/event/2704/

Thanks! If anyone has questions I'll do my best to answer them.
Hope to see you in Tokyo!

-- 
Ian

http://www.ianlewis.org/

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




Re: internal server error not sending message notification

2013-05-04 Thread Ian Lewis
Hi,

Did you set your LOGGING configuration in your settings.py? If you happened
to upgrade to Django 1.5 then the default LOGGING configuration went away
and it will no longer sent emails to the admins without some configuration.
This is described at the following url where it says "Prior to Django 1.5":
https://docs.djangoproject.com/en/dev/topics/logging/#configuring-logging

You need to set up something like the following for admin error mails to
work:

LOGGING = {
'version': 1,
'disable_existing_loggers': False,
'filters': {
'require_debug_false': {
'()': 'django.utils.log.RequireDebugFalse',
}
},
'handlers': {
'mail_admins': {
'level': 'ERROR',
'filters': ['require_debug_false'],
'class': 'django.utils.log.AdminEmailHandler'
}
},
'loggers': {
'django.request': {
'handlers': ['mail_admins'],
'level': 'ERROR',
'propagate': True,
},
}
}

Hope that helps,
Ian


On Sat, May 4, 2013 at 8:01 AM, ?manu*  wrote:

> I suddenly realized that my server is no more sending email notifications
> when an internal error occurs. I'm not sure which could be the modification
> that caused this behavior. I have the following information:
>
> 1. on internal errors the server gives an error not founding template file
> 500.html.
>
> 2. if I put my 500.html template then django does not complain anymore,
> shows the page but does not send the email message.
>
> 3. from manage.py shell the command django.core.mail.mail_admins works
> fine (email arrives to the admins)
>
> Any clue?
>
> Thanks,
> E.
>
> --
> You received this message because you are subscribed to the Google Groups
> "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.
>
>
>



-- 
Ian

http://www.ianlewis.org/

-- 
You received this message because you are subscribed to the Google Groups 
"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 1.5 not disconnecting from database after a request

2013-04-11 Thread Lewis Sobotkiewicz
Fixed now. 
See 
https://groups.google.com/forum/?fromgroups=#!topic/django-users/FxTD5M0x-G8 
for the resolution, if anyone runs into the same thing.

On Wednesday, April 10, 2013 5:04:58 PM UTC-7, Lewis Sobotkiewicz wrote:
>
> Seems to be caused by Django not sending the "request_finished" signal, 
> which is also bizarre, unexpected behaviour.
>
> On Wednesday, April 10, 2013 11:47:52 AM UTC-7, Lewis Sobotkiewicz wrote:
>>
>> Thanks, but I'm not using the Django development version. Apparently 
>> persistent DB conns will be a feature of Django 1.6, but not 1.5.1.
>>
>> I'm using RDS with MySQL 5.5.27. The only thing I've changed about the 
>> infrastructure is upgrading Django to 1.5.1. If I downgrade to 1.4.5, DB 
>> connections are released after the request, as expected.
>>
>> On Wednesday, April 10, 2013 2:24:05 AM UTC-7, Andrey Kostakov wrote:
>>>
>>>
>>> https://docs.djangoproject.com/en/dev/ref/databases/#persistent-connections 
>>>
>>> On Wed, Apr 10, 2013 at 2:59 AM, Lewis Sobotkiewicz <le...@semadic.com> 
>>> wrote: 
>>> > Hi all, 
>>> > 
>>> > I'm seeing some strange, undocumented behaviour when upgtrading to 
>>> Django 
>>> > 1.5.1. I notice that it is holding onto MySQL connections after 
>>> request 
>>> > processing completes, where Django 1.4.5 disconnected after every 
>>> request. 
>>> > 
>>> > Any idea what could be happening? 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...@googlegroups.com. 
>>> > To post to this group, send email to django...@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. 
>>> > 
>>> > 
>>>
>>>
>>>
>>> -- 
>>> Best regards, 
>>> Andrey Kostakov 
>>> Email/Gtalk: b...@dzen.ws 
>>>
>>

-- 
You received this message because you are subscribed to the Google Groups 
"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: request_finished signal not being called with Django 1.5.1 with uwsgi

2013-04-11 Thread Lewis Sobotkiewicz
So figured it out.

Apparently Ubuntu 12.04 packages uwsgi 1.0.3 in their apt repository, which 
doesn't support calling close() on the WSGI application object returned by 
Django. I had installed that uWsgi version, then installed a more 
up-to-date version with pip. ie.

pip install uwsgi==1.4.4

Subsequently, running uwsgi from the command line gives the later version:

$ uwsgi --version
1.4.4

However, when starting uwsgi with /etc/init.d/uwsgi, it was using Ubuntu's 
older, pre-packaged version. I assumed that pip would overwrite that 
version. Silly me. Fixed by editing /etc/init.d/uwsgi to point 
DAEMON=/usr/bin/uwsgi to the version installed by pip.

On Wednesday, April 10, 2013 4:55:51 PM UTC-7, Lewis Sobotkiewicz wrote:
>
> Hi there,
>
> I'm noticing some strange behaviour with Django 1.5.1 and uwsgi - The 
> builtin signal django.core.signals.request_finished isn't being triggered. 
> I've tried various versions of uwsgi, and they all have the same behaviour.
>
> Also, when I downgrade to Django 1.4.5, the normal behaviour resumes.
>
> Any idea why this might be happening? It's causing my DB connections to 
> remain open after a request.
>

-- 
You received this message because you are subscribed to the Google Groups 
"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 1.5 not disconnecting from database after a request

2013-04-10 Thread Lewis Sobotkiewicz
Seems to be caused by Django not sending the "request_finished" signal, 
which is also bizarre, unexpected behaviour.

On Wednesday, April 10, 2013 11:47:52 AM UTC-7, Lewis Sobotkiewicz wrote:
>
> Thanks, but I'm not using the Django development version. Apparently 
> persistent DB conns will be a feature of Django 1.6, but not 1.5.1.
>
> I'm using RDS with MySQL 5.5.27. The only thing I've changed about the 
> infrastructure is upgrading Django to 1.5.1. If I downgrade to 1.4.5, DB 
> connections are released after the request, as expected.
>
> On Wednesday, April 10, 2013 2:24:05 AM UTC-7, Andrey Kostakov wrote:
>>
>>
>> https://docs.djangoproject.com/en/dev/ref/databases/#persistent-connections 
>>
>> On Wed, Apr 10, 2013 at 2:59 AM, Lewis Sobotkiewicz <le...@semadic.com> 
>> wrote: 
>> > Hi all, 
>> > 
>> > I'm seeing some strange, undocumented behaviour when upgtrading to 
>> Django 
>> > 1.5.1. I notice that it is holding onto MySQL connections after request 
>> > processing completes, where Django 1.4.5 disconnected after every 
>> request. 
>> > 
>> > Any idea what could be happening? 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...@googlegroups.com. 
>> > To post to this group, send email to django...@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. 
>> > 
>> > 
>>
>>
>>
>> -- 
>> Best regards, 
>> Andrey Kostakov 
>> Email/Gtalk: b...@dzen.ws 
>>
>

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




request_finished signal not being called with Django 1.5.1 with uwsgi

2013-04-10 Thread Lewis Sobotkiewicz
Hi there,

I'm noticing some strange behaviour with Django 1.5.1 and uwsgi - The 
builtin signal django.core.signals.request_finished isn't being triggered. 
I've tried various versions of uwsgi, and they all have the same behaviour.

Also, when I downgrade to Django 1.4.5, the normal behaviour resumes.

Any idea why this might be happening? It's causing my DB connections to 
remain open after a request.

-- 
You received this message because you are subscribed to the Google Groups 
"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 1.5 not disconnecting from database after a request

2013-04-10 Thread Lewis Sobotkiewicz
Thanks, but I'm not using the Django development version. Apparently 
persistent DB conns will be a feature of Django 1.6, but not 1.5.1.

I'm using RDS with MySQL 5.5.27. The only thing I've changed about the 
infrastructure is upgrading Django to 1.5.1. If I downgrade to 1.4.5, DB 
connections are released after the request, as expected.

On Wednesday, April 10, 2013 2:24:05 AM UTC-7, Andrey Kostakov wrote:
>
> https://docs.djangoproject.com/en/dev/ref/databases/#persistent-connections 
>
> On Wed, Apr 10, 2013 at 2:59 AM, Lewis Sobotkiewicz 
> <le...@semadic.com> 
> wrote: 
> > Hi all, 
> > 
> > I'm seeing some strange, undocumented behaviour when upgtrading to 
> Django 
> > 1.5.1. I notice that it is holding onto MySQL connections after request 
> > processing completes, where Django 1.4.5 disconnected after every 
> request. 
> > 
> > Any idea what could be happening? 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...@googlegroups.com . 
> > To post to this group, send email to 
> > django...@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. 
> > 
> > 
>
>
>
> -- 
> Best regards, 
> Andrey Kostakov 
> Email/Gtalk: b...@dzen.ws  
>

-- 
You received this message because you are subscribed to the Google Groups 
"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 1.5 not disconnecting from database after a request

2013-04-09 Thread Lewis Sobotkiewicz
Hi all,

I'm seeing some strange, undocumented behaviour when upgtrading to Django 
1.5.1. I notice that it is holding onto MySQL connections after request 
processing completes, where Django 1.4.5 disconnected after every request.

Any idea what could be happening? 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?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [ver. 1.5] Specifying custom User model (extends AbstractUser) doesn't work

2013-03-21 Thread Lewis Taylor
And this is why I learnt the names of many of those major in the Django 
community! Now if I post after them, it's mostly to say. Yes I agree.

Like I'm doing now :-)

On Wednesday, 24 October 2012 05:02:02 UTC+1, Surya Mukherjee wrote:
>
> Django's standard User class isn't sufficient for my needs so I am making 
> my own User class. As per the User Authentication doc page, I am 
> subclassing AbstractUser (not AbstractBaseUser) to add some new stuff.
>
> 
> from django.contrib.auth.models import AbstractUser
>
> class MyUser(AbstractUser):
> test = 'Hello world'
> 
>
> Pretty simple so far. In settings.py:
> 
> # Specifies SDBUser as the custom User class for Django to use
> AUTH_USER_MODEL = 'app.MyUser'
> 
>
> But when i try to syncdb, everything breaks:
>
> [root@Surya project]# manage syncdb
> CommandError: One or more models did not validate:
> app.userprofile: 'user' defines a relation with the model 'auth.User', 
> which has been swapped out. Update the relation to point at 
> settings.AUTH_USER_MODEL.
> auth.user: Model has been swapped out for 'app.SDBUser' which has not been 
> installed or is abstract.
> django_openid_auth.useropenid: 'user' defines a relation with the model 
> 'auth.User', which has been swapped out. Update the relation to point at 
> settings.AUTH_USER_MODEL.
>
> django_openid_auth is a third party OpenID library, but the first two are 
> pure Django and they're still breaking. Wat do?
>
>

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




AccountDeletion remains after expunge_deleted

2013-02-08 Thread Paton Lewis
I started my project via:

django-admin.py startproject 
--template=https://github.com/pinax/pinax-project-account/zipball/master 
myproject

One of the features provided by the account system is delayed deletion of 
accounts. When you delete an account, it isn't actually deleted. Instead, 
an AccountDeletion object is created that tracks the deletion request. When 
you run

manage.py expunge_deleted

then the AccountDeletion objects are iterated and any Account objects that 
are more than 48 hours old are deleted.

My question has to do with the AccountDeletion objects. These objects 
aren't deleted, and it looks like they remain in the database forever. Is 
this intentional? Is there another command that expunges the 
AccountDeletion objects? Or is this just a bug in the AccountDeletion class 
implementation?

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




transfer one django app to another server

2012-11-15 Thread Lewis
Hello, 

In order to transfer the app from local machine to another server. what 
should I do? Can I just copy everything or do I need to reinstall app that 
I install?

-- 
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/-/YzudnzUw9vwJ.
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.



How do you install django packages

2012-11-15 Thread Lewis
I found packages from this site 
http://www.djangopackages.com/packages/p/sorl-thumbnail/
I wonder is there any steps that you can guide me to install? it doesn't 
have to be the above packages, but I want to know the basic packages 
installation in short steps that I can follow

Thanks

-- 
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/-/9fkTmrtObeAJ.
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: accessing django

2012-10-09 Thread Lewis Satini
Thank you so much all of you and the fast response

On Tue, Oct 9, 2012 at 11:52 AM, Tom Evans <tevans...@googlemail.com> wrote:

> On Tue, Oct 9, 2012 at 4:48 PM, Lewis Satini <jubilee.le...@gmail.com>
> wrote:
> > Thank guys for helping this out.
> > One more question what is the basic step of installing the package? are
> they
> > all the same?
>
> Why don't you install a couple and see?
>
> They are normally similar, but not necessarily so.
>
> Tom
>
> --
> 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.
>
>


-- 
facebook.com/artistbean
SMS at (646) 450-6756

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



connecting to existance mysql

2012-10-09 Thread Lewis
Hello,
I have website that build in php and have the database exists, what is the 
process in using django to connect the existance mysql database? is there 
tutorial about this process?

Thanks

-- 
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/-/Hc3vvjG23m0J.
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: accessing django

2012-10-09 Thread Lewis Satini
Thank guys for helping this out.
One more question what is the basic step of installing the package? are
they all the same?

On Tue, Oct 9, 2012 at 11:45 AM, Kurtis Mullins <kurtis.mull...@gmail.com>wrote:

> Not really. You could probably use a host that might have some fancy
> control panel for doing something like that; but I'd recommend just using
> the shell. It'll make life a lot easier in the long run.
>
>
> On Tue, Oct 9, 2012 at 11:39 AM, Lewis Satini <jubilee.le...@gmail.com>wrote:
>
>> Hello,
>> I am sorry for misplace script and package. I am new to Django.
>> so everytime when I need to install Django packages. I need to do it
>> through command shell? is there any other way without going through command
>> shell?
>>
>> Thanks
>>
>>
>> On Tue, Oct 9, 2012 at 11:36 AM, Tom Evans <tevans...@googlemail.com>wrote:
>>
>>> On Tue, Oct 9, 2012 at 4:29 PM, Lewis Satini <jubilee.le...@gmail.com>
>>> wrote:
>>> > For example, there's a script I want to install and everytime, I need
>>> to
>>> > access to the command shell to install it, but in the case of php I
>>> can just
>>> > unzip and upload to the server and access through browser.
>>> > Can I do with that way? how is the process?
>>> >
>>>
>>> Django doesn't work like PHP. In PHP, each PHP file is a single
>>> "program" that is run when the web server loads that 'page'. In
>>> django, there is a single "program" that runs and communicates with
>>> the web server. There are no "Django scripts" for instance, there are
>>> Django packages you can install which add functionality to your Django
>>> "program".
>>>
>>> So no, you can't simply upload "scripts" to the web server with ftp, not
>>> easily.
>>>
>>> Cheers
>>>
>>> Tom
>>>
>>> --
>>> 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.
>>>
>>>
>>
>>
>> --
>> facebook.com/artistbean
>> SMS at (646) 450-6756
>>
>> --
>> 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.
>



-- 
facebook.com/artistbean
SMS at (646) 450-6756

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

2012-10-09 Thread Lewis Satini
For example, there's a script I want to install and everytime, I need to
access to the command shell to install it, but in the case of php I can
just unzip and upload to the server and access through browser.
Can I do with that way? how is the process?



On Tue, Oct 9, 2012 at 11:27 AM, Jonathan Baker <
jonathandavidba...@gmail.com> wrote:

> When you say "access django", exactly what do you mean?
>
>
> On Tue, Oct 9, 2012 at 9:25 AM, Lewis <jubilee.le...@gmail.com> wrote:
>
>> Hello,
>> Is it the right way to access django without going through the command
>> shell, but instead using ftp -> making new file and edit just like using
>> php?
>>
>>
>>
>> Thanks
>>
>>  --
>> 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/-/7S69wHUUPMMJ.
>> 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.
>>
>
>
>
> --
> Jonathan D. Baker
> Developer
> http://jonathandbaker.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.
>



-- 
facebook.com/artistbean
SMS at (646) 450-6756

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



accessing django

2012-10-09 Thread Lewis
Hello,
Is it the right way to access django without going through the command 
shell, but instead using ftp -> making new file and edit just like using 
php?



Thanks

-- 
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/-/7S69wHUUPMMJ.
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.



about installing django

2012-10-07 Thread Lewis Satini
Hello,
I am new here.
I am thinking to start my django study again. I start before, but stuck
with some issues.
1. Is there a way to install django and the plug-ins through ftp without
going thru any command shell? after python was installed
2. I want to start an image portal. Is there any suggestion for plug-ins?
something like flickr and also you able to market them.
3. Is there anyone there volounteer to help while building my project and
application? so that I can just direct my question to you.

I am working for improvement of this site at http://crossmap.com. We want
to change to focus on background only and recoding using django. It was on
PHP  and We want to keep the database and adding some additional feature.
We need your input and direction of how we should go

Thanks,
Lewis

-- 
facebook.com/artistbean
SMS at (646) 450-6756

-- 
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-ical - iCalendar generation

2012-05-06 Thread Ian Lewis
Hey all,

I just released a simple library for generating iCalendar feeds based
on the syndication framework. For folks familiar
with the syndication framework and how it works you should be able to
get up and running with django-ical
pretty quickly. Most people seem to be doing iCalendar feeds and
exports in a one off manner and I hoped
with this project to create something a kind of defacto app that
Django folks could use for iCalendar.

It's pretty simple currently so if anyone has any feature requests you
can create issues or send me pull
requests at the link below.

pypi: django-ical
Code: https://bitbucket.org/IanLewis/django-ical/overview
Docs: http://readthedocs.org/docs/django-ics/en/latest/

Thanks,
Ian

--
Ian

http://www.ianlewis.org/

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



Help - ImportError: No module named django.core.management

2012-04-17 Thread Michael Lewis
Hi everyone,

I've seen a lot of info regarding this error, but I can't seem to find
anything that solves my problem. I am starting my first project - "Writing
your first Django app, part 1". I've downloaded Django and can see that
it's installed by running "import django". I then move on to this step to
run "django-admin.py startproject mysite". That runs fine and creates
"mysite" directory.

My problem is when I run "python manage.py runserver", I get this error
"ImportError: No module named django.core.management". The error makes it
seem like the module doesn't exist. However, when I go to my python
interactive shell, I can run "from django.core.management import
execute_from_command_line" and I don't get any errors.

Can you help me out?

-- 
Michael J. Lewis
mjole...@gmail.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.



Re: Storing many to many fields

2012-03-18 Thread Ian Lewis
Hi,

facebook_session.books_name is a RelatedManager on the Books model class.

You need to add books to the list with the add() method.

book = Books(book_name="name", book_category="category")
book.save()
facebook_session.books_name.add(book)

See:
https://docs.djangoproject.com/en/1.3/ref/models/relations/#django.db.models.fields.related.RelatedManager.add

On Sun, Mar 18, 2012 at 4:41 PM, dummyman dummyman  wrote:
> Hi
>
> I ve to models
>
> class FacebookSession(models.Model):
>
>     access_token = models.CharField(max_length = 250,unique=True)
>     expires = models.IntegerField(null=True)
>
>     user = models.ForeignKey(User, null=True)
>     uid = models.BigIntegerField(unique=True, null=True)
>
>     birthday = models.DateField(blank=True,null=True)
>     name = models.CharField(max_length=100,blank=True,null=True)
>
>     books_name = models.ManyToManyField(Books,blank=True,null=True)
>
>
> lass Books(models.Model):
>
>      book_name = models.CharField(max_length=100)
>      book_category = models.CharField(max_length=100,blank=True,null=True)
>
>      def __unicode__(self):
>          return self.book_name
>
>
>
> now i want to have a list of books in a list called books_list
>
> How to store those in the database
>
> I understood how to store basic_fields
>
>
> database_obj = FacebookSession.objects.get(uid=123444)
> database_obj.name="ss"
>
> database_obj.save()
>
> How do i do the same thing for books_name which is a many to many field in
> FacebookSession class
>
> --
> 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.



-- 
Ian

http://www.ianlewis.org/

-- 
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 structure and basic flow

2012-03-15 Thread Lewis
I am confused that different tutorial gives different method of doing
things. I want to know how to setup basic cms site,
what folder should I create, sometime people create apps, sometimes
they don't.

How do I put this in order?
1.url
2. view
3.model
4. template
5. admin
6. settings

from the tutorial I see,
http://www.youtube.com/watch?v=8bnyOb72p_4=BFa=PL385A53B00B8B158E=plcp

Is that the way to structure the project?

is there anyone can help and guide me. just want to create people to
input on admin and output on the template?

-- 
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: Django and social network

2012-02-23 Thread Lewis Satini
The only problem with pinax that I dont like is to setup the virtual
environment that make me so headache

The site that you ask me to check out. It's a very good for me. I look
after that site. 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.



Re: Django and social network

2012-02-22 Thread Lewis Satini
and I can only install basic, I had problem getting the advance install

On Wed, Feb 22, 2012 at 11:57 AM, Lewis Satini <jubilee.le...@gmail.com>wrote:

> How much experience do you have on pinax. Did you implemented before? do
> you have the sample site, that I might able to look at? it is difficult to
> install, because it have some requirement before you install it.
>
>
> On Wed, Feb 22, 2012 at 11:04 AM, Alec Taylor <alec.tayl...@gmail.com>wrote:
>
>> Pinax
>>
>> http://pinaxproject.com/
>>
>> On Thu, Feb 23, 2012 at 1:50 AM, Lewis <jubilee.le...@gmail.com> wrote:
>> > I am new in Django. I know it is a good platform.
>> > I want to know if there's any plug-ins or script that do social
>> > networking. I research on Pinax, but it seem very difficult to set it
>> > up. These are the feature that I want to implement:
>> > 1. Profile system that link to their facebook or google profile that
>> > they have.
>> > 2. Login with gmail account or facebook account
>> > 3. able to store they login and password to local database
>> > 4. able to do rating and comments
>> >
>> > Can someone suggest anything?
>> >
>> > Thanks for your help
>> >
>> > --
>> > 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.
>>
>>
>
>
> --
>
>
> Artistbean.com <http://mobi.artistbean.com>
> SMS at (646) 450-6756
>
>
>


-- 


Artistbean.com <http://mobi.artistbean.com>
SMS at (646) 450-6756

-- 
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: Django and social network

2012-02-22 Thread Lewis Satini
How much experience do you have on pinax. Did you implemented before? do
you have the sample site, that I might able to look at? it is difficult to
install, because it have some requirement before you install it.

On Wed, Feb 22, 2012 at 11:04 AM, Alec Taylor <alec.tayl...@gmail.com>wrote:

> Pinax
>
> http://pinaxproject.com/
>
> On Thu, Feb 23, 2012 at 1:50 AM, Lewis <jubilee.le...@gmail.com> wrote:
> > I am new in Django. I know it is a good platform.
> > I want to know if there's any plug-ins or script that do social
> > networking. I research on Pinax, but it seem very difficult to set it
> > up. These are the feature that I want to implement:
> > 1. Profile system that link to their facebook or google profile that
> > they have.
> > 2. Login with gmail account or facebook account
> > 3. able to store they login and password to local database
> > 4. able to do rating and comments
> >
> > Can someone suggest anything?
> >
> > Thanks for your help
> >
> > --
> > 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.
>
>


-- 


Artistbean.com <http://mobi.artistbean.com>
SMS at (646) 450-6756

-- 
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 and social network

2012-02-22 Thread Lewis
I am new in Django. I know it is a good platform.
I want to know if there's any plug-ins or script that do social
networking. I research on Pinax, but it seem very difficult to set it
up. These are the feature that I want to implement:
1. Profile system that link to their facebook or google profile that
they have.
2. Login with gmail account or facebook account
3. able to store they login and password to local database
4. able to do rating and comments

Can someone suggest anything?

Thanks for your help

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



Using the same storage backend for media and static files.

2011-11-05 Thread Ian Lewis
Hi,

I'm a developer for django-storages who maintains the AWS S3 boto
backend. I get a lot of requests and questions about how to use s3boto
as a backend for both media and for the staticfiles contrib app but
with different settings.

The issue is that the storage backends are created without any keyword
arguments in Django and the settings that the backend supports apply
globally. This makes it impossible to have media and static files
stored in different buckets for instance. I'm curious what the authors
of Django and staticfiles had in mind for this kind of situation? What
is the recommended thing to do?

Currently I often get pull requests for hack changes to s3boto to
allow users to set up multiple backends using just settings. I would
like to allow users to do something like that but I'm curious if there
is a recommended way for users to set up multiple backends using the
same class but with different settings.

-- 
Ian

http://www.ianlewis.org/

-- 
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: Django form(s) for intermediary models

2011-01-26 Thread Ian Lewis
Hi,

What you want to do here is use a Django "Formset" which contains your
ModelForms. Since you want to show one form per person
regardless of whether they are a member or not we can't use the
modelformset_factory() and will have to do some manipulation of the
initial data using the formset_factory() function instead. I haven't
actually run and tested the code below (user beware) but you'll need
to do something similar in order to do what you're describing.

See:
http://docs.djangoproject.com/en/dev/topics/forms/formsets/
http://docs.djangoproject.com/en/dev/topics/forms/modelforms/#model-formsets

Using the Membership form (I called it MembershipForm) from the previous poster:

from django.forms.models import formset_factory

def myview(request, group_id):
group = Group.objects.get(pk=group_id)

MembershipFormset = formset_factory(form=MembershipForm, extra=0)
if request.method == 'POST':
formset = MembershipFormset(request.POST)
if formset.is_valid():
# since the formset itself isn't a ModelFormset
# we need to loop over the individual ModelForms
# and save() them.
for form in formset.forms:
form.save()
# Do something
else:

# Make a person_id to membership mapping.
memberships = dict(map(lambda m: (m.person_id, m),
groups.membership_set.all()))
initial = {}
We need to order by pk (or some other field) here so that the
form indexes match.
for i,person in enumerate(Person.objects.all().order_by("pk")):
prefix = form.get_default_prefix()
membership = memberships.get(person.pk, None)

# Here we create the initial data.
# Add data for the each initialized form here.
# initial data is needed for every person in order
# to set the number of forms.
initial.update({
'%s-%s-person' % (prefix, i): person if membership else None,
'%s-%s-date_joined' % (prefix, i):
membership.date_joined if membership else None,
})
formset = MembershipFormset(initial=initial)

# do something


On Wed, Jan 26, 2011 at 8:46 AM, aa56280  wrote:
>> In your case it would become something like:
>>
>> class Membership(ModelForm):
>>         class Meta:
>>                 model = Membership
>>                 fields = ('person', 'date_joined')
>>                 widgets = {
>>                         'person' : CheckBox(),
>>                         'date_joined': TextInput(),
>>                 }
>
> I need a form for each person though because a Group could have many
> members.
>
> --
> 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.
>
>



-- 
Ian

http://www.ianlewis.org/

-- 
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: Django 1.3 alpha 1 released

2010-11-11 Thread Ian Lewis
2010/11/12 Łukasz Rekucki 

> On 12 November 2010 01:16, hcarvalhoalves 
> wrote:
> > What about having an official 1.3 feedback thread at django-developers
> > list? ;)
> >
> > I'm liking the pack of small improvements coming in this release, and
> > timing is very good, well done. I must say I'm less than happy with
> > the view classes though. Is the API on it frozen already?
>
> IMHO no, but it reached a point where the only way to make it better
> was to have it released to the wild and see how people use it. I'm
> personally interested in all and any feedback on the class based
> views. There's a few thing I would like to improve myself, but just
> didn't have the time to sit down and do the work.


I'm not sure what is meant by improve and or what you would like to improve
specifically but,
it was my impression that this conversation had been played out and that the
API was pretty much decided.

-- 
Ian

http://www.ianlewis.org/

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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 password reset problem

2010-10-06 Thread Ian Lewis
I just took a cursory look at this but did you make sure to add
something like the following to your urlpatterns in urls.py?

urlpatterns=patterns('',
...
(r'^accounts/', include('django.contrib.auth.urls')),
...
)

On Thu, Oct 7, 2010 at 1:29 AM, Joel Klabo  wrote:
> So now I am redirecting to the named url in the URL conf. That is now
> giving me the error: The included urlconf registration.auth_urls
> doesn't have any patterns in it ... http://dpaste.org/OOw5/ any ideas
> would be greatly appreciated
>
> On Oct 5, 5:56 pm, Joel Klabo  wrote:
>> Ok, so I'm pretty sure this has to do with the fact that the
>> post_reset_redirect argument defaults to the
>> django.contrib.auth.views.password_reset_done if no
>> post_reset_redirect is passed to the view. I am using django-
>> registration and it seems like there would be a better way to deal
>> with this... There is something I'm missing. If anyone has used this
>> and gotten it to work I would be grateful to hear about it. All the
>> other parts of the registration system work which makes me think this
>> has something to do with the fact that it is reverting back to the
>> django.contrib views and now using the ones that come with django-
>> registration... Here is the view where the error first pops up, this
>> is where post_reset_redirect is as well:http://dpaste.org/gatU/
>>
>> Thanks for your time
>>
>> On Oct 5, 1:56 pm, Steve Holden  wrote:
>>
>>
>>
>> > On 10/5/2010 4:45 PM,JoelKlabowrote:> Need to bump this, sorry. I don't 
>> > get it.
>>
>> > > On Oct 5, 1:04 pm,JoelKlabo wrote:
>> > >> This is the error and location of the 
>> > >> problem:http://gist.github.com/612210,
>> > >> I can't see what it's looking for. It seems like I could hard code the
>> > >> arguments it wants into the reverse() but that doesn't seem like the
>> > >> correct way to do it. Any advice?
>>
>> > I can quite see how 41 minutes would appear to be an infinity to someone
>> > who is wanting the answer to a problem. Please remember, though, that
>> > people who post on this list aren't paid to do so, and mostly have
>> > full-time jobs.
>>
>> > So a little patience will make it more likely people will help you.
>>
>> > regards
>> >  Steve
>> > --
>> > DjangoCon US 2010 September 7-9http://djangocon.us/
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To post to this group, send email to django-us...@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.
>
>



-- 
Ian

http://www.ianlewis.org/

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: Separating application media from project media

2010-10-01 Thread Ian Lewis
> FWIW, even for a more canonical "integrated" website / webapp composed
> of distinct django apps, "assets" (app specific css, js, images and
> whatnot) management can sometimes be a pain. My own solution so far is
> to keep all app-specific static stuff in a /medias/ subir of
> the app and manually symlink this to the project's /static dir, but
> I'd really enjoy a better solution.

In the past I have used django-staticfiles to manage static media for
various apps. django-staticfiles searches your installed apps for
media directories and copies them to a site_media directory so that
you can serve them from a web server. It also allows you to manage
uploaded media separately from static files.

http://pypi.python.org/pypi/django-staticfiles/

-- 
Ian

http://www.ianlewis.org/

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: How to debug ORM filter stacking?

2010-09-25 Thread Ian Lewis
Are you sure you are saving the new QuerySet that gets created by the
filter? I'm guessing you are doing something like:

qs = MyModel.objects.filter(field1="somevalue")
if condition:
qs.filter("someothervalue")

What you need to do is save the value of the second filter() call.

qs = MyModel.objects.filter(field1="somevalue")
if condition:
qs = qs.filter("someothervalue")

filter() returns a new queryset object rather than modifying the
queryset in place.

I usually debug SQL problems by using the
http://github.com/robhudson/django-debug-toolbar or pdb. With pdb you
can put import pdb;pdb.set_trace() where you would like pdb to stop
and it will allow you to debug from there. Simply showing the results
of the queryset usually gives some clues as to what the problem is. In
pdb you can see what sql will get run by running

(Pdb) print queryset.query

pdb's commands are explained here:

http://docs.python.org/library/pdb.html#debugger-commands


On Sat, Sep 25, 2010 at 1:17 PM, ydjango  wrote:
> I am stacking filters on queryset. For some reason the second filter
> in stack is not applying and it is not giving any error either. Any
> way to debug what is going on?
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To post to this group, send email to django-us...@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.
>
>


-- 
Ian

http://www.ianlewis.org/

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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 1.3

2010-08-16 Thread Ian Lewis
Kenneth,

>From my experience, South works well with mysql. However because
sqlite doesn't provide support for some schema alterations such as
dropping columns, it is as you said, pretty touchy.

Ian

On Mon, Aug 16, 2010 at 2:52 PM, Kenneth Gonsalves  wrote:
> On Mon, 2010-08-16 at 10:28 +1000, Lachlan Musicman wrote:
>> As I understand it the Django devs have requested it's integration,
>> and the
>> South dev has responded "I would like the South code to be cleaner and
>> smarter". I could be wrong about this.
>
> from what I see on IRC, it does not play well with mysql and sqllite - I
> have never used it.
> --
> regards
> Kenneth Gonsalves
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To post to this group, send email to django-us...@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-us...@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: create table

2010-07-19 Thread Ian Lewis
Hi,

On Tue, Jul 20, 2010 at 11:42 AM, pengbo xue  wrote:
> how can I create tables and foreignkey as below information.
>
> create a user object "models.User" and include kewords like this,
>
> username: modify the max_length of username to 32,default is 30.
> email:
> password:
> is_staff:   false
> is_active:  true
> is_superuser:  false

It sounds like you are getting at but there isn't really a good way to
change the length of the username field in contrib.auth without
modifying Django's source code or implementing your own auth layer.

As for the is_staff, is_active, is_superuser fields, do you want to
create data in the table? or do you want to set the default value of
the fields? It looks like the default values are the same as what you
have written here.

If you want to create initial data you can do that using fixtures.
See: http://docs.djangoproject.com/en/dev/howto/initial-data/

> create object "profile" for storaging other info of user:
>
> nickname:CharField
> birthday:DateField
> Zone:reliaion zone table
> work:relation work table
> degree:relation degree table
> interest:TextField
> agree_open_info:BooleanField

For this you'll need to create a model for your user profile and
specify it in the AUTH_PROFILE_MODULE setting. You can then access a
user's profile using the get_profile() method on the user.

See: 
http://docs.djangoproject.com/en/dev/topics/auth/#storing-additional-information-about-users

Ian


-- 
===
株式会社ビープラウド  イアン・ルイス
〒150-0021
東京都渋谷区恵比寿西2-3-2 NSビル6階
email: ianmle...@beproud.jp
TEL:03-6416-9836
FAX:03-6416-9837
http://www.beproud.jp/
===

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: How to pass a raw ORDER_BY command or function call to a results query object?

2010-06-17 Thread Ian Lewis
In this case you want to use extra(). Assuming jobs is a QuerySet or
Manager instance:

jobs = jobs.extra(select={greatest_time': 'GREATEST(startTime, queueTime)'})
jobs = jobs.extra(order_by=['-greatest_time'])

On Thursday, June 17, 2010, Kyle  wrote:
> Without any filtering, I can execute the following SQL query to get my
> ordered data:
>SELECT * from EXECUTION_JOB ORDER BY GREATEST(startTime, queueTime)
> DESC;
>
> But in Django, it seems like the order_by only likes passing of field
> names, not a function call.
> Is there a way to have it bass a raw ORDER_BY value to the query?
>
> I am getting my filtered query in a variable called "jobs"
> I tried calling
> jobs.order_by('GREATEST(startTime,queueTime)')
> but this fails due to:
>FieldError: Invalid order_by arguments:
> ['GREATEST(startTime,queueTime)']
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To post to this group, send email to django-us...@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.
>
>

-- 
===
株式会社ビープラウド  イアン・ルイス
〒150-0021
東京都渋谷区恵比寿西2-3-2 NSビル6階
email: ianmle...@beproud.jp
TEL:03-6416-9836
FAX:03-6416-9837
http://www.beproud.jp/
===

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: Custom Form in a ModelFormset_Factory?

2010-05-18 Thread Ian Lewis
I'm pretty sure that modelformset_factory is not documented.

2010/5/19 Michael Davis <davis.j.mich...@gmail.com>:
> Thanks! I found that by looking at the source shortly after I posted
> the question. I'm surprised I didn't stumble across that option in the
> documentation. Do you have a link to any documentation that indicates
> this (and other features) is an option?
>
> On May 18, 1:10 am, Ian Lewis <ianmle...@gmail.com> wrote:
>> Pass the form class to modelformset_factory() in the form argument.
>> The factory will then use the AuthorForm class as the base form class
>> when it creates the modelform class for the formset.
>>
>> modelFormset = modelformset_factory(Author, form=AuthorForm)
>>
>> On Tue, May 18, 2010 at 7:08 AM, Michael Davis
>>
>>
>>
>> <davis.j.mich...@gmail.com> wrote:
>>
>> > I am new to Django and am trying to get a custom modelForm to work in
>> > a ModelFormset_factory. For example:
>>
>> > # in models.py
>> > class Author(models.Model):
>> >name = models.CharField()
>> >address = models.CharField()
>> >phone = models.CharField()
>>
>> > class AuthorForm(ModelForm):
>> >class Meta:
>> >model = Author
>>
>> > # in views.py
>> > def authorForm(request):
>> >modelFormset = modelformset_factory(Author)
>> >items = Author.objects.all()
>> >formsetInstance = modelFormset(queryset=items)
>> >return render_to_response('blah',locals())
>>
>> > The above code works fine, but I'd like to be able to tweak the
>> > default presentation of the AuthorForm and use that in the
>> > formset_factory. Is there any way to do that through the AuthorForm
>> > class above? If not is there another nearly easy way?
>>
>> > Thanks
>>
>> > Mike
>>
>> > --
>> > You received this message because you are subscribed to the Google Groups 
>> > "Django users" group.
>> > To post to this group, send email to django-us...@googlegroups.com.
>> > To unsubscribe from this group, send email to 
>> > django-users+unsubscr...@googlegroups.com.
>> > For more options, visit this group 
>> > athttp://groups.google.com/group/django-users?hl=en.
>>
>> --
>> ===
>> 株式会社ビープラウド  イアン・ルイス
>> 〒150-0021
>> 東京都渋谷区恵比寿西2-3-2 NSビル6階
>> email: ianmle...@beproud.jp
>> TEL:03-6416-9836
>> FAX:03-6416-9837http://www.beproud.jp/
>> ===
>>
>> --
>> You received this message because you are subscribed to the Google Groups 
>> "Django users" group.
>> To post to this group, send email to django-us...@googlegroups.com.
>> To unsubscribe from this group, send email to 
>> django-users+unsubscr...@googlegroups.com.
>> For more options, visit this group 
>> athttp://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-us...@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.
>
>



-- 
===
株式会社ビープラウド  イアン・ルイス
〒150-0021
東京都渋谷区恵比寿西2-3-2 NSビル6階
email: ianmle...@beproud.jp
TEL:03-6416-9836
FAX:03-6416-9837
http://www.beproud.jp/
===

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: Challenge with Annotate

2010-05-18 Thread Ian Lewis
Roland,

Shooting a bit in the dark but how about:

...
select = {
'days_in_stock': "'%s' - transactie_datum_inkomend + 1" %
(given_date.isoformat()),
'avg_days_instock': 'AVG(days_in_stock)',
})
...
qs.annotate(Count('manufacturer'))
...

Would that get you the group by and average field you were looking for?

If not it might be easier to just write what you want as custom SQL.

Ian

On Tue, May 18, 2010 at 10:51 PM, Roland van Laar <rol...@micite.net> wrote:
> On 05/18/2010 03:43 PM, Ian Lewis wrote:
>> Roland,
>>
>> Instead of using annotate, could you just add the avg_days_instock
>> field as another key in the select argument to extra?
>>
>
> Well how would I do that?
> Since I want the avg_days_instock calculated on a 'group_by' basis.
> To me it seems that I need to do a Count and a avg_days_instock at the
> same time?
>
> Roland
>
>> Ian
>>
>> On Tue, May 18, 2010 at 9:03 PM, Roland van Laar <rol...@micite.net> wrote:
>>
>>> Hello,
>>>
>>> Question: How do I calculate the Average of a calculated field.
>>>
>>> My (simplified) models.py:
>>>
>>> Manufacturer(models.Model):
>>>name = models.CharField(length=100)
>>>
>>> Product(models.Model):
>>>name = models.CharField(length=100)
>>>
>>> Items(models.Model):
>>>manufacturer = models.Foreignkey(Manufacturer)
>>>product = models.ForeignKey(Product)
>>>bought_date = models.DateField()
>>>sold_date = models.DateField(null=True, blank=True)
>>>
>>> On these models I want to calculate the number of days an item was in stock
>>> on a given date:
>>>
>>> qs = Items.objects.all().extra(select= \
>>>{'days_in_stock': "'%s' - transactie_datum_inkomend + 1" %
>>> (given_date.isoformat())})
>>>
>>> And then I want to know the average number of days all the items selected on
>>> manufacturer and product.
>>>
>>> qs.values('manufacturer', 'product)
>>> qs.annotate(Count('manufacturer'), avg_days_instock=Avg('days_in_stock'))
>>>
>>> The annotate fails because 'days_in_stock' is not a valid field:
>>> FieldError: Cannot resolve keyword 'days_in_stock' into field. Choices are:
>>> manufacturer, product, bought_date, sold_date
>>>
>>> How can I calculate the average of the days_in_stock?
>>>
>>> Thanks,
>>>
>>> Roland van Laar
>>>
>>>
>>>
>>> --
>>> You received this message because you are subscribed to the Google Groups
>>> "Django users" group.
>>> To post to this group, send email to django-us...@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-us...@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.
>
>



-- 
===
株式会社ビープラウド  イアン・ルイス
〒150-0021
東京都渋谷区恵比寿西2-3-2 NSビル6階
email: ianmle...@beproud.jp
TEL:03-6416-9836
FAX:03-6416-9837
http://www.beproud.jp/
===

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: Challenge with Annotate

2010-05-18 Thread Ian Lewis
Roland,

Instead of using annotate, could you just add the avg_days_instock
field as another key in the select argument to extra?

Ian

On Tue, May 18, 2010 at 9:03 PM, Roland van Laar  wrote:
> Hello,
>
> Question: How do I calculate the Average of a calculated field.
>
> My (simplified) models.py:
>
> Manufacturer(models.Model):
>name = models.CharField(length=100)
>
> Product(models.Model):
>name = models.CharField(length=100)
>
> Items(models.Model):
>manufacturer = models.Foreignkey(Manufacturer)
>product = models.ForeignKey(Product)
>bought_date = models.DateField()
>sold_date = models.DateField(null=True, blank=True)
>
> On these models I want to calculate the number of days an item was in stock
> on a given date:
>
> qs = Items.objects.all().extra(select= \
>{'days_in_stock': "'%s' - transactie_datum_inkomend + 1" %
> (given_date.isoformat())})
>
> And then I want to know the average number of days all the items selected on
> manufacturer and product.
>
> qs.values('manufacturer', 'product)
> qs.annotate(Count('manufacturer'), avg_days_instock=Avg('days_in_stock'))
>
> The annotate fails because 'days_in_stock' is not a valid field:
> FieldError: Cannot resolve keyword 'days_in_stock' into field. Choices are:
> manufacturer, product, bought_date, sold_date
>
> How can I calculate the average of the days_in_stock?
>
> Thanks,
>
> Roland van Laar
>
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-us...@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.
>
>



-- 
===
株式会社ビープラウド  イアン・ルイス
〒150-0021
東京都渋谷区恵比寿西2-3-2 NSビル6階
email: ianmle...@beproud.jp
TEL:03-6416-9836
FAX:03-6416-9837
http://www.beproud.jp/
===

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: Extend User

2010-05-18 Thread Ian Lewis
If you don't need the name, surname etc. then don't use them. They are
optional fields. You can also implement a custom form or view when the
user registers that can make sure the email has not been previously
registered.

If you need to add additional fields then you should create a custom
profile model and set the model in AUTH_PROFILE_MODULE. That will
allow you to get the information from the user via the get_profile()
method.

See: http://docs.djangoproject.com/en/dev/topics/auth/#auth-profiles

2010/5/18 Alexandre González :
> Hi everybody!
> I need a User model with normal attributes inherit from models.User, but I
> need some differences:
>
> I dont' need name, surname and another attributes
> I need that email are unique between different Users
>
> Can I inherit and use most of models.User? Or I need to create a new class
> and don't benefit from Auth module?
> Thanks!
> Álex González
> --
> Please, don't send me files with extensions: .doc, .docx, .xls, .xlsx, .ppt
> and/or .pptx
> http://mirblu.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-us...@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.
>



-- 
===
株式会社ビープラウド  イアン・ルイス
〒150-0021
東京都渋谷区恵比寿西2-3-2 NSビル6階
email: ianmle...@beproud.jp
TEL:03-6416-9836
FAX:03-6416-9837
http://www.beproud.jp/
===

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: Error was: cannot import name validators

2010-05-18 Thread Ian Lewis
validators is a module that was added in Django 1.2.

You probably have the wrong version of Django installed or are using
Django 1.1 with a django application that requires Django 1.2.

On Tue, May 18, 2010 at 6:01 PM, Pankaj Singh
 wrote:
> pan...@pankaj-laptop:~/django_projects/pankaj$ python
> Python 2.6.5 (r265:79063, Apr 16 2010, 13:09:56)
> [GCC 4.4.3] on linux2
> Type "help", "copyright", "credits" or "license" for more information.
 from django.core import validators
> Traceback (most recent call last):
>   File "", line 1, in 
> ImportError: cannot import name validators

>
> Validators is really missing .. don't know how to install .. help needed
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-us...@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.
>



-- 
===
株式会社ビープラウド  イアン・ルイス
〒150-0021
東京都渋谷区恵比寿西2-3-2 NSビル6階
email: ianmle...@beproud.jp
TEL:03-6416-9836
FAX:03-6416-9837
http://www.beproud.jp/
===

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: Custom Form in a ModelFormset_Factory?

2010-05-18 Thread Ian Lewis
Pass the form class to modelformset_factory() in the form argument.
The factory will then use the AuthorForm class as the base form class
when it creates the modelform class for the formset.

modelFormset = modelformset_factory(Author, form=AuthorForm)

On Tue, May 18, 2010 at 7:08 AM, Michael Davis
 wrote:
>
> I am new to Django and am trying to get a custom modelForm to work in
> a ModelFormset_factory. For example:
>
> # in models.py
> class Author(models.Model):
>name = models.CharField()
>address = models.CharField()
>phone = models.CharField()
>
> class AuthorForm(ModelForm):
>class Meta:
>model = Author
>
> # in views.py
> def authorForm(request):
>modelFormset = modelformset_factory(Author)
>items = Author.objects.all()
>formsetInstance = modelFormset(queryset=items)
>return render_to_response('blah',locals())
>
> The above code works fine, but I'd like to be able to tweak the
> default presentation of the AuthorForm and use that in the
> formset_factory. Is there any way to do that through the AuthorForm
> class above? If not is there another nearly easy way?
>
> Thanks
>
> Mike
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To post to this group, send email to django-us...@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.
>
>



-- 
===
株式会社ビープラウド  イアン・ルイス
〒150-0021
東京都渋谷区恵比寿西2-3-2 NSビル6階
email: ianmle...@beproud.jp
TEL:03-6416-9836
FAX:03-6416-9837
http://www.beproud.jp/
===

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: Retrieving an ID from a posted form

2010-04-22 Thread Ian Lewis
Nick,

Because you won't get an id for your newly created object before you
save it you'll need to send the email after you save the form. I'm
assuming that ArtistFormFinal is a ModelForm but you can get the id
using something like the following:

myobj = form.save()
send_mail(subject, "Your id is %d!" % myobj.id, email_address, recipients)

I hope that's what you were looking for.

Ian

On Thu, Apr 22, 2010 at 11:39 PM, Nick  wrote:
> I am working on a form process with multiple levels of submission. The
> first is a front facing form with a general set of questions that are
> to be followed up by someone after the form is submitted (the form
> submits and entry to the DB).  To cut down on the amount of hunting
> that those who will be reviewing the forms have to do I'd like to be
> able to retrieve the ID for the newly created DB entry and attach it
> to a url that points directly to that entry in the django admin.
>
> I have the email logic set up so that the form submits all of the
> information via email to an individual. In the email is the link to
> the admin. So far it just goes to a full list of entries:
>
> ex. http://mydjango.site.com/admin/projects/app/model_name/ID
>
> I can easily send everything up to the ID. How do i retrieve the ID
> from the submitted form. Since this is adding an entry to the DB it
> has to be creating an ID somewhere.  Here is my view:
>
> def short_form(request):
>if request.method == 'POST':
>form = ArtistFormFinal(request.POST, request.FILES)
>if form.is_valid():
>name = form.cleaned_data['name']
>year_created = form.cleaned_data['year_created']
>home_city = form.cleaned_data['home_city']
>home_state = form.cleaned_data['home_state']
>genre = form.cleaned_data['genre']
>email_address = form.cleaned_data['email_address']
>phone_number = form.cleaned_data['phone_number']
>website = form.cleaned_data['website']
>audio = form.cleaned_data['audio_file']
>subject = 'Static artists submission from %s' % (name)
>message = render_to_string('static/short_email.txt', {
>'name': name,
>'year_created': year_created,
>'home_city': home_city,
>'genre': genre,
>'home_state': home_state,
>'email_address': email_address,
>'phone_number': phone_number,
>'website': website,
>'audio': audio
>})
>recipients = ['ntankers...@opubco.com',
> 'crobi...@opubco.com']
>send_mail(subject, message, email_address, recipients,
> fail_silently=False)
>form.save()
>return HttpResponseRedirect('thanks')
>else:
>form = ArtistFormFinal()
>return render_to_response('static/artist_short.html',
> {'form':form})
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To post to this group, send email to django-us...@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.
>
>



-- 
===
株式会社ビープラウド  イアン・ルイス
〒150-0021
東京都渋谷区恵比寿西2-3-2 NSビル6階
email: ianmle...@beproud.jp
TEL:03-6416-9836
FAX:03-6416-9837
http://www.beproud.jp/
===

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: Getting error in Cloudwatch EC2 BOTO

2010-04-15 Thread Ian Lewis
Nitin,

You will need to provide more information about the error you are getting
and in what circumstances it is occurring if you would like someone to help
you.

Ian

On Thu, Apr 15, 2010 at 2:10 PM, nitin shrimali wrote:

> Hello guys
> I am having error when performing Cloudwatch in Django. But if I execute it
> on Python Shell it is running smoothly. Not getting the reason why this is
> happening. Any one who get this sort of error. Please help me out.
>
> Thanks
> Nitin
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-us...@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.
>



-- 
===
株式会社ビープラウド  イアン・ルイス
〒150-0021
東京都渋谷区恵比寿西2-3-2 NSビル6階
email: ianmle...@beproud.jp
TEL:03-6416-9836
FAX:03-6416-9837
http://www.beproud.jp/
===

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: save_model admin

2010-04-13 Thread Ian Lewis
If you are talking about Django's admin couldn't you implement it by
overriding save_model as your subject seems to suggest?

http://docs.djangoproject.com/en/dev/ref/contrib/admin/#django.contrib.admin.ModelAdmin.save_model

If
you are talking about just a regular form then you could pass the request to
the form and then validate based on that. Something like the following:

from django import forms

class PersonForm(forms.ModelForm):
def __init__(self, request, *args, **kwargs):
super(PersonForm, self).__init__(*args, **kwargs)
self.request = request

def clean(self):
if self.instance.user != self.request.user:
raise forms.ValidationError("You can't edit someone else's
Person record!!")
return super(PersonForm, self).clean()

class Meta:
model = Person
exclude = ('user',)

On Tue, Apr 13, 2010 at 6:06 PM, Alfredo Alessandrini
wrote:

> Hi,
>
> I've this model:
>
> class Person(models.Model):
>user = models.ForeignKey(User)
>courses = models.TextField(blank=True, null=True)
>research_statement = models.TextField(blank=True, null=True)
>..
>
>
> I will let to save the form only when the user is making changes its
> model (user=request.user).
>
>
> Thanks,
>
> Alfredo
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-us...@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.
>
>


-- 
===
株式会社ビープラウド  イアン・ルイス
〒150-0021
東京都渋谷区恵比寿西2-3-2 NSビル6階
email: ianmle...@beproud.jp
TEL:03-6416-9836
FAX:03-6416-9837
http://www.beproud.jp/
===

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: many to many based upon common field

2010-04-13 Thread Ian Lewis
wizard,

Would it make sense to use the intermediate table to hold the field?

Using the stack overflow example:

class Edi856(models.Model):
pass

class Order(models.Model):
edi = models.ManyToManyField(Edi856, through='PoNum')
def in_edi(self):
'''Has the edi been processed?'''
return self.edi.all().count()

class PoNum(models.Model):
order = models.ForeignKey(Order)
edi = models.ForeignKey(Edi856)
po_num = models.CharField(max_length=90, db_index=True )


The save route also sounds ok, a pre_save signal could also work.


On Wed, Apr 14, 2010 at 5:19 AM, wizard  wrote:

> This is sort of an extension of my post from stackoverflow.
>
> http://stackoverflow.com/questions/2632573/how-do-i-relate-two-models-tables-in-django-based-on-non-primary-non-unique-keys
>
> The gist is I have two tables with a common field and I would like to
> relate two models with a many to many based off of this field.
>
> As far as I can tell I have to build the relations manually. I was
> thinking of overriding the save method in both models to query the
> other table and rebuild the relation on save.
>
> Does this sound rational?
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-us...@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.
>
>


-- 
===
株式会社ビープラウド  イアン・ルイス
〒150-0021
東京都渋谷区恵比寿西2-3-2 NSビル6階
email: ianmle...@beproud.jp
TEL:03-6416-9836
FAX:03-6416-9837
http://www.beproud.jp/
===

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: CSRF and Caching

2010-04-13 Thread Ian Lewis
There is the possibility that the token could be cached in html if you are
using the cache template tag. Otherwise the token shouldn't be cached.

On Wed, Apr 14, 2010 at 3:31 AM, scoopseven  wrote:

> Is there any possibility that CSRF tokens could be cached by memcache
> causing chaos on a django site?
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-us...@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.
>
>


-- 
===
株式会社ビープラウド  イアン・ルイス
〒150-0021
東京都渋谷区恵比寿西2-3-2 NSビル6階
email: ianmle...@beproud.jp
TEL:03-6416-9836
FAX:03-6416-9837
http://www.beproud.jp/
===

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: urllib2: post request to a django form

2010-04-13 Thread Ian Lewis
Try running the server locally using the devserver and posting to it. You
can invoke python's debugger when the post is recieved on the server side by
adding some code like the following:

import pdb;pdb.set_trace()

On Wed, Apr 14, 2010 at 7:30 AM, bfrederi  wrote:

> I'm attempting to re-route user posts from one django instance to
> another. I'm doing this by receiving a user's post request, and then
> sending the post to another django instance as a post request (sorry
> if this is confusing).
>
> I'm having trouble making a post request to a django form using
> urllib2.urlopen. I'm on revision 12523 of django trunk, so I used the
> @csrf_exempt decorator for the view that receives the post. When I
> tried to post to the form, it would return a 500 error, and not log
> the error in apache's error log for some reason. So I decided to have
> my receiving view return an Http404 when it receives a post request.
> This time it returned a "HTTP Error 403: Forbidden", and still the
> receiving django instance doesn't log any error in apache's error log.
>
> I think the issue is, that no matter where I post from, or what I used
> to send the post request with, if the post request isn't from the same
> server, and submitted from the same page, it won't allow me to post to
> it. I've even changed the user-agent and content type in my post
> request, and the errors are the same.
>
> Here is the post request:
>
> #Create the headers
> headers = {
>'Content-Type' : 'text/html; charset=UTF-8',
>'User-Agent': 'Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.9)
> Gecko/20100401 Ubuntu/9.10 (karmic) Firefox/3.5.9',
>}
> #Create the POST data
> post_data = {
>'email_address' : 'f...@gmail.com',
>'user_feedback' : 'Hello World',
>}
> #urlencode the post data
> data = urllib.urlencode(post_data)
> url = 'http://www.example.com'
> #Create the request
> req = urllib2.Request(url, data, headers)
> #raise IOError, url
> #Send the request
> response = urllib2.urlopen(req)
>
> Here is the receiving form:
> 
>
>Email Address:
>email address should be in the form
> of per...@domain.com
> maxlength="100" />
>
>
>Feedback:
> name="user_feedback">
>
>
>
>
>
> 
>
> The receiving view is just a simple view with @csrf_exempt as a
> decorator. Any idea what the issue might be?
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-us...@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.
>
>


-- 
===
株式会社ビープラウド  イアン・ルイス
〒150-0021
東京都渋谷区恵比寿西2-3-2 NSビル6階
email: ianmle...@beproud.jp
TEL:03-6416-9836
FAX:03-6416-9837
http://www.beproud.jp/
===

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: Override Delete Function

2010-04-12 Thread Ian Lewis
Tom,

You could try doing this clear logic in a pre_delete signal. You might have
to test out the timing of when the signals get called but it should call
pre_delete for all deleted models. In this case it would call pre_delete on
model2 before model1 but you should be able to get what you are looking for.

http://docs.djangoproject.com/en/dev/ref/signals/#pre-delete

On Tue, Apr 13, 2010 at 8:21 AM, cootetom  wrote:

> Hi, I'm trying to figure out the way django deletes models so that I
> can clear the correct references that I need to prior to deleting. So
> I have models set up with overrided delete functions so that I can do
> clears before the actual delete. However, it appears the delete
> functions in a model don't get called in the cascade of deletes so not
> each child model gets to do it's clear of linked data before
> deleting.
>
> def model1(models.Model):
>def delete(self):
>self.related_model.clear()
>super(model1, self).delete()
>
> def model2(models.Model):
>model2 = models.ForeignKey(model2)
>
>def delete(self):
>self.another_related_model.clear()
>super(model2, self).delete()
>
>
> So if I do model1.delete() then it will do it's clear but it appears
> it won't do the clear from model2? Am I getting this behaviour right
> or am I doing something wrong here?
>
> The model class seems like the best place to put delete logic in so
> that when it's deleted it clears any data it needs to first.
>
> - Tom
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-us...@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.
>
>


-- 
===
株式会社ビープラウド  イアン・ルイス
〒150-0021
東京都渋谷区恵比寿西2-3-2 NSビル6階
email: ianmle...@beproud.jp
TEL:03-6416-9836
FAX:03-6416-9837
http://www.beproud.jp/
===

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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 Newbie seeking for advice

2010-04-12 Thread Ian Lewis
Mr. Yu,

On Tue, Apr 13, 2010 at 9:56 AM, Mister Yu  wrote:

>
> 1. can you suggest an up-to-date(django 1.1) book which can guide a
> newbie to a higher level? ebook is ok, free is more than ok  :)
>

I think the semi-official Django book is where most people start. It's
available online and currently covers 1.1 (at least according to chapter 1).

http://www.djangobook.com/en/2.0/



> best practice for the following things under django 1.1, (i tried
> google, but some of the material might not fit for 1.1 anymore), you
> can just name a library or which built-in module is best, as these are
> the features in my mind for my little project
> 2. tags
> 3. open-id
> 4. user avatar
> 5. ajax form
> 6. twitter api
>

The best practices for Django would be to break functionality for these
features into seperate "applications" in Django speak. See: Writing your
first Django app: http://docs.djangoproject.com/en/dev/intro/tutorial01/

The part where you start creating models is where you actually create a
Django "application" using the "startapp" command..
http://docs.djangoproject.com/en/dev/intro/tutorial01/#id3

That said, there are a number of applications that are written by others
that you should be able to use right out of the box for most of your
functionality.

tags: http://code.google.com/p/django-tagging/
open-id: http://github.com/simonw/django-openid
avatar: http://github.com/ericflo/django-avatar
ajax-form: http://github.com/alex/django-ajax-validation
twitter api: http://code.google.com/p/oauth-python-twitter/ (or you can use
my fork with some bug fixes:
http://bitbucket.org/IanLewis/oauth-python-twitter/)

-- 
===
株式会社ビープラウド  イアン・ルイス
〒150-0021
東京都渋谷区恵比寿西2-3-2 NSビル6階
email: ianmle...@beproud.jp
TEL:03-6416-9836
FAX:03-6416-9837
http://www.beproud.jp/
===

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: Serving https with runserver

2010-03-01 Thread Ian Lewis
I can think of a number of reasons why you would want to test SSL
behavior on your local machine before running it on a production
server. Setup can be pretty annoying for one.

I wrote a blog post on how to do this very thing a while back. I used
stunnel, as Janusz mentioned, to test SSL redirect behavior on the
development server. You need to run two dev servers one for http and
one for https. You also need to make sure that you set HTTPS=on as an
environment variable so that request.is_secure() returns true
properly.

http://www.ianlewis.org/en/testing-https-djangos-development-server

Ian

On Mon, Mar 1, 2010 at 7:43 PM, Gonzalo Delgado  wrote:
> El 01/03/10 07:07, cool-RR escribió:
>> Adnan, I'm really baffled by your response. No, my reasons for using
>> SSL here is not because I'm afraid someone will sniff my data, We are
>> talking here about `runserver`, which is the development server which
>> is never used for production. The goal of `runserver` is to be able to
>> easily test how your Django project behaves before you upload it to
>> the real server.
>
> While it may sound so, the development server isn't really intended to
> test *exactly* how a Django project behaves before uploading it to a
> production server. There are a couple of cases where it will always fall
> short, like serving static media or using SSL. It also can't help you
> much to test how a site behaves with a big number of requests per second.
> For those cases a staging[0] server is used, which is a copy of the
> production server but for testing how the site behaves under certain
> conditions or with new features, etc.
>
> [0] http://en.wikipedia.org/wiki/Staging_site
>
> --
> Gonzalo Delgado 
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To post to this group, send email to django-us...@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.
>
>



-- 
===
株式会社ビープラウド  イアン・ルイス
〒150-0012
東京都渋谷区広尾1-11-2アイオス広尾ビル604
email: ianmle...@beproud.jp
TEL:03-5795-2707
FAX:03-5795-2708
http://www.beproud.jp/
===

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: Set language on per page basis

2010-02-25 Thread Ian Lewis
BTW: django-cms does something similar to what you are trying to do.
You can check out it's implementation here:

http://github.com/digi604/django-cms-2.0/blob/master/cms/middleware/multilingual.py

2010/2/25 Ian Lewis <ianmle...@gmail.com>:
> In process_request you have access to the request object which knows
> the current path (request.path). You can use that to determine which
> language to show the page in.
>
> Or if you are determining the language based on a url parameter you
> can look at request.GET
>
> Ian
>
> On Thu, Feb 25, 2010 at 8:24 AM, Tor Nordam <tor.nor...@gmail.com> wrote:
>> After doing some further research, I have found the following:
>>
>> By writing a small piece of custom middleware, I can change the value
>> of HTTP_ACCEPT_LANGUAGE. If I add this line to a process_request()
>>
>> request.META['HTTP_ACCEPT_LANGUAGE'] = 'no'
>>
>> then the webpage will be displayed with Norwegian translation.
>> However, I want to set the language based on which page the user is
>> trying to view, and process_request() doesn't know this. On the other
>> hand, if I use process_view(), I am able to determine what the
>> language should be, as process_view() gets passed for example the
>> arguments from the url. However, when I add the same line as above to
>> process_view(), nothing happens to the language.
>>
>> Is there an easy way to do this?
>>
>> On Feb 24, 9:59 pm, Tor Nordam <tor.nor...@gmail.com> wrote:
>>> Thank you for your reply,
>>>
>>> Using the {% trans %} method is indeed what I intend to do. But the
>>> problem is how to set the language on a page basis, rather than as an
>>> installation-wide setting, or a user-selectable setting.
>>>
>>> On Feb 24, 6:55 pm, Timothy Kinney <timothyjkin...@gmail.com> wrote:
>>>
>>> > I believe you want to use the {% *trans* %} template 
>>> > method.http://docs.djangoproject.com/en/dev/topics/i18n/internationalization/
>>>
>>> > -Tim
>>>
>>> > On Wed, Feb 24, 2010 at 7:18 AM, Tor Nordam <tor.nor...@gmail.com> wrote:
>>> > > I'm currently developing a project for making course webpages at my
>>> > > university. Essentially, each course would be an instance of the model
>>> > > Course, and each course would then get it's own webpage. However, as
>>> > > some courses are taught in Norwegian, and some in English, I want to
>>> > > use django's internationalisation framework, and I want to be able to
>>> > > set the language for each course separately. So I want to use
>>> > > different languages, but I don't want the person viewing the webpage
>>> > > to be able to select the language himself.
>>>
>>> > > As far as I can tell, the standard ways to set the language is either
>>> > > to use one setting for you entire project, or to select language based
>>> > > on the end users preferences. Is there an easy way to do what I want?
>>>
>>> > > --
>>> > > You received this message because you are subscribed to the Google 
>>> > > Groups
>>> > > "Django users" group.
>>> > > To post to this group, send email to django-us...@googlegroups.com.
>>> > > To unsubscribe from this group, send email to
>>> > > django-users+unsubscr...@googlegroups.com<django-users%2bunsubscr...@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-us...@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.
>>
>>
>
>
>
> --
> ===
> 株式会社ビープラウド  イアン・ルイス
> 〒150-0012
> 東京都渋谷区広尾1-11-2アイオス広尾ビル604
> email: ianmle...@beproud.jp
> TEL:03-5795-2707
> FAX:03-5795-2708
> http://www.beproud.jp/
> ===
>



-- 
===
株式会社ビープラウド  イアン・ルイス
〒150-0012
東京都渋谷区広尾1-11-2アイオス広尾ビル604
email: ianmle...@beproud.jp
TEL:03-5795-2707
FAX:03-5795-2708
http://www.beproud.jp/
===

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: Set language on per page basis

2010-02-25 Thread Ian Lewis
In process_request you have access to the request object which knows
the current path (request.path). You can use that to determine which
language to show the page in.

Or if you are determining the language based on a url parameter you
can look at request.GET

Ian

On Thu, Feb 25, 2010 at 8:24 AM, Tor Nordam  wrote:
> After doing some further research, I have found the following:
>
> By writing a small piece of custom middleware, I can change the value
> of HTTP_ACCEPT_LANGUAGE. If I add this line to a process_request()
>
> request.META['HTTP_ACCEPT_LANGUAGE'] = 'no'
>
> then the webpage will be displayed with Norwegian translation.
> However, I want to set the language based on which page the user is
> trying to view, and process_request() doesn't know this. On the other
> hand, if I use process_view(), I am able to determine what the
> language should be, as process_view() gets passed for example the
> arguments from the url. However, when I add the same line as above to
> process_view(), nothing happens to the language.
>
> Is there an easy way to do this?
>
> On Feb 24, 9:59 pm, Tor Nordam  wrote:
>> Thank you for your reply,
>>
>> Using the {% trans %} method is indeed what I intend to do. But the
>> problem is how to set the language on a page basis, rather than as an
>> installation-wide setting, or a user-selectable setting.
>>
>> On Feb 24, 6:55 pm, Timothy Kinney  wrote:
>>
>> > I believe you want to use the {% *trans* %} template 
>> > method.http://docs.djangoproject.com/en/dev/topics/i18n/internationalization/
>>
>> > -Tim
>>
>> > On Wed, Feb 24, 2010 at 7:18 AM, Tor Nordam  wrote:
>> > > I'm currently developing a project for making course webpages at my
>> > > university. Essentially, each course would be an instance of the model
>> > > Course, and each course would then get it's own webpage. However, as
>> > > some courses are taught in Norwegian, and some in English, I want to
>> > > use django's internationalisation framework, and I want to be able to
>> > > set the language for each course separately. So I want to use
>> > > different languages, but I don't want the person viewing the webpage
>> > > to be able to select the language himself.
>>
>> > > As far as I can tell, the standard ways to set the language is either
>> > > to use one setting for you entire project, or to select language based
>> > > on the end users preferences. Is there an easy way to do what I want?
>>
>> > > --
>> > > You received this message because you are subscribed to the Google Groups
>> > > "Django users" group.
>> > > To post to this group, send email to django-us...@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-us...@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.
>
>



-- 
===
株式会社ビープラウド  イアン・ルイス
〒150-0012
東京都渋谷区広尾1-11-2アイオス広尾ビル604
email: ianmle...@beproud.jp
TEL:03-5795-2707
FAX:03-5795-2708
http://www.beproud.jp/
===

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: NoReverseMatch:

2010-01-16 Thread Ian Lewis
Bhaskar,

The error means that there is either no defined URL called
'tellfriend' or it requires some kind of argument, like a user id, to
generate the URL.

Having two separate forms with different actions is no problem. Fixing
the URL reversing should clear up your issue.

Ian



On Sunday, January 17, 2010, Bhaskar Gara  wrote:
> Caught an exception while rendering: Reverse for 'tellfriend' with
> arguments '()' and keyword arguments '{}' not found.
>
> 
>
>
> I have a html template which has two form
>
> My form1  action is empty  and form 2 action is as above. I am
> getting error @ that line.
>
>
> 1)   What is the meaning of the error ?
> 2)   How can I call two different fucntion in views.py  from the same
> HTML form action.
>
>
> Thank you
> Bhaskar
>

-- 
===
株式会社ビープラウド  イアン・ルイス
〒150-0012
東京都渋谷区広尾1-11-2アイオス広尾ビル604
email: ianmle...@beproud.jp
TEL:03-5795-2707
FAX:03-5795-2708
http://www.beproud.jp/
===
-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: form with loop over fields?

2009-11-11 Thread Ian Lewis

andraeas,

You can define a choice field that takes a callable as it's choices.
That way you could use the current year and loop over the subsequent
years to create the list you need. Just return a two tuple that can be
used as the choices for a normal field in your function.

class LazyChoiceField(ChoiceField):
def _get_choices(self):
if callable(self._choices):
return self._choices()
return self._choices

def _set_choices(self, value):
self._choices = self.widget.choices = value

choices = property(_get_choices, _set_choices)

On Wed, Nov 11, 2009 at 8:10 PM, andreas schmid  wrote:
>
> hi ,
>
> i need to create an input form with a input field for every month for
> lets say 10 years.
> so the form has 10*12 = 120 exact same input fields.
>
> is there a way to define the field only once or maybe define a year with
> 12 fields and loop over it to avoid having a huge model?
>
> thx
>
> >
>



-- 
===
株式会社ビープラウド  イアン・ルイス
〒150-0012
東京都渋谷区広尾1-11-2アイオス広尾ビル604
email: ianmle...@beproud.jp
TEL:03-5795-2707
FAX:03-5795-2708
http://www.beproud.jp/
===

--~--~-~--~~~---~--~~
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: en vs. en_US (was 'Problems creating a new locale')

2009-09-27 Thread Lewis Taylor

Hi michael,

the language code should always be in the form xx or xx-xx and the
locale folders should be in the form xx or xx_XX. If you look through
the translation code you can see that what django does is given a
language xx-xx, it will check for xx_XX locale then xx. given xx (en
for example), it'll just look for locale xx, it won't search for more
specific dialects.

One flaw is that if django doesn't find the specified language in the
conf/locale folder of the django directory, it returns the default
language code in the settings, so you must have en_US in the django
locale directory if you want specific languages.




On Sep 26, 4:31 pm, Michael Scheper  wrote:
> Hello again,
>
> I poked at this a bit more yesterday and traced this problem to core
> Python behaviour. The critical line of Django code is in the
> django.utils.translation.trans_real.translation(language) function, in
> _translation() under _fetch():
>
> t = gettext_module.translation('django', path, [loc], klass)
>
> When the value of loc doesn't include a territory (i.e. when it's
> 'en', and not something like 'en_AU' or 'en_US'), you really don't
> know which locale you're going to get. I've experimented with it and
> it seems to depend on what order the file system returns the locale
> directories. I've written in the Django i18n forums about this 
> (seehttp://www.nabble.com/Strange-gettext.find-results-td25621560.html)
> but I would call this a bug, either in Django or Python.
>
> As a result of this bug, users in Portugal might see the Brazilian
> content, and users in Spain might see Argentine content. Luckily,
> Django has separate locales for zh_CH and zh_TW, not just zh;
> otherwise, things could have gotten /really/ nasty!
>
> In any case, to solve my own problem, I'm working on a hack for
> LocaleMiddleware so it looks at request.META.HTTP_ACCEPT_LANGUAGE if
> request.LANGUAGE_CODE is 'en', and chooses the right locale,
> regardless of whether Django supports it yet.
>
> Cheers,
> MS.
>
> On Sep 21, 1:43 pm, Michael Scheper  wrote:
>
> > G'day everyone,
>
> > What I want to do: To keep my American users happy, I want to localise
> > my site for en-us locale users. That way, they'll see all the dropped
> > 'u's and past participles and other things that don't exist in 'U.S.
> > English' (and that U.S. date format and all the other spelling
> > variations), but my site will still be correct for users in en-au, en-
> > nz, en-gb, en-za, en-ca, etc.
>
> > Unfortunately, it's not working. Even when I have my browser set to
> > U.S. English, the version of my site I see is in international
> > English.
>
> > Details: I'm using Python 2.5.2, and 'Django version 1.0-final-SVN-
> > unknown'.
>
> > What I've tried:
>
> > 1. I've made sure that i18n/l10n is working in general by translating
> > a few things to Dutch (nl) and setting my browser to that locale. It
> > works. (This article helped a 
> > lot:http://devdoodles.wordpress.com/2009/02/14/multi-language-support-in-...)
>
> > 2. According tohttp://docs.djangoproject.com/en/dev/topics/i18n/,
> > 'Django does not support localizing your application into a locale for
> > which Django itself has not been translated. [...] If you want to
> > support a locale for your application that is not already part of
> > Django, you'll need to make at least a minimal translation of the
> > Django core.' I've done this by copying the 'en' directory to 'en_US'
> > in /var/lib/python-support/python2.5/django/conf/locale and /usr/share/
> > python-support/python-django/django/conf/locale.* I also set LANGUAGES
> > to include only 'en' and 'en-us' (and 'nl') in settings.py. Since I
> > did these two things, putting {{ request.LANGUAGE_CODE }} in a
> > template yields 'en-us' when I set my browser to U.S. English, and
> > just 'en' when I use other English locales. (Before doing these
> > things, it returned 'en' regardless of which English locale I had my
> > browser set to.)
>
> > 3. I used django-admin makemessages -l en and django-admin
> > makemessages -l en-us to create language files, created the American
> > translations, and ran django-admin compilemessages. (I also tried
> > using en_US instead of en-us, since that's the standard used in the
> > two system directories I noted above. No difference.)
>
> > What's not working: The U.S. English text isn't showing up when I set
> > my browser to U.S. English, even though {{ request.LANGUAGE_CODE }}
> > does display 'en-us'.
>
> > * I have root on my own development server, so I was able to copy
> > these locale directories. My web host probably won't let me do this,
> > however, so I need to find another way that works.
>
> > Any advice?
--~--~-~--~~~---~--~~
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 

URL resolving of patterns including 0 or 1 operator fails.......

2009-09-25 Thread Lewis Taylor

Here it goes:

I wanted a clean url structure so i tried to abstract as much as i
could in one url pattern. it looks something like this:

url(r'^approved/((?P[a-zA-Z ,-]+)?)(/?)((?P[0-9]+)?)
(/?)
$', get_approved_images, name='approved_images')

this in theory should allow the return of
1) all images - /approved/
2) pagination options for all images - /approved/2/
3) images from a specific country - /approved/china/
4) pagination for countries - /approved/china/3/

this works fine, but when trying to resolve the url with no page or
country there are problems i.e.

{% url approved_images %}

i thought as there can be 0 or 1 of both country and page as specified
in the url pattern there shouldn't be a problem, however it doesn't
seem that way. I haven't looked inside the code as i have higher
priority things to do at present, but if anyone could help with a
solution or a reason why it doesn't work that would be appreciated, if
not i suggest a patch as it makes sense that allowing url's to match a
particular pattern should also mean that any url that matches that
pattern should be resolvable :-)
--~--~-~--~~~---~--~~
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 scalability with files

2009-08-27 Thread Lewis Taylor

Question:

I have an imagefield that i want to create a thumbnail for on approval
of the image. The problem is (setup is 2 django instances, load
balancer and DB) if the image is stored on one machine it's not the
cleanest solution to have to get the image from the other server and
process it. Is there a better solution django offers, and why are
blobs not supported. ideally i would have the image stored in DB and
that way there would never be sync issues.

Thanks

Lewis
--~--~-~--~~~---~--~~
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: JSON Serialization with ImageField

2009-08-24 Thread Lewis Taylor

The reason I'm trying it is due to a requirement, the data rather than
being sent using a normal post request in a multienc form has to be sent
over in a json string
in the post request containing the base64 encoded image.

On Mon, 2009-08-24 at 18:38 +0200, Maksymus007 wrote:
> On Tue, Aug 4, 2009 at 10:58 PM, scuzz wrote:
> >
> > Hi,
> >
> > I'm trying to receive a file encoded in a json string and store it in
> > an ImageField. I was hoping to use the standard Django deserialisation
> > like:
> >
> > serializers.deserialize("json", "...snip..., \"myImageField\":
> > \"base64encodedimage\", ...snip...)
> >
> > however it tries to store the image content string directly in the
> > field rather than going through the imagefield file storage mechanism.
> > has anyone solved this?
> >
> > i've got control of the creation of the json string, so i can encode
> > the image however works best. i wasn't expecting base64 strings to
> > just work but that's a separate though related problem. i'm guessing i
> > need a hook into the deserialization to handle images specially but i
> > don't see how to go about it.
> >
> > thanks for any help
> >
> 
> I may be wrong, but ImageField handles file upload via POST by
> utilizing request.FILES - which is an array containing information
> about file and generator for reading data - why you try to put there
> raw data ?
> 
> > 


--~--~-~--~~~---~--~~
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: JSON Serialization with ImageField

2009-08-24 Thread Lewis Taylor

Did you find a way to do this? I'm having the same problem.

Lewis

On Aug 4, 9:58 pm, scuzz <garethpri...@gmail.com> wrote:
> Hi,
>
> I'm trying to receive a file encoded in a json string and store it in
> an ImageField. I was hoping to use the standard Django deserialisation
> like:
>
> serializers.deserialize("json", "...snip..., \"myImageField\":
> \"base64encodedimage\", ...snip...)
>
> however it tries to store the image content string directly in the
> field rather than going through the imagefield file storage mechanism.
> has anyone solved this?
>
> i've got control of the creation of the json string, so i can encode
> the image however works best. i wasn't expecting base64 strings to
> just work but that's a separate though related problem. i'm guessing i
> need a hook into the deserialization to handle images specially but i
> don't see how to go about it.
>
> thanks for any help

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



Smipple - Social Code Snippets

2009-06-29 Thread Ian Lewis
Hi all,

I just wanted to let everyone know about a site I created for sharing code
snippets in a social way. You can check it out at http://www.smipple.net/.
Smipple allows you to save, organize, and share snippets with others easily.
The best part though is that you can follow other people who have
interesting snippets and see the snippets that users you are following in
one place. You can also favorite any snippet that you find interesting so
you can retrieve it easily later.

Smipple is implemented using Google Appengine, Django, and appengine-patch
but that shouldn't stop anyone from contributing any kind of snippets that
they want. We'd love it if Ruby, PHP, Java, JavaScript or Perl developers
would use the site as well! What kind of social sharing site would it be if
there were only certain types of developers using it after all!

Happy Coding,

Ian

--~--~-~--~~~---~--~~
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: Odd ModelForm problem

2009-06-24 Thread Ian Lewis
I'm not sure why it might work on one server but not on another unless the
version of Django was different but as far as I know form.slug is not really
guaranteed to exist. Normally it gets added to form.fields or somesuch by
the forms metaclass.

The actual data from the post request should also not be retrieved this way
either. You should probably be doing the slugify() inside the is_valid() if
block and accessing whether the slug was passed in the POST data or not by
checking "slug" in form.cleaned_data.

On Wed, Jun 24, 2009 at 8:40 AM, saxon75  wrote:

>  form = AddArticleForm(request.POST)
>if not form.slug:
>  form.slug = slugify(form.title)
>if form.is_valid():
>



-- 
===
株式会社ビープラウド  イアン・ルイス
〒150-0012
東京都渋谷区広尾1-11-2アイオス広尾ビル604
email: ianmle...@beproud.jp
TEL:03-5795-2707
FAX:03-5795-2708
http://www.beproud.jp/
===

--~--~-~--~~~---~--~~
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: Processing multiple forms on one page

2009-06-24 Thread Ian Lewis
Oleg,

You can set a parameter in your post request that allows you to
differentiate between the two POST requests.

But a more clean approach would be to just have the different forms POST to
different urls(views) and the redirect back to the profile page if there is
an error or do whatever.

Ian

On Wed, Jun 24, 2009 at 2:45 PM, Oleg Oltar  wrote:

>
> Hi!
>
> I am writing a small application for user profile management.
>
> I need to display and to process output from 2 form on the page of own
> profile. How can I do it?
>
> 1. Form if to change avatar. (Contains browse and upload buttons)
> 2. Form is for changing user details, e.g. info field, or maybe emails
>
> I want these form to be processed independently. E.g. user can submit
> one without filling another.
>
> I have read a post about similar problem here:
>
> http://groups.google.com/group/django-users/browse_thread/thread/1ff0909af4e0cdfe
> but didn't find a solution for me.
>
> e.g. if we have following code:
>if request.method == 'POST':
>form1 = RegistrationForm(request.POST)
>form2 = ...(request.POST)
>
> How to process them? Mean one of them will be empty, and it means I
> don't need to return an error in that case.
> Actually,  I need to understand which of them is in post. But how?
>
>
> Thanks,
> Oleg
>
> >
>


-- 
===
株式会社ビープラウド  イアン・ルイス
〒150-0012
東京都渋谷区広尾1-11-2アイオス広尾ビル604
email: ianmle...@beproud.jp
TEL:03-5795-2707
FAX:03-5795-2708
http://www.beproud.jp/
===

--~--~-~--~~~---~--~~
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: Amazon S3 for File Uploads

2009-06-12 Thread Ian Lewis
Max,

Just from glancing over the options you have below none of them looked
particularly good to me. The first is only a file field so depending on what
you are doing it may not work for you. The second seemed reasonable but has
no options for setting things like http headers for files or more advanced
options like ACLs. The third looks like it has some support for setting
headers but it does some stuff like putting the file content into memory
then putting it in a StringIO object which wouldn't be good for files much
over say a few tens of megabytes.

I think which one you choose would depend on what you want to do but
personally I rolled my own based on Django 1.1's storage api which does a
lot better job of streaming and chucking data for large files because
existing options like the ones below weren't very robust .

Ian

On Sat, Jun 13, 2009 at 6:55 AM, Max Clark  wrote:

>
> Hello,
>
> I want to use Amazon S3 for file uploads from users
> (models.FileField). I have been searching and have come across these
> three plugins/examples to use S3 with django...
>
> http://code.djangoproject.com/wiki/AmazonSimpleStorageService
> http://www.sourceguru.net/archives/177
> http://code.welldev.org/django-storages/wiki/S3Storage
>
> For list members currently running this code I would be very
> interested in feedback / why you went with one vs another / what your
> experience has been like.
>
> Thanks,
> Max
>
> >
>


-- 
===
株式会社ビープラウド  イアン・ルイス
〒150-0012
東京都渋谷区広尾1-11-2アイオス広尾ビル604
email: ianmle...@beproud.jp
TEL:03-5795-2707
FAX:03-5795-2708
http://www.beproud.jp/
===

--~--~-~--~~~---~--~~
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: Question about ForeignKeys and subclasses

2009-06-03 Thread Ian Lewis
Rex,

My appologies. Though the feature is in 1.0 I gave a link to the 1.1
documentation.

Django 1.0 docs: http://docs.djangoproject.com/en/1.0/topics/db/models/#id7

2009/6/3 Ian Lewis <ianmle...@gmail.com>

> Rex,
>
> Django parent model instances will also have a property equal to the
> lowercase name of the subclass. So for Animal instances that happen to be a
> Duck you can do something like "my_room.animal.duck" to get the Duck
> instance. Depending on what you are doing you might want to try that. It's
> reasonable enough if you are dealing with a small number of instances.
>
> See:
> http://docs.djangoproject.com/en/dev/topics/db/models/#multi-table-inheritance
>
> Ian
>
>
> On Mon, Jun 1, 2009 at 3:49 PM, Daniel Roseman <
> roseman.dan...@googlemail.com> wrote:
>
>>
>> On Jun 1, 5:39 am, Rex <rex.eastbou...@gmail.com> wrote:
>> > Hello,
>> >
>> > I have a question that is best illustrated by the following fictional
>> > example. (I put my question at the end.)
>> >
>> > #=
>> > # In models.py
>> > class Room(models.Model):
>> > animal = models.ForeignKey(Animal)
>> >
>> > class Animal(models.Model):
>> > #[...]
>> >
>> > class Duck(Animal):
>> > #[...]
>> >
>> > # In views.py
>> > my_duck = Duck()
>> > #[...]
>> >
>> > my_room = Room(animal=my_duck)
>> > #[...]
>> >
>> > # QUESTION: What should the following expression return?
>> > isinstance(my_room.animal, Duck)
>> > #=
>> >
>> > Django appears to return False. Accordingly, I get an error when I try
>> > to call the quack() method on my_room.animal, since that method is
>> > defined for Ducks but not for Animals. I am running into a situation
>> > where I would like to call the quack() method if the room's animal is
>> > an instance of Duck. Is there some way to do this?
>> >
>> > Regards,
>> >
>> > Rex
>>
>> This is a reasonably frequently asked question.
>>
>> As the documentation points out, if you ask Django for an instance of
>> the parent class, that's what you'll get. There's no way to get from
>> that to the derived class, as the database doesn't record that
>> information. So the best thing to do is to have an 'animal_type' field
>> on your parent class, which is set automatically on save to whatever
>> type the child class is - then you could have a method on the parent
>> class which returns the actual object.
>> --
>> DR.
>> >>
>>
>
>
> --
> ===
> 株式会社ビープラウド  イアン・ルイス
> 〒150-0012
> 東京都渋谷区広尾1-11-2アイオス広尾ビル604
> email: ianmle...@beproud.jp
> TEL:03-5795-2707
> FAX:03-5795-2708
> http://www.beproud.jp/
> ===
>



-- 
===
株式会社ビープラウド  イアン・ルイス
〒150-0012
東京都渋谷区広尾1-11-2アイオス広尾ビル604
email: ianmle...@beproud.jp
TEL:03-5795-2707
FAX:03-5795-2708
http://www.beproud.jp/
===

--~--~-~--~~~---~--~~
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: comments error

2009-06-03 Thread Ian Lewis
Looks like the next parameter doesn't really work though.

See:
http://groups.google.com/group/django-users/browse_thread/thread/109763039cef5c3d/470d678e46d7dfe0?hl=en=gst
And: http://code.djangoproject.com/ticket/8968

2009/6/3 Ian Lewis <ianmle...@gmail.com>

> Iperk,
>
> Is this perhaps what you are looking for?
>
>
> http://docs.djangoproject.com/en/dev/ref/contrib/comments/#redirecting-after-the-comment-post
>
>
> On Mon, Jun 1, 2009 at 6:38 AM, lperk <lper...@gmail.com> wrote:
>
>>
>> Does someone know how to redirect posted comment to another page if
>> you have your own form for sending comments?
>>
>> On May 31, 9:55 pm, lperk <lper...@gmail.com> wrote:
>> > Hey.. I'm trying to send comment with django comments option and
>> > everything is ok..I see it form..but when I send comment I got error:
>> >
>> > Comment post not allowed (400)
>> > Why:Missing content_type or object_pk field.
>> >
>> > Can anyone help me with this.. what do I have to do..where to insert
>> > those things?
>> >
>> > Thank U very much!
>> >>
>>
>
>
> --
> ===
> 株式会社ビープラウド  イアン・ルイス
> 〒150-0012
> 東京都渋谷区広尾1-11-2アイオス広尾ビル604
> email: ianmle...@beproud.jp
> TEL:03-5795-2707
> FAX:03-5795-2708
> http://www.beproud.jp/
> ===
>



-- 
===
株式会社ビープラウド  イアン・ルイス
〒150-0012
東京都渋谷区広尾1-11-2アイオス広尾ビル604
email: ianmle...@beproud.jp
TEL:03-5795-2707
FAX:03-5795-2708
http://www.beproud.jp/
===

--~--~-~--~~~---~--~~
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: comments error

2009-06-03 Thread Ian Lewis
Iperk,

Is this perhaps what you are looking for?

http://docs.djangoproject.com/en/dev/ref/contrib/comments/#redirecting-after-the-comment-post

On Mon, Jun 1, 2009 at 6:38 AM, lperk  wrote:

>
> Does someone know how to redirect posted comment to another page if
> you have your own form for sending comments?
>
> On May 31, 9:55 pm, lperk  wrote:
> > Hey.. I'm trying to send comment with django comments option and
> > everything is ok..I see it form..but when I send comment I got error:
> >
> > Comment post not allowed (400)
> > Why:Missing content_type or object_pk field.
> >
> > Can anyone help me with this.. what do I have to do..where to insert
> > those things?
> >
> > Thank U very much!
> >
>


-- 
===
株式会社ビープラウド  イアン・ルイス
〒150-0012
東京都渋谷区広尾1-11-2アイオス広尾ビル604
email: ianmle...@beproud.jp
TEL:03-5795-2707
FAX:03-5795-2708
http://www.beproud.jp/
===

--~--~-~--~~~---~--~~
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: Question about ForeignKeys and subclasses

2009-06-03 Thread Ian Lewis
Rex,

Django parent model instances will also have a property equal to the
lowercase name of the subclass. So for Animal instances that happen to be a
Duck you can do something like "my_room.animal.duck" to get the Duck
instance. Depending on what you are doing you might want to try that. It's
reasonable enough if you are dealing with a small number of instances.

See:
http://docs.djangoproject.com/en/dev/topics/db/models/#multi-table-inheritance

Ian

On Mon, Jun 1, 2009 at 3:49 PM, Daniel Roseman <
roseman.dan...@googlemail.com> wrote:

>
> On Jun 1, 5:39 am, Rex  wrote:
> > Hello,
> >
> > I have a question that is best illustrated by the following fictional
> > example. (I put my question at the end.)
> >
> > #=
> > # In models.py
> > class Room(models.Model):
> > animal = models.ForeignKey(Animal)
> >
> > class Animal(models.Model):
> > #[...]
> >
> > class Duck(Animal):
> > #[...]
> >
> > # In views.py
> > my_duck = Duck()
> > #[...]
> >
> > my_room = Room(animal=my_duck)
> > #[...]
> >
> > # QUESTION: What should the following expression return?
> > isinstance(my_room.animal, Duck)
> > #=
> >
> > Django appears to return False. Accordingly, I get an error when I try
> > to call the quack() method on my_room.animal, since that method is
> > defined for Ducks but not for Animals. I am running into a situation
> > where I would like to call the quack() method if the room's animal is
> > an instance of Duck. Is there some way to do this?
> >
> > Regards,
> >
> > Rex
>
> This is a reasonably frequently asked question.
>
> As the documentation points out, if you ask Django for an instance of
> the parent class, that's what you'll get. There's no way to get from
> that to the derived class, as the database doesn't record that
> information. So the best thing to do is to have an 'animal_type' field
> on your parent class, which is set automatically on save to whatever
> type the child class is - then you could have a method on the parent
> class which returns the actual object.
> --
> DR.
> >
>


-- 
===
株式会社ビープラウド  イアン・ルイス
〒150-0012
東京都渋谷区広尾1-11-2アイオス広尾ビル604
email: ianmle...@beproud.jp
TEL:03-5795-2707
FAX:03-5795-2708
http://www.beproud.jp/
===

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



Storage API and Uploading to http based storage

2009-05-22 Thread Ian Lewis
I have run into an issue and was wondering how I might be able to solve it
in the best way:

For storage backends that are http based some (such as S3) require that you
submit a Content-Length header upfront.

This is not necessarily a problem for the save method which takes a file
like object since it can look at the object and determine the length before
sending it. Though it still isn't very good as the file like object might
contain a lot of data or be transmitting over the wire.

However, it becomes impossible with the current API to open a file object
for writing and use the write method to write over http as the content
length is required to be sent before writing any data.

storage = S3Storage()
f = storage.open("myfile.txt", "w") # need to send the length and possibly
other metadata here.
f.write(data)

This kind of implementation would be required for supporting uploading
directly via an UploadHandler or other data backend which requires the
length as the upload handler provides the data in chunks.

Any thoughts would be appreciated,
Ian

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



UploadHandlers and the Storage API

2009-05-21 Thread Ian Lewis
Hi all,

I am currently using an implementation of the django.files.storage API to
read/write files from Amazon S3 using the django storage API. This has
worked well except for in cases where one wants to read from one stream and
write to the storage API.

One case I am running into is that I would like to create an Upload handler
that skips putting files in tmp/ and uploads them directly to S3 as the
files could be quite large. I could do this by writing directly to S3 but I
would rather go through the storage API as I would like to change it out for
the local storage API when developing/running tests.

The storage API currently handles writing itself in the save method by
reading from a file like object, but you currently can't do the opposite
where you are given chunks of data and you want to pass them along.

Is there a particularly good way to solve this kind of problem?

Ian

--~--~-~--~~~---~--~~
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: Changing default app url in development server

2009-02-03 Thread Ian Lewis
What are you trying to do? If your development appserver is conflicting with
a locally installed apache then why not just use a different port?

python manage.py runserver 8001

2009/2/4 knight 

>
> Hi,
>
> My question is:
>
> Is there a way to change my default app url in development server
> from http://localhost:8000 to http://localhost:8000/peergw.
>
> If it's a problem, maybe someone have a good reference for configuring
> apache server on MAC.
>
> Regards,
> Arshavski Alexander.
> >
>


-- 
===
株式会社ビープラウド  イアン・ルイス
〒150-0012
東京都渋谷区広尾1-11-2アイオス広尾ビル604
email: ianmle...@beproud.jp
TEL:03-5795-2707
FAX:03-5795-2708
http://www.beproud.jp/
===

--~--~-~--~~~---~--~~
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: Bug? Related manager not working for custom manager?

2008-11-19 Thread Ian Lewis

John,

Try checking the log output of the database server to see what is
different about the SQL. Perhaps some kind of caching is going on
where the manager is caching the results of it's queries?

On Thu, Nov 20, 2008 at 11:21 AM, John M <[EMAIL PROTECTED]> wrote:
>
> I have a model with a custom model manager used for related set
> filtering, but it's not working as expected.
>
> See my models and test at http://dpaste.com/92327/
>
> Can someone explain why my manager isn't doing what I think it should?
>
> Thanks
>
> John
> >
>

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: MySQL deadlocking issues

2008-11-18 Thread Ian Lewis

This isn't something that happens regularly. This error has only come
about once as far as I can tell. It just isn't properly handled and I
wondered what other folks did. Ideally we would have something like
you described that retrys the writes but it occurs infrequenly enough
that I think we can just catch it and return an error to the user.

I'm curious what you did to catch the error and retry. Did you create
a custom kind of DB backend? or did you just add that logic to the
particular view that was giving you trouble?

Ian

On Wed, Nov 19, 2008 at 1:40 PM, DavidA <[EMAIL PROTECTED]> wrote:
>
> Unrelated to Django, but we occasionally get deadlocks in MySQL due to
> separate tasks running at the same time and accessing some tables in
> common. We recently added logic to catch the exception, wait a second
> or two, and retry it a few times before we give up. Most of the time,
> that fixes it.
>
> I agree with Malcolm, though, that for a pure Django app, I would
> think it fairly unlikely to occur unless you are doing something non-
> standard with your models/logic.
>
> -Dave
>
> On Nov 18, 8:52 pm, Malcolm Tredinnick <[EMAIL PROTECTED]>
> wrote:
>> On Wed, 2008-11-19 at 10:21 +0900, Ian Lewis wrote:
>> > I've run into the following error in a SQL DB envornment and was
>> > wondering if any one else had run into problems with Deadlocking with
>> > MySQL. What would be the proper way to handle this kind of error in
>> > Django?
>>
>> > Do most folks simply catch the OperationalError and show some sort of
>> > error to the user?
>>
>> That sounds reasonable.
>>
>> More substantive for our purposes, though, would be knowing why this
>> occurred and if there was any way to avoid it. Either you have a fairly
>> twisted model setup that means an insert causes a deadlock, or there's
>> something that can be improved in Django. So if you could post some
>> details of how you are able to cause this error, it would be appreciated
>> (by me, at least).
>>
>> Regards,
>> Malcolm
> >
>

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



MySQL deadlocking issues

2008-11-18 Thread Ian Lewis

I've run into the following error in a SQL DB envornment and was
wondering if any one else had run into problems with Deadlocking with
MySQL. What would be the proper way to handle this kind of error in
Django?

Do most folks simply catch the OperationalError and show some sort of
error to the user?

...
File "/usr/local/lib/python2.5/site-packages/django/db/models/manager.py",
line 99, in create
   return self.get_query_set().create(**kwargs)

 File "/usr/local/lib/python2.5/site-packages/django/db/models/query.py",
line 313, in create
   obj.save(force_insert=True)

 File "/usr/local/lib/python2.5/site-packages/django/db/models/base.py",
line 307, in save
   self.save_base(force_insert=force_insert, force_update=force_update)

 File "/usr/local/lib/python2.5/site-packages/django/db/models/base.py",
line 379, in save_base
   result = manager._insert(values, return_id=update_pk)

 File "/usr/local/lib/python2.5/site-packages/django/db/models/manager.py",
line 138, in _insert
   return insert_query(self.model, values, **kwargs)

 File "/usr/local/lib/python2.5/site-packages/django/db/models/query.py",
line 888, in insert_query
   return query.execute_sql(return_id)

 File 
"/usr/local/lib/python2.5/site-packages/django/db/models/sql/subqueries.py",
line 308, in execute_sql
   cursor = super(InsertQuery, self).execute_sql(None)

 File "/usr/local/lib/python2.5/site-packages/django/db/models/sql/query.py",
line 1700, in execute_sql
   cursor.execute(sql, params)

 File "build/bdist.linux-x86_64/egg/MySQLdb/cursors.py", line 166, in execute
   self.errorhandler(self, exc, value)

 File "build/bdist.linux-x86_64/egg/MySQLdb/connections.py", line 35,
in defaulterrorhandler
   raise errorclass, errorvalue

OperationalError: (1213, 'Deadlock found when trying to get lock; try
restarting transaction')

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Feel free to test queryset-refactor branch

2008-04-17 Thread scott lewis


On 2008-04-17, at 1553, Justin Fagnani wrote:

> Hey Malcolm,
>
> I've been using qs-rf for a while now with basically no problems.  
> Excellent work.
>
> There's one thing that may a little odd that I stumbled on while  
> trying to get some primitive polymorphism working:
>
> The first thing is that there seems to be no way to tell if an  
> instance of a parent class has a child instance without trying the  
> child reference and catching the DoesNotExist exception. For a class  
> with multiple subclasses, this is a cumbersome, so I've been adding  
> a _type field to parent classes that gets set in save() of the  
> subclasses.
>
> Is there a better way to do this, or is this something that could be  
> included? I know there's no way to determine whether or not a class  
> will be subclassed in the future, so I wouldn't be surprised if the  
> answer is no. But maybe there should be a documented pattern.
>
> The odd part is what happens with the child reference. parent.child  
> obviously works as expected, and returns either an instance of Child  
> or raises DoesNotExist. But for an instance of Child, .child always  
> returns a reference to itself, so that c.child == c is always True.  
> This makes sense on one hand, because c is also an instance of  
> Parent, but on the other, Child doesn't have a subclass, so  
> should .child be None?
>
> I haven't actually encountered this in any real life situation,  
> because it's hard to end up with collection in Django where you have  
> a mix of parent and child instances, so maybe it'll never be a  
> problem.
>
> One additional thing is that in one case, I know which subclasses  
> I'm interested in, and it'd be great to have a way to specify that a  
> queryset should return polymorphic results by specifying the  
> subclasses for the join. Something like:
>
> Parent.objects.all().select_subclasses('Child1','Child2')


This is a dirty hack, but it came in handy for me...

If you add this method to your parent class:

 def canonical(self):
 attr_name = '%s_ptr' % self._meta.module_name
 children_fields = [r.get_accessor_name() for r in  
self._meta.get_all_related_objects() if r.field.name == attr_name]
 for f in children_fields:
 try:
 return getattr(self, f).canonical()
 except models.ObjectDoesNotExist:
 pass
 return self

You can then convert a queryset to a list of child classes:

 child_classes = [c.canonical() for c in Parent.objects.all()]

Basically, canonical() tries to grab a list of descendant classes,  
then cycles through those until it finds one that exists. If it can't  
find an instance of a descendant class, it just hands back the parent  
since that's what you have.  It's also recursive so it will traverse n- 
levels of inheritance.


scott.

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Two sites, one django project

2008-04-10 Thread scott lewis

On 2008-04-10, at 0312, Polat Tuzla wrote:
>
> Hi,
> I'd like to build two sites, say, two polls sites, each having their
> own domain name. Their functionalities are almost exactly the same.
> They're different only by theme.
> [...]
> What exact way of achieving this would you suggest me?
> Thanks,


http://www.djangoproject.com/documentation/sites/

"Django comes with an optional "sites" framework.  It's a hook for  
associating objects and functionality to particular Web sites, and  
it's a holding place for the domain names and "verbose" names of your  
Django-powered sites.

"Use it if your single Django installation powers more than one site  
and you need to differentiate between those sites in some way."

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Using mod in if in template

2008-03-24 Thread scott lewis


On 2008-03-24, at 1312, Tim Sawyer wrote:
>
> Hi Folks,
>
> I want to do this:
>
> 
>  
>{% for image in Images %}
>  
>{{ image.name }}
>{{ image.comment }}
>  
>  {% if forloop.counter % 4 %}
>
>
>  {% endif %}
>{% endfor %}
>  
> 
>
> which should hopefully give me a gallery of images where each line  
> has four
> thumbnails on it.
>
> Unfortunately, I can't do the mod (%) in the if statement, as it's  
> not valid
> syntax.  Is there a way around this, or a simpler solution?



What about just converting it to a 2-dimensional array in the view?  
For example, using grouper() from the itertools recipes [1]:

def grouper(n, iterable, padvalue=None):
 "grouper(3, 'abcdefg', 'x') --> ('a','b','c'), ('d','e','f'),  
('g','x','x')"
 return izip(*[chain(iterable, repeat(padvalue, n-1))]*n)

Images = grouper(4, Images)


Then, the logic in the template is straightforward:


{% for row in Images %}
 
 {% for image in row %}
 {% if image %} ... image detail ... {% endif %}
 {% endfor %}
 
{% endfor %}



scott.


[1]: http://docs.python.org/lib/itertools-recipes.html

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



  1   2   >