Re: locating the functionality behind the HTML element

2012-06-28 Thread Jon Black
If I understand you correctly, you want to find the django code
responsible for rendering the view. Rather than look at the html,
the most obvious place is to look at the url. There should be an
entry in one of your urls.py files, which will tell you which
view is being used. You can then trace that view to the template.

--
Jon Black
www.jonblack.org


On Wed, Jun 27, 2012, at 17:55, Smaran Harihar wrote:

  Hi Guys,



I am new to Django and have completed the initial basic tutorials
in the django doc. I am presently working on a pre-customized
django application. I was wondering how I can use FireBug to
locate the code in a specific element (like button). In the
sense, in general the web development once we are able to locate
the button we are able to then locate the class of the specific
element and JS attached to it and CSS. But in Django this cannot
be done since everything is located in separate directories.



Since I am entering into the Django code, where should I start
looking for the CSS and JS files?

--
Thanks & Regards
Smaran Harihar


  --
  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: how to manage range of hours in models and forms in django1.4

2012-06-29 Thread Jon Black
I understand that institue_hours_of_operation is a count of the
hours the user has worked, is that correct? If so, I suppose you
just need to count the hours with each form submition and add
that to the current institue_hours_of_operation value. You can do
that logic in a few places. In class-based views, I tend to put
it in form_valid().

Apologies if I've misunderstood :)

--
Jon Black
www.jonblack.org


On Fri, Jun 29, 2012, at 10:16, Nikhil Verma wrote:

Hi
I am developing an event app which has users who publish events ,
other users also.
Now users have their profile info for which i have made a very
common UserProfile Model with all the necessary details in it.
I have a requirement where in UserProfile model i need to display
a field institue_hours_of_operation( no. of hours that an
institute works)
class UserProfile(models.Model):
user = models.ForeignKey(User, blank=True, null=True,
unique=True)
first_name = models.CharField(max_length=30, blank=True)
last_name = models.CharField(max_length=30, blank=True)
gender = models.CharField(max_length=1,
choices=GENDER_CHOICES, blank=True)
birth_date = models.DateField(auto_now_add=True)
street_address = models.CharField(max_length=75, blank=True)
city = models.CharField(max_length=30, blank=True)
zip_code = models.IntegerField(max_length=7, blank=True,
null=True)
country = models.CharField(max_length=30, blank=True)
mobile = models.CharField(max_length=15, blank=True)
home_phone = models.CharField(max_length=15, blank=True)
primary_email = models.EmailField(max_length=60, blank=True)
secondary_email = models.EmailField(max_length=60,
blank=True)
institution_name =
models.CharField(max_length=100,blank=True,null=True)
institution_website =
models.CharField(max_length=100,blank=True,null=True)
# Field to be added
It will be displayed in html like this
Insitutue hour of operation :   Monday  9.00 - 17.00 (Monday
will be hardcoded,Time will be filled by user)
  Tuesday 9.00 -
17.00 (Monday will be hardcoded,Time will be filled by user)
   and so on
# Note the weekdays like monday,  tuesday they are all hardcoded
as requirement but i don't want that to be hardcoded.
Also i am using a django forms  to display this.
How can i design this form field as well in models or What should
be the type of this field both in models and forms such that
weekdays remain dynamic(i can simply generate them from loop) and
the user can fill the time  and when he hits submit it will get
saved.
Thanks in advance.

  --
  Regards
  Nikhil Verma
  +91-958-273-3156


  --
  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: how to manage range of hours in models and forms in django1.4

2012-06-29 Thread Jon Black
If the days have to be hardcoded (I imagine you have a row/field
for each day), then you could use a hardcoded string for the day
(not editable nor related to your model), and provide two Time
fields. Using Time gives you advantages:

* You can use python's DateTime module to calculate the hours
* You can more easily use a funky date/time style widget if you
ever need it
* You will avoid making mistakes trying to calculate the hours
manually
* You can validate the form data using python's date/time module

If you're really open to suggestions (just thinking outside the
box, and possible outside of the scope), but you could use a
separate table to record all hours recorded rather than just
counting the hours as they're entered.

--
Jon Black
www.jonblack.org


On Fri, Jun 29, 2012, at 14:31, Nikhil Verma wrote:

  Hi Jon
  Yes it is the count of the hours.They will enter in the
  following manner "-
  Monday : 0900-1800, Tuesday and so on ... This will be entered
  by the user who is filling the form.
  Now the text Moday(weekdays can be hardcoded but i personally
  don't want.)
  Now if you see this is a simple CharField where the user
  enters details for the number_of_hours.
  So i want to know what type of model field should i create
  CharField or Time Field.
  If i   go for CharField it will simply save the details like
  0900-1800. So if i need to know how many hours that particular
  person is available for work then how will subtract that from
  CharField.
  So i need help to know what exactly the field i should create
  such that it satisfies the template look and backened queries
  also.

On Fri, Jun 29, 2012 at 2:18 PM, Jon Black <[1]jon_bl...@mm.st>
wrote:

I understand that institue_hours_of_operation is a count of the
hours the user has worked, is that correct? If so, I suppose you
just need to count the hours with each form submition and add
that to the current institue_hours_of_operation value. You can do
that logic in a few places. In class-based views, I tend to put
it in form_valid().

Apologies if I've misunderstood :)

--
Jon Black
[2]www.jonblack.org


On Fri, Jun 29, 2012, at 10:16, Nikhil Verma wrote:

Hi
I am developing an event app which has users who publish events ,
other users also.
Now users have their profile info for which i have made a very
common UserProfile Model with all the necessary details in it.
I have a requirement where in UserProfile model i need to display
a field institue_hours_of_operation( no. of hours that an
institute works)
class UserProfile(models.Model):
user = models.ForeignKey(User, blank=True, null=True,
unique=True)
first_name = models.CharField(max_length=30, blank=True)
last_name = models.CharField(max_length=30, blank=True)
gender = models.CharField(max_length=1,
choices=GENDER_CHOICES, blank=True)
birth_date = models.DateField(auto_now_add=True)
street_address = models.CharField(max_length=75, blank=True)
city = models.CharField(max_length=30, blank=True)
zip_code = models.IntegerField(max_length=7, blank=True,
null=True)
country = models.CharField(max_length=30, blank=True)
mobile = models.CharField(max_length=15, blank=True)
home_phone = models.CharField(max_length=15, blank=True)
primary_email = models.EmailField(max_length=60, blank=True)
secondary_email = models.EmailField(max_length=60,
blank=True)
institution_name =
models.CharField(max_length=100,blank=True,null=True)
institution_website =
models.CharField(max_length=100,blank=True,null=True)
# Field to be added
It will be displayed in html like this
Insitutue hour of operation :   Monday  9.00 - 17.00 (Monday
will be hardcoded,Time will be filled by user)
  Tuesday 9.00 -
17.00 (Monday will be hardcoded,Time will be filled by user)
   and so on
# Note the weekdays like monday,  tuesday they are all hardcoded
as requirement but i don't want that to be hardcoded.
Also i am using a django forms  to display this.
How can i design this form field as well in models or What should
be the type of this field both in models and forms such that
weekdays remain dynamic(i can simply generate them from loop) and
the user can fill the time  and when he hits submit it will get
saved.
Thanks in advance.
--
Regards
Nikhil Verma
+91-958-273-3156


  --
  You received this message because you are subscribed to the
  Google Groups "Django users" group.
  To post to this group, send email to
  [3]django-users@googlegroups.com.
  To unsubscribe from this group, send email to
  [4]django-users+unsubscr...@googlegroups.com.
  For more options, visit this group at
  [5]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
  [6]django-users@googlegroups.com.

Re: advantages and disadvantages of Raw sql queries in django

2012-06-29 Thread Jon Black
Also, using ORM means you're less likely to be tied to a specific
database...or in other words, your hand-crafted SQL is likely to be
specific to certain databases.

On 06/30/2012 08:33 AM, Mike Dewhirst wrote:
> I firmly believe in using the ORM for everything until i am forced to
> use handwritten SQL.
> 
> The main reason is transparency of intentions when the source is
> examined by a non-DBA.
> 
> I want my code to be maintainable by other people and provably correct.
> I suppose you can unit-test code with embedded SQL but it adds an extra
> layer of complexity.
> 
> I could also argue against custom SQL because it contains business logic
> and i prefer to keep that all in one place, ie., in models in python code.
> 
> So the bottom line for me is to avoid it where possible.  Once
> everything is profiled and the last remaining bottlenecks are
> significant and cannot be removed unless I use custom SQL, that's when
> I'll do it.
> 
> Haven't gotten there yet.
> 
> -Original message-
> 
> *From: *vijay shanker *
> To: *Django users *
> Sent: *Sat, 30 Jun 2012, 14:35:54 AEST*
> Subject: *advantages and disadvantages of Raw sql queries in django
> 
> hi
> i want to know pros and cons associated with running raw sql queries
> over django's ORM .
> googled it out but couldn find many useful links.
> 
> -- 
> 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.




signature.asc
Description: OpenPGP digital signature


Re: jquery, json and forms

2012-07-02 Thread Jon Black
One approach is to pass json/html data in the response after saving and
use jQuery to update the page.

On 07/02/2012 05:12 PM, David wrote:
> Hello
> 
> I have a form that saves, and displays errors correctly when using
> javascript and without.
> 
> However, when my form saves I need to refresh the form with the new form
> data. How can I pass the form object through json back to my template
> please?
> 
> Thank you for any help.
> 
> -- 
> 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/-/83FaoYuJjFQJ.
> 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.




signature.asc
Description: OpenPGP digital signature


Re: Same virtual-env for all django projects

2012-07-03 Thread Jon Black
Bear in mind that you may want different packages in your
environments depending on the project. For example, you may have
a project that uses a maps app (from pip) which isn't required by
others. The general purpose of virtualenv is to setup clean,
self-contained environments. What would you do if one project had
a dependency that required a new version of another package that
another project can't use. :) Moreover, if you start using
virtualenvwrapper hooks (e.g. switch to the project directory
when 'workon' is called), it won't make sense anymore if you
share an environment.

Maybe I'm being a bit extreme, but it was a thought. Only you can
judge your needs.

--
Jon Black
www.jonblack.org


On Mon, Jul 2, 2012, at 16:19, Smaran Harihar wrote:

  Thanks Musicman

On Mon, Jul 2, 2012 at 4:17 PM, Lachlan Musicman
<[1]data...@gmail.com> wrote:

On Tue, Jul 3, 2012 at 10:52 AM, Smaran Harihar
<[2]smaran.hari...@gmail.com> wrote:
> Hi Djangoers,
>
> I am using virtual-env for my django project and I wanted to
know that is it
> ok to use the same virtual-env for all the django projects on
my system?
>
> or do I need to create a virtual-env for every other django
project?


  Of course you can! It's not necessarily a good idea for
  production
  sites, but it is fine.
  Cheers
  L.
  --
  You received this message because you are subscribed to the
  Google Groups "Django users" group.
  To post to this group, send email to
  [3]django-users@googlegroups.com.
  To unsubscribe from this group, send email to
  [4]django-users+unsubscr...@googlegroups.com.
  For more options, visit this group at
  [5]http://groups.google.com/group/django-users?hl=en.




  --
  Thanks & Regards

Smaran Harihar


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

References

1. mailto:data...@gmail.com
2. mailto:smaran.hari...@gmail.com
3. mailto:django-users@googlegroups.com
4. mailto:django-users%2bunsubscr...@googlegroups.com
5. 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: to add counter in the project

2012-07-03 Thread Jon Black
That's quite a vague requirement. You could override form_valid()
in your view and increment a counter in your model manually
before saving. It might pay to ask yourself why you need a
counter. Does it make more sense to record the actions in a
separate table and count the records? Will the count require
filtering later (e.g. number of counts each month, week, day).

--
Jon Black
www.jonblack.org


On Mon, Jul 2, 2012, at 23:25, Bharati Sharma wrote:

  I want to add counter in my project so that the value in the
  table increases as the data is put in the database. Can anyone
  help me plz.


  --
  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: Can't figure out how to obtain organized list of my friends

2012-07-03 Thread Jon Black
I agree with Kenneth. Your models seem odd. Why not use a
ManyToManyField? The django docs even provides quite a nice example
(see:
https://docs.djangoproject.com/en/dev/ref/models/fields/#django.db.models.ManyToManyField.symmetrical):

  class Person(models.Model):
  friends = models.ManyToManyField("self")

You could adapt this to your UserProfile I suppose.

-- 
Jon Black
www.jonblack.org


On Tue, Jul 3, 2012, at 12:57, kenneth gonsalves wrote:
> On Mon, 2012-07-02 at 20:31 -0700, Keith D. Cardin wrote:
> > I'm trying to create a "my friends" page, which will list the user's 
> > friends listed in alphabetical order.
> > I have two classes involved with this data: Profile [and] Friendship
> > 
> > *class Friendship(models.Model):*
> > friend= models.ForeignKey(User,
> > related_name='friend1')
> > friendwith  = models.ForeignKey(User,
> > related_name='friend2')
> > 
> > *class Profile(models.Model):*
> > user = models.OneToOneField(User,
> > unique=True,
> > verbose_name=_('user'),
> > related_name='profile')
> > first_name   = models.TextField(max_length=50)
> > last_name   = models.TextField(max_length=50)
> > 
> > The exact raw SQL query [successfully tested] is as follows:: 
> > *select profiles_profile.first_name,profiles_profile.last_name FROM 
> > profiles_profile, friends_friendship WHERE profiles_profile.user_id = 
> > friends_friendship.friendwith_id AND friends_friendship.friend_id =
> > 30 
> > ORDER BY first_name ASC;*
> > *
> > *
> > My problem is I'm not sure how to do this in Python. 
> > '30' is the user's id/pk. 
> 
> to get a list of friends of a particular user this may work:
> 
> first get the user:
> me = Profile.objects.get(user = myuser)
> 
> then get the friend1
> friends = me.fiiend1_set.all()
> 
> the confusing thing about your models is that it seems to me that your
> Friendship model should be split into two models.
> -- 
> 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-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: to add counter in the project

2012-07-03 Thread Jon Black
It sounds like you have different user's (User) with different
roles (Group with permission set) that have a resume:

class Resume(models.Model):
  resume = models.FileField()
  date_uploaded = models.DateTimeField()

You can then query by aggregating across the group and
date_uploaded fields. That's one option.

--
Jon Black
www.jonblack.org


On Tue, Jul 3, 2012, at 01:08, Bharati Sharma wrote:

  thanks Jon...

actually I am making project of faculty management system of my
college.I have added some of the faculty member's resume in the
database. i want a counter in my project that should increment
its value whenever a new faculty member's resume is added into
the database. yes, it will require filter also as i want it
should count no of assistant professors,no of associate
professors etc seperatelyhelp me please..
On Tue, Jul 3, 2012 at 12:48 AM, Jon Black <[1]jon_bl...@mm.st>
wrote:

That's quite a vague requirement. You could override form_valid()
in your view and increment a counter in your model manually
before saving. It might pay to ask yourself why you need a
counter. Does it make more sense to record the actions in a
separate table and count the records? Will the count require
filtering later (e.g. number of counts each month, week, day).

--
Jon Black
[2]www.jonblack.org


On Mon, Jul 2, 2012, at 23:25, Bharati Sharma wrote:

I want to add counter in my project so that the value in the
table increases as the data is put in the database. Can anyone
help me plz.


  --
  You received this message because you are subscribed to the
  Google Groups "Django users" group.
  To post to this group, send email to
  [3]django-users@googlegroups.com.
  To unsubscribe from this group, send email to
  [4]django-users+unsubscr...@googlegroups.com.
  For more options, visit this group at
  [5]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
  [6]django-users@googlegroups.com.
  To unsubscribe from this group, send email to
  [7]django-users+unsubscr...@googlegroups.com.
  For more options, visit this group at
  [8]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.

References

1. mailto:jon_bl...@mm.st
2. http://www.jonblack.org/
3. mailto:django-users@googlegroups.com
4. mailto:django-users%2bunsubscr...@googlegroups.com
5. http://groups.google.com/group/django-users?hl=en
6. mailto:django-users@googlegroups.com
7. mailto:django-users%2bunsubscr...@googlegroups.com
8. 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: Filter FieldError

2012-07-03 Thread Jon Black
I think you need a double underscore:

fieldname__startswith

On Tue, Jul 3, 2012, at 02:47, Saroja Parameswaran wrote:

While using filters on Django objects, I get the below error
message. Except equals, all the other options like _startswith,
_exact, _iexact shows the same error. I am using Django 1.4.



  FieldError: Cannot resolve keyword 'fieldname_exact' into
  field. Choices are:



 Can anyone tell me the solution?


  --
  You received this message because you are subscribed to the
  Google Groups "Django users" group.
  To view this discussion on the web visit
  [1]https://groups.google.com/d/msg/django-users/-/NJDqAyZcunAJ
  .
  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.

References

1. https://groups.google.com/d/msg/django-users/-/NJDqAyZcunAJ

-- 
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 Developer, Washington, D.C.

2012-07-03 Thread Jon Black
And also on http://djangogigs.com/
-- 
Jon Black
www.jonblack.org


On Tue, Jul 3, 2012, at 11:03, Itamar Reis Peixoto wrote:
> On Tue, Jul 3, 2012 at 10:43 AM, Andrew Moore 
> wrote:
> > Hello group.
> >
> > National Geographic is seeking Django developers, for permanent full-time
> > positions at their Washington, D.C. headquarters.
> >
> > If I can share more details, please let me know. propensitygr...@gmail.com
> > or and...@themidtowngroup.com.
> >
> > Thanks!
> >
> 
> 
> I think you can post this job at python.org job board.
> 
> 
> 
> 
> -- 
> 
> 
> Itamar Reis Peixoto
> msn, google talk: ita...@ispbrasil.com.br
> +55 11 4063 5033 (FIXO SP)
> +55 34 9158 9329 (TIM)
> +55 34 8806 3989 (OI)
> +55 34 3221 8599 (FIXO MG)
> 
> -- 
> 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: error : need more than 1 value to unpack

2012-07-04 Thread Jon Black
You're also returning mimetype="application/json" outside of the
request.is_ajax check. I doubt you want that.
On Wed, Jul 4, 2012, at 01:20, rafiee.nima wrote:

  Oh

I find out my mistake :D
On Wednesday, July 4, 2012 12:38:11 PM UTC+4:30, rafiee.nima
wrote:

  Hi I got below error from my view which handle ajax request

hotel_instance=Hotel.objects.get(id=request.POST['hotel'])

 need more than 1 value to unpack



here is my code



def add_room(request):
context={}
status=''
if request.is_ajax:
if request.POST:
hotel_instance=Hotel.objects.
get(request.POST['hotel'])
if request.POST['id'] > 0 :
room=HotelRoom.objects.get(id=request.POST['id'])
room.hotel=hotel_instance
room.number=request.POST['number']
room.bed_count=request.POST['bed_count']
room.ground_sleep=request.POST['ground_sleep']
room.view=request.POST['view']
room.reserved=request.POST['reserved']
[1]room.tv=request.POST['tv']
room.phone=request.POST['phone']
room.refrigerator=request.POST['refrigerator']
room.air_condition=request.POST['air_condition']
room.toilet=request.POST['toilet']
room.creator=request.user
room.save()
else:
room = HotelRoom(
hotel=hotel_instance,
number=request.POST['number'],
bed_count=request.POST['bed_count'],
ground_sleep=request.POST['ground_sleep'],
view=request.POST['view'],
reserved=request.POST['reserved'],
tv=request.POST['tv'],
phone=request.POST['phone'],
refrigerator=request.POST['refrigerator'],
air_condition=request.POST['air_condition'],
toilet=request.POST['toilet'],
creator=request.user )
room.save()

return HttpResponse({status:'success'},
mimetype="application/json")


  --
  You received this message because you are subscribed to the
  Google Groups "Django users" group.
  To view this discussion on the web visit
  [2]https://groups.google.com/d/msg/django-users/-/fNXaSuOjeKcJ
  .
  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.

References

1. http://room.tv/
2. https://groups.google.com/d/msg/django-users/-/fNXaSuOjeKcJ

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

2012-07-04 Thread Jon Black
Do you mean github? If so, see the github documentation.
Do you mean creating a git repository? If so, see the git
documentation.

--
Jon Black
www.jonblack.org


On Wed, Jul 4, 2012, at 02:25, Bharati Sharma wrote:

  I want to upload my project on the git ...kindly help me
  please..


  --
  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: DetailView - invalid literal for int() with base 10:

2012-07-05 Thread Jon Black
I'm not sure without running it, which I can't do now. I have
noticed that your slug is not and id, but the field PostSubReddit
is a foerignkey which might expect an id.

Unrelated, I think your models shouldn't be pluralised (e.g. Post
instead of Posts). If you want the table name to be plural, use
the Meta class.

--
Jon Black
www.jonblack.org


On Thu, Jul 5, 2012, at 02:07, Barry Morrison wrote:

  I've been beating my head against this all night and now into
  the morning...I have NO idea what I'm doing wrong and Google
  and Stack Overflow haven't been as helpful as I had hoped.
  https://gist.github.com/7dc0b98a2fe056379ae8
  Any help or guidance would be greatly appreciated!
  Thanks!!


  --
  You received this message because you are subscribed to the
  Google Groups "Django users" group.
  To view this discussion on the web visit
  [1]https://groups.google.com/d/msg/django-users/-/zgmrTPX9yIEJ
  .
  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.

References

1. https://groups.google.com/d/msg/django-users/-/zgmrTPX9yIEJ

-- 
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: DetailView - invalid literal for int() with base 10:

2012-07-05 Thread Jon Black
That doesn't help so much as there's no context information. Nice
to see the 'sysadmin' bit which wasn't in your original post.
Google throws up a lot of things for that:

http://www.google.nl/search?q=invalid+literal+for+int%28%29+with+
base+10%3A+%27sysadmin

--
Jon Black
www.jonblack.org


On Thu, Jul 5, 2012, at 02:17, Barry Morrison wrote:

  Apologies, here is the error output if it helps.

ValueError at /favs/Reddit/sysadmin/

invalid literal for int() with base 10: 'sysadmin'

Request Method: GET
Request URL: http://127.0.0.1:8000/favs/Reddit/sysadmin/
Django Version: 1.4
Exception Type: ValueError
Exception Value:
invalid literal for int() with base 10: 'sysadmin'

Exception Location:
/home/bmorriso/LocalRepository/Myosotis/venv/local/lib/python2.7/
site-packages/django/db/models/fields/__init__.py in
get_prep_value, line 537
Python Executable:
/home/bmorriso/LocalRepository/Myosotis/venv/bin/python
Python Version: 2.7.3
Python Path:
['/home/bmorriso/LocalRepository/Myosotis/venv/local/lib/python2.7/site-pa
ckages/requests/packages',
 '/home/bmorriso/LocalRepository/Myosotis',
 '/home/bmorriso/LocalRepository/Myosotis/venv/local/lib/python2.7/site-pa
ckages/setuptools-0.6c11-py2.7.egg',
 '/home/bmorriso/LocalRepository/Myosotis/venv/local/lib/python2.7/site-pa
ckages/pip-1.1-py2.7.egg',
 '/home/bmorriso/LocalRepository/Myosotis/venv/lib/python2.7/site-packages
/setuptools-0.6c11-py2.7.egg',
 '/home/bmorriso/LocalRepository/Myosotis/venv/lib/python2.7/site-packages
/pip-1.1-py2.7.egg',
 '/home/bmorriso/LocalRepository/Myosotis/venv/lib/python2.7',
 '/home/bmorriso/LocalRepository/Myosotis/venv/lib/python2.7/plat-linux2',
 '/home/bmorriso/LocalRepository/Myosotis/venv/lib/python2.7/lib-tk',
 '/home/bmorriso/LocalRepository/Myosotis/venv/lib/python2.7/lib-old',
 '/home/bmorriso/LocalRepository/Myosotis/venv/lib/python2.7/lib-dynload',
 '/usr/lib/python2.7',
 '/usr/lib/python2.7/plat-linux2',
 '/usr/lib/python2.7/lib-tk',
 '/home/bmorriso/LocalRepository/Myosotis/venv/local/lib/python2.7/site-pa
ckages',
 '/home/bmorriso/LocalRepository/Myosotis/venv/lib/python2.7/site-packages
']

Server time: Thu, 5 Jul 2012 02:03:21 -0700

  On Thursday, July 5, 2012 2:13:59 AM UTC-7, Jon Black wrote:

I'm not sure without running it, which I can't do now. I have
noticed that your slug is not and id, but the field PostSubReddit
is a foerignkey which might expect an id.

Unrelated, I think your models shouldn't be pluralised (e.g. Post
instead of Posts). If you want the table name to be plural, use
the Meta class.

--
Jon Black
[1]www.jonblack.org


On Thu, Jul 5, 2012, at 02:07, Barry Morrison wrote:

  I've been beating my head against this all night and now into
  the morning...I have NO idea what I'm doing wrong and Google
  and Stack Overflow haven't been as helpful as I had hoped.
  [2]https://gist.github.com/7dc0b98a2fe056379ae8
  Any help or guidance would be greatly appreciated!
  Thanks!!


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



  --
  You received this message because you are subscribed to the
  Google Groups "Django users" group.
  To view this discussion on the web visit
  [7]https://groups.google.com/d/msg/django-users/-/aXIXIb3UGegJ
  .
  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.

References

1. http://www.jonblack.org/
2. https://gist.github.com/7dc0b98a2fe056379ae8
3. https://groups.google.com/d/msg/django-users/-/zgmrTPX9yIEJ
4. mailto:django-users@googlegroups.com
5. mailto:django-users%2bunsubscr...@googlegroups.com
6. http://groups.google.com/group/django-users?hl=en
7. https://groups.google.com/d/msg/django-users/-/aXIXIb3UGegJ

-- 
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: DetailView - invalid literal for int() with base 10:

2012-07-05 Thread Jon Black
Hit send too soon then. My guess is that your kwargs being passed
to filter() contains some suspect things.
--
Jon Black
www.jonblack.org


On Thu, Jul 5, 2012, at 11:27, Jon Black wrote:

That doesn't help so much as there's no context information. Nice
to see the 'sysadmin' bit which wasn't in your original post.
Google throws up a lot of things for that:

http://www.google.nl/search?q=invalid+literal+for+int%28%29+with+
base+10%3A+%27sysadmin

--
Jon Black
www.jonblack.org


On Thu, Jul 5, 2012, at 02:17, Barry Morrison wrote:

  Apologies, here is the error output if it helps.

ValueError at /favs/Reddit/sysadmin/

invalid literal for int() with base 10: 'sysadmin'

Request Method: GET
Request URL: http://127.0.0.1:8000/favs/Reddit/sysadmin/
Django Version: 1.4
Exception Type: ValueError
Exception Value:
invalid literal for int() with base 10: 'sysadmin'

Exception Location:
/home/bmorriso/LocalRepository/Myosotis/venv/local/lib/python2.7/
site-packages/django/db/models/fields/__init__.py in
get_prep_value, line 537
Python Executable:
/home/bmorriso/LocalRepository/Myosotis/venv/bin/python
Python Version: 2.7.3
Python Path:
['/home/bmorriso/LocalRepository/Myosotis/venv/local/lib/python2.7/site-pa
ckages/requests/packages',
 '/home/bmorriso/LocalRepository/Myosotis',
 '/home/bmorriso/LocalRepository/Myosotis/venv/local/lib/python2.7/site-pa
ckages/setuptools-0.6c11-py2.7.egg',
 '/home/bmorriso/LocalRepository/Myosotis/venv/local/lib/python2.7/site-pa
ckages/pip-1.1-py2.7.egg',
 '/home/bmorriso/LocalRepository/Myosotis/venv/lib/python2.7/site-packages
/setuptools-0.6c11-py2.7.egg',
 '/home/bmorriso/LocalRepository/Myosotis/venv/lib/python2.7/site-packages
/pip-1.1-py2.7.egg',
 '/home/bmorriso/LocalRepository/Myosotis/venv/lib/python2.7',
 '/home/bmorriso/LocalRepository/Myosotis/venv/lib/python2.7/plat-linux2',
 '/home/bmorriso/LocalRepository/Myosotis/venv/lib/python2.7/lib-tk',
 '/home/bmorriso/LocalRepository/Myosotis/venv/lib/python2.7/lib-old',
 '/home/bmorriso/LocalRepository/Myosotis/venv/lib/python2.7/lib-dynload',
 '/usr/lib/python2.7',
 '/usr/lib/python2.7/plat-linux2',
 '/usr/lib/python2.7/lib-tk',
 '/home/bmorriso/LocalRepository/Myosotis/venv/local/lib/python2.7/site-pa
ckages',
 '/home/bmorriso/LocalRepository/Myosotis/venv/lib/python2.7/site-packages
']

Server time: Thu, 5 Jul 2012 02:03:21 -0700

  On Thursday, July 5, 2012 2:13:59 AM UTC-7, Jon Black wrote:

I'm not sure without running it, which I can't do now. I have
noticed that your slug is not and id, but the field PostSubReddit
is a foerignkey which might expect an id.

Unrelated, I think your models shouldn't be pluralised (e.g. Post
instead of Posts). If you want the table name to be plural, use
the Meta class.

--
Jon Black
[1]www.jonblack.org


On Thu, Jul 5, 2012, at 02:07, Barry Morrison wrote:

  I've been beating my head against this all night and now into
  the morning...I have NO idea what I'm doing wrong and Google
  and Stack Overflow haven't been as helpful as I had hoped.
  [2]https://gist.github.com/7dc0b98a2fe056379ae8
  Any help or guidance would be greatly appreciated!
  Thanks!!


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



  --
  You received this message because you are subscribed to the
  Google Groups "Django users" group.
  To view this discussion on the web visit
  [7]https://groups.google.com/d/msg/django-users/-/aXIXIb3UGegJ
  .
  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.

References

1. http://www.jonblack.org/
2. https://gist.github.com/7dc0b98a2fe056379ae8
3. https://groups.google.com/d/msg/django-users/-/zgmrTPX9yIEJ
4. mailto:django-users@googlegroups.com
5. mailto:django-users%2bunsubscr...@googlegroups.com
6. http://groups.google

Re: insert html into a form from Django code (not template)

2012-07-05 Thread Jon Black
This
(https://docs.djangoproject.com/en/dev/topics/forms/?from=olddocs
#customizing-the-form-template) and more generally the entire
page explains how to work with forms.
--
Jon Black
www.jonblack.org


On Thu, Jul 5, 2012, at 02:57, angelika wrote:

  Is there a way to insert arbitrary html into a form from the
  Django code, and not in the template? The equivalent of
  #markup in a Drupal form.



/Angelika


  --
  You received this message because you are subscribed to the
  Google Groups "Django users" group.
  To view this discussion on the web visit
  [1]https://groups.google.com/d/msg/django-users/-/ErDblgugM7wJ
  .
  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.

References

1. https://groups.google.com/d/msg/django-users/-/ErDblgugM7wJ

-- 
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: insert html into a form from Django code (not template)

2012-07-05 Thread Jon Black
I've never done this, so I'm just throwing out ideas to try and
be helpful. I've found your stackoverflow post as well, which has
more information.
(http://stackoverflow.com/questions/11341118/printing-repeated-dj
ango-form-fields-individually)

Have you tried looping over the fields in the template? I know
this is in the template, but you can add the text you want still:

{% for field in form %}
  Some stuff I want here that form.as_p won't do for me
  
 {{ field.errors }}
 {{ field.label_tag }}: {{ field }}
  
{% endfor %}

--
Jon Black
www.jonblack.org


On Thu, Jul 5, 2012, at 03:20, angelika wrote:

  Thanks, but I am asking if there is a way to insert html into
  a form from the backend code, and not in the template?
  On Thursday, July 5, 2012 11:57:57 AM UTC+2, angelika wrote:

  Is there a way to insert arbitrary html into a form from the
  Django code, and not in the template? The equivalent of
  #markup in a Drupal form.



/Angelika


  --
  You received this message because you are subscribed to the
  Google Groups "Django users" group.
  To view this discussion on the web visit
  [1]https://groups.google.com/d/msg/django-users/-/y7Inar5KaoEJ
  .
  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.

References

1. https://groups.google.com/d/msg/django-users/-/y7Inar5KaoEJ

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



Release considerations

2012-07-09 Thread Jon Black
I've been working on a task management project and am at a point where
I'm happy to make my first release. The idea is that people can install
the project on their own server (at home, at work, wherever) and use it
to manage their tasks.

What should I consider doing before making the code available to both
make life easier for the users/keep private information out of the
repository?

--

Jon Black
www.jonblack.org



signature.asc
Description: OpenPGP digital signature


Re: Release considerations

2012-07-10 Thread Jon Black
Thanks Reinout, that's a great checklist - much more than I thought of.
-- 
Jon Black
www.jonblack.org


On Tue, Jul 10, 2012, at 22:15, Reinout van Rees wrote:
> On 10-07-12 08:24, Jon Black wrote:
> > I've been working on a task management project and am at a point where
> > I'm happy to make my first release. The idea is that people can install
> > the project on their own server (at home, at work, wherever) and use it
> > to manage their tasks.
> >
> > What should I consider doing before making the code available to both
> > make life easier for the users/keep private information out of the
> > repository?
> 
> First you have to get the basics right like a proper setup.py, a README, 
> a changelog, that sort of stuff.
> 
> If you're looking at how-to-package-a-django-site examples, I'd look at 
> sentry. I liked the way they packaged it. Install it in a virtualenv and 
> it'll set up a django site for you. A custom settings file is installed 
> in some ~/.sentry directory, with defaults imported from a sentry 
> default settings file. Works fine. Pretty clear.
> 
> Make sure you've got example configurations on how to integrate it with 
> a webserver (apache/nginx).
> 
> 
> Reinout
> 
> -- 
> Reinout van Reeshttp://reinout.vanrees.org/
> rein...@vanrees.org http://www.nelen-schuurmans.nl/
> "If you're not sure what to do, make something. -- Paul Graham"
> 
> 
> 
> -- 
> 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.



Prioritise 0.1 released

2012-07-14 Thread Jon Black
I'm pleased to announce the very first release of my django-powered task
manager called prioritise, released under the BSD license.

This is my first ever django project, which I started learning two
months ago. So whilst I encourage your comments, please be nice. :)

I've written a blog post with more details, including the ubiquitous
screenshot, here: http://jonblack.org/2012/07/14/prioritise-0-1-released/

If you just want the code to try it out (yay!), go here:
https://github.com/jonblack/prioritise

Thanks!

--
Jon Black
www.jonblack.org



signature.asc
Description: OpenPGP digital signature


Re: Prioritise 0.1 released

2012-07-14 Thread Jon Black
Thanks for the kind words. I skipped unit tests to make learning django
simpler. I fully intend to add unit tests in future updates. Thanks for
the reminder, though :)

On 07/14/2012 05:31 PM, George Silva wrote:
> HI Jon,
> 
> Congratulations of your first public Django project. It seems very
> useful. Nice coding style, good follow of the guidelines, etc :D.
> 
> THe only thing missing that I've found are unit tests, since they might
> demonstrate to the public how much your product is reliable and
> incentivate usage.
> 
> Other than that, congratulations.
> 
> On Sat, Jul 14, 2012 at 5:35 AM, Jon Black  <mailto:jon_bl...@mm.st>> wrote:
> 
> I'm pleased to announce the very first release of my django-powered task
> manager called prioritise, released under the BSD license.
> 
> This is my first ever django project, which I started learning two
> months ago. So whilst I encourage your comments, please be nice. :)
> 
> I've written a blog post with more details, including the ubiquitous
> screenshot, here:
> http://jonblack.org/2012/07/14/prioritise-0-1-released/
> 
> If you just want the code to try it out (yay!), go here:
> https://github.com/jonblack/prioritise
> 
> Thanks!
> 
> --
> Jon Black
> www.jonblack.org <http://www.jonblack.org>
> 
> 
> 
> 
> -- 
> George R. C. Silva
> 
> Desenvolvimento em GIS
> http://geoprocessamento.net
> http://blog.geoprocessamento.net
> 
> -- 
> 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.




signature.asc
Description: OpenPGP digital signature