Re: Getting error 500 when using jquery/ajax

2013-01-19 Thread Iñigo Medina

On Fri, Jan 18, 2013 at 12:50:26PM -0800, Dex wrote:
> From my server log, i get the following message when I click on a cell: 
> "POST /target_spot/1/0/ HTTP/1.1" 500. Any ideas on how to solve this? 
> Thanks!

Don't you have debug enabled? It should give you a more complete track of the
error.

Iñigo

> 
> -- 
> 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/-/Aux0I4-eUNMJ.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to 
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/django-users?hl=en.
> 

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



Re: Source code from book djangobook.com ?

2013-01-15 Thread Iñigo Medina
On Tue, Jan 15, 2013 at 09:44:56PM -0800, Subodh Nijsure wrote:
> Sorry if this is a very obvious question does any body know if source code
> from the online book http://www.djangobook.com/ is available some where in
> git repo? I have searched on github and most hits are for actual book
> chapters.

Official repo is at: https://github.com/jacobian/djangobook.com

Recent thread on this mailing list about its status:
https://groups.google.com/forum/?fromgroups=#!searchin/django-users/book/django-users/f1H68hiMIKU/overview

Iñigo

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

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



Re: Django Calendar App Just Like Google Calendar

2013-01-14 Thread Iñigo Medina
On Mon, Jan 14, 2013 at 09:41:47AM +1100, Mario Gudelj wrote:
> Defined my own. Actually, i have defined a single appointment/event model
> and then i create an instance of it with different dates and different slug
> for the range specified.
> 
> Use rrlue -
> http://labix.org/python-dateutil#head-470fa22b2db72000d7abe698a5783a46b0731b57
> to
> calculate the date and time for every date i the range.
> 
> So, this how I did it, but you may find a different way.
> 
> I have an appointment model and appointment series which is linked to the
> appointment model.
> 
> I have an appointment creation form, which can create a single appointment,
> but the customer also has an option to create recurring appointments, which
> will create series.
> 
> So, customer is filling in the form and they are asked if this is a
> recurring appointment. I they select yes it presents them with the
> following screen:
> 
> 
> [image: Inline images 1]
> 
> 
> There they can choose if they want the event to recur daily, monthly,
> weekly or yearly.
> 
> So, when the form is submitted with the interval selected, I create the
> appointment, create appointment series and then use rrule to create all the
> dates.
> 
> if form.cleaned_data['is_recur'] == '1':
> 
> # Find the interval first
> 
> frequency_int = int(form.cleaned_data['frequency'])
> 
> if frequency_int == rrule.DAILY:
> 
> interval = form.cleaned_data['daily_interval']
> 
> elif frequency_int == rrule.WEEKLY:
> 
> interval = form.cleaned_data['weekly_interval']
> 
> elif frequency_int == rrule.MONTHLY:
> 
> interval = form.cleaned_data['monthly_interval']
> 
> else:
> 
> interval = form.cleaned_data['yearly_interval']
> 
> Then I loop through all the dates created by rrule and create an
> appointment instance with a different date and the slug, which is the
> combination of appointment name and the date/time.
> 
> e.g. slug
> /appointment/pregnancy-yoga-dads-support-people-welcome/2013/1/23/0630PM/
> 
> In appointment series I store this info:
> 
> a_s = AppointmentSeries.objects.create(
> 
> business=business,first_appointment=appt,
> 
> frequency=form.cleaned_data['frequency'],
> 
> is_date_or_number =
> form.cleaned_data['is_date_or_number'],
> 
> recurrences=form.cleaned_data['recurrences'],
> 
> recurrence_end_date=None,
> 
> interval=interval
> 
> )
> 
> You need to save the first appointment from which everything was created so
> that you can later refer to it when editing the series.
> 
> Anyway, let me know if you need further info and I'm willing to help.
> 
> You may want to look at this post for fullcalendar.js and backbone.js
> integration. It helped me somewhat -
> http://blog.shinetech.com/2011/08/05/building-a-shared-calendar-with-backbone-js-and-fullcalendar-a-step-by-step-tutorial/

Thanks a lot, Mario. It is a lot of information and it is great. I like the
approach. I'm already coding something like that, althoug your use of
recurrences is cleaner. :)

Iñigo

> 
> Cheers,
> 
> Mario
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> On 13 Jan, 2013 11:33 PM, "Iñigo Medina"  wrote:
> 
> >
> > On Sun, Jan 13, 2013 at 12:44:27PM +1100, Mario Gudelj wrote:
> > > It was straight forward. Tastypie makes it really easy to talk json to
> > > backbone and plotting the appointments in fullcalendar was even easier.
> > You
> > > can have the basic functinality in couple of days. More challenging are
> > the
> > > recurring appointments but python's rrule was great help there.
> >
> > I'm going to code a kind of calendar too. I'm still thinking on a good
> > approach
> > for the recurring appointments at the data model level. Are you using any
> > app
> > for that? Or did you define your own data model?
> >
> > Iñigo
> >
> > > On 13 Jan, 2013 9:01 AM, "william ratcliff" 
> > > wrote:
> > >
> > > > How did you find the integration?
> > > >
> > > > William
> > > >
> > > >
> > > > On Sat, Jan 12, 2013 at 4:52 PM, Mario Gudelj  > >wrote:
> > > >
> > > >> I don't think there is one. I looked for one few months ago and ended
>

Re: Django Calendar App Just Like Google Calendar

2013-01-13 Thread Iñigo Medina

On Sun, Jan 13, 2013 at 12:44:27PM +1100, Mario Gudelj wrote:
> It was straight forward. Tastypie makes it really easy to talk json to
> backbone and plotting the appointments in fullcalendar was even easier. You
> can have the basic functinality in couple of days. More challenging are the
> recurring appointments but python's rrule was great help there.

I'm going to code a kind of calendar too. I'm still thinking on a good approach
for the recurring appointments at the data model level. Are you using any app
for that? Or did you define your own data model?

Iñigo

> On 13 Jan, 2013 9:01 AM, "william ratcliff" 
> wrote:
> 
> > How did you find the integration?
> >
> > William
> >
> >
> > On Sat, Jan 12, 2013 at 4:52 PM, Mario Gudelj wrote:
> >
> >> I don't think there is one. I looked for one few months ago and ended up
> >> building one from scratch with fullcaledar.js, backbone and tastypie
> >>  On 12 Jan, 2013 6:00 PM, "Kashif Ali"  wrote:
> >>
> >>> Hello Guys,
> >>>
> >>> Is there any django app available that is a replica of google calendar?
> >>> I have checked django-scheduler, django-swingtime and couple of more but
> >>> the hardest part with these apps/projects is the limited documentation.
> >>> Can anybody please guide me what app can serve my purpose?
> >>>
> >>> Thanks,
> >>> Kashif
> >>>
> >>> --
> >>> 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.
> >>
> >
> >  --
> > 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.
> 

-- 
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 Roles/Permissions

2013-01-13 Thread Iñigo Medina

On Sat, Jan 12, 2013 at 04:39:45PM -0800, Chung Wu wrote:
> Hi there,
> 
> I am having difficulty figuring out how to structure the following problem:
> 
> Users have different roles/groups:
> 
> Admin, Manager, Author
> 
> Admins can edit every user, can view list of all users, delete all users
> Manager can edit all users who are not admins or managers, ""
> Author, can only edit themselves, view themselves
> 
> Users are associated with Posts
> 
> The posts would follow the same logc
> 
> Authors can only see posts they have created, Edit them etc
> 
> Is there a generic way to do this?
> 
> Currently I have views that list all users, post etc but how would I 
> integrate roles/permissions to filter the lists, prevent the user for 
> editing others etc.

You can code that by your own, creating an app for managing permissions whose
model is related to User model. Permissions model might contain the different
types of roles and the possible actions to.

Anyway, you already have Django Guardian, as said above. It allows you to
define easily permissions for a model (adding them to *Meta* class) and assign
them for any user/group.

Iñigo

> 
> Hope you can point me in the right direction
> 
> 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/-/OUSzdMwTvroJ.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to 
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/django-users?hl=en.
> 

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



Re: Best/Cleanest way to add fields to Class User in models.py?

2013-01-12 Thread Iñigo Medina

On Fri, Jan 11, 2013 at 11:06:57PM -0800, Saqib Ali wrote:
> 
> The User class obviously has a lot of important features that any website 
> developer will need to track and manage users to the website.
> However, I wish the class had three additional members -- all 
> BooleanFields: myBoolA, myBoolB, myBoolC.
> 
> What is the safest/cleanest/easiest/best way to achieve this functionality? 
> Where should I add those members? It seems unwise to modify the Django 
> source package itself.

Standard way of solving that is using a custom User Profile related to User
class. I've used such approach and it has the benefits that you keep separated
both models and so they become more reusable. However it has extra cost at
database level.

If you are planning to use Django 1.5 you might extend the User class.

Iñigo

> 
> -- 
> 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/-/FkW8DULxAFAJ.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to 
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/django-users?hl=en.
> 

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



Re: Don't be afraid to commit - a free Python/Django workshop (Cardiff, UK)

2013-01-11 Thread Iñigo Medina

> What we'll cover
> 
> 
> The workshop will take participants through the complete cycle of identifying
> a simple issue in a Django or Python project, writing a patch with tests and
> documentation, and submitting it.
> 
> The workshop will take you through the use of:
> 
> * virtualenv and pip
> * git (and GitHub)
> * running and writing tests for Python applications
> * writing and building documentation using Sphinx
> * submitting a pull request
> 

All sounds great. It might be also useful some examples on real _first_
contribute commits.

Iñigo

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

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



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

2013-01-11 Thread Iñigo Medina
On Fri, Jan 11, 2013 at 12:23:17AM -0800, Jeff Hsu wrote:
> Hi all,
> 
>I kept getting DateTimeField received a naive datetime (2013-01-10 
> 00:00:00) while time zone support is active. but I can't figure out where 
> it's receiving a naive datetime.  I have USE_TZ set to True in my setting 
> file(stores timezone aware object in mysql?).  My url is as below:

You get some good tips for configuration and tracebak on this post:
http://note.harajuku-tech.org/datetimefield-received-a-naive-datetime-while

Iñigo


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

-- 
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 large amounts of text in the DB

2013-01-11 Thread iñigo medina
El 11/01/2013 07:36, "Mike"  escribió:
>
> My users will upload text documents ranging from hundreds to thousands of
words.  At the moment I store the text in a TextField.  Is this going to
cause a performance problem in the future or would it be better to store
the text on the file system and put a file path in the data model?  The
text does not need to be indexed and I'm using MySQL.

That depends pretty much on the operations you perform over such field.
Fetch? Search? Concurrence updates?

Iñigo

>
> --
> 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/-/5CA4p7wHPmoJ.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
http://groups.google.com/group/django-users?hl=en.

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



Re: Form validation

2013-01-11 Thread iñigo medina
El 11/01/2013 08:00, "Kristofer"  escribió:
>
>
> On step 6, I want to perform verification on a field but it depends on
fields that were entered in steps 2-5.

Do you save such data anywhere (database, session...)? You might get from
this source and use as you need.

Iñigo

>
> I cannot figure out how to get data from the previous steps in the form
validation for step 6.
>
> Where is a point in the FormWizard where I can access previous form data
and can also raise ValidationError on a field?
>
> Thanks,
>
> --
> You received this message because you are subscribed to the Google Groups
"Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
http://groups.google.com/group/django-users?hl=en.

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



Re: Questions about Installing Django & Python

2012-11-18 Thread Iñigo Medina


On Sun, 18 Nov 2012, New to Django / Python wrote:


Hi,

I am completely new to programming (despite knowing basic HTML and CSS).

I am trying to install python and django and have successfully installed
the python shell (i think - see attachment 1).


Sorry, but I don't get any attachment.



Where I am having difficulty is in install django. I have downloaded the
django packages (latest offical version 1.42) and unzipped them then run
set up (it opened a CMD then closed it installing - not sure if this means
it is installed).

when I get to the following section of the tutorial I struggle:

Install Django

  - Install an official 
release.
  This is the best approach for users who want a stable version number and
  aren't concerned about running a slightly older version of Django.


When trying to do this with pip, you can see the erros I got int he
attached screenshot. When unzipping the django package file, It doesnt seem
to open properly as above.


Neither such screenshot.

iñ



Any help much appreciated.

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