Re: Model-driven Django development

2012-01-22 Thread Venkatraman S
On Sat, Jan 21, 2012 at 9:20 AM, Alec Taylor  wrote:

> At University I've learned various techniques for model-driven
> developments, such as:
> - Class diagrams (generate code)
> - ERD Diagrams (generate db code [e.g. SQL])
>
> Can any of these sorts of—or for that matter, any sort of—model-driven
> development techniques be used for Django?
>
>
I always prefer handcoding stuff; though there was this project
online(guess it was djangopluggables),
by which you can define your entire project plus models online (web
interface) and the same would generate the
entire project structure along with models etc.

(Google on the project name, i dont remember exactly).

-V

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



Confused with django model Limit and Offset Implementation

2012-01-22 Thread Swaroop Shankar V
Hi,
Am trying to create a custom pagination for my project, but am seriously
struck with the django implementation of Limit and offset. I went through
the documents, instead of making me understand how it works, i ended up
more confused. So suppose I have a page limit of 3 records per page and if
i want to load the second set of records how should the following statement
be?

Data = NewsFeedStory.objects.order_by('-updated_on')[?:?]

and similarly if i want to load the 3rd set with same page limit, how
should the same statement be? I played with the django shell to figure out
how this works but am still confused. Please help.

Thanks and Regards,

Swaroop Shankar V

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



I need help with Python Tools for Visual Studio 2010 and Django

2012-01-22 Thread JJ Zolper
Hello everyone,

I was able to install Django to my machine and before I was using the 
command prompt. Django's path is in my Windows 7 64 bit Enterprise 
Environment variable. Python worked fine as well too. I also installed 
IPython because I heard it was useful but I haven't tried that yet. 
Everything has been good so far. I would like some input on what I am 
currently trying now.

I have gone ahead and installed IronPython. I already had Visual Studio 
2010 on my computer so I was using that. I also installed Python Tools for 
Visual Studio. As I mentioned before I already have Python 2.7.2 installed.

I was able to see the image/window in step 3 here: 
http://pytools.codeplex.com/wikipage?title=Installation%20-%20details&referringTitle=Home

It shows the options pane for Python Tools for Visual Studio. I was able to 
see that PT4VS (Python Tools for Visual Studio) was correctly including the 
location of the Python install at C:/Python27/python.py. Everything looked 
good there as it seems that Python was incorporated into PT4VS. I was 
trying to continue through the tutorial but I was having problems. I tried 
this command: python manage.py runserver but I only recieved a traceback 
error.

Additionally in PT4VS there is a field for a startup script. I wrote one 
and here it is:

import os
import IPython
import django
os.chdir('c:\\MTDevelopment\\Django\\newartists')

This so that I could change my directory to where my startproject was set 
with all the django web framework files. Also to import IPython and django 
as you see here. That seemed to work as I anticipated.

What I am asking you is why am I not able to get the full power of Django? 
In my command prompt I wasn't inside the python interpreter and ran the 
Django commands and everything worked fine. However, I was under the 
impression that with a Python interpreter in VS that I could have 
everything come in in a start up script and just go on my way coding with 
Django having set the directory to the location of my startproject?

When I type: django and IPython into my PT4VS now I see:

>>> IPython

>>> django


so it is imported it correctly I think but I'm not able to use it. I've 
been working hard on teaching myself how to get all this set up and any 
help from you all would make my time working on this a lot easier!

Thanks so much,

JJ Zolper

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



Transition from VPS(WHM/CPanel) to EC2

2012-01-22 Thread brian
I'm in the process of transitioning from a VPS (WHM/CPanel) to EC2.
I've found some great how to's on setting up a machine for the
cloud[1] but I'm not sure the best setup to add some of the WHM/CPanel
features.

Here are some of the features of cpanel I use:
1. Cpanel monitors the services (i.e. apache) and restarts them if
they crash.  I'm thinking about using supervisord for this.  Does
anyone have experience with this or is there other tools I should be
looking at?
2. I'm running a custom DNS(BIND).  I'm planning on switching to
Amazon Route 53.
3. I'm switching to PostgreSQL and I'd like to have something similar
to myPhpAdmin.
4. Creating a  backup script seems pretty straight forward.
5. What is the best way to create a firewall to block certain IPs?
I'll have an nginx server in front of apache.

How have others implemented these features?  Is there anything else I
should be thinking about?  I don't mind a command line interface.

Brian

[1] 
http://blip.tv/pycon-us-videos-2009-2010-2011/django-deployment-workshop-3651591

-- 
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 make 404.html template to be used. Keep getting Apache 500 Internal Server Error instead.

2012-01-22 Thread Reinout van Rees

On 21-01-12 20:27, Chris Seberino wrote:


AttributeError: 'module' object has no attribute 'handler500'


On older Django versions (1.2 and earlier, iirc), you needed to import 
handler500 from django.conf.urls.defaults in your urls.py.


That's why there's often a "star import" in urls.py files:

from django.conf.urls.defaults import *


You probably thought a star import to be dirty (you're completely right) 
and cleaned it up by only importing what you needed.


There's a hidden requirement that you also need to import handler500. 
The latest Django doesn't have this requirement, btw.




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.



Re: Django Form - This field is required.What am I missing.

2012-01-22 Thread Daniel Roseman
On Sunday, 22 January 2012 10:42:53 UTC, Johan wrote:
>
> Hi I have a form that has a required email field. This due to the fact 
> that the model requires an email. However, I don't display the email 
> field on the form. So when the post gets back into my view the email 
> field is empty. I then thought I would do the following just before 
> the form.is_valid() : 
>
>  form = students.forms.StudentForm(request.POST) 
>  form.instance.email=user.email 
>
> User is a session variable which contains the correct email for the 
> session. The above code however still fail with is_valid. I even 
> changed the forms clean_email() to return the correct email. But, I 
> still get 'This field is required'. 
>
> Any help would be appreciated. 
>
>

If you don't want the email field to be displayed or validated, you should 
exclude it from the form by using the `exclude` tuple in the form's Meta 
class.  Then, on saving, you can do:
student = form.save(commit=False)
student.email = user.email
student.save()
--
DR.

-- 
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/-/N3llNx-6gdcJ.
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 - This field is required.What am I missing.

2012-01-22 Thread James


On Jan 22, 5:42 am, Johan  wrote:
> Hi I have a form that has a required email field. This due to the fact
> that the model requires an email. However, I don't display the email
> field on the form. So when the post gets back into my view the email
> field is empty. I then thought I would do the following just before
> the form.is_valid() :
>
>  form = students.forms.StudentForm(request.POST)
>  form.instance.email=user.email
>
> User is a session variable which contains the correct email for the
> session. The above code however still fail with is_valid. I even
> changed the forms clean_email() to return the correct email. But, I
> still get 'This field is required'.
>
> Any help would be appreciated.

One:

You can change the default behavior of the widget so it is hidden. The
email address will come back in the post data (this means you don't
mind the email address in the raw html). This also assumes you are
using modelforms.

Two:

Alter the POST data upon return so you add the email address to it.

Three:

Create the model first (or retrieve the existing model) and do this
instead: form = students.forms.StudentForm(request.POST,
instance=students_model)

Four:

Again, assuming you are using model forms, change the email address
field to (blank=True, null=True). Once you save the modelform and a
model is returned, you can then save the email address directly to the
field, eg:

model = form.save(commit=False)
model.email = email
model.save()

(it might be you don't have to have null=True if you always do commit
= False, I'm not 100% certain)

I think any of those should work as a workaround for your problem.

-- 
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: Why can't erase this model object? "AssertionError: Question object can't be deleted because its id attribute is set to None."

2012-01-22 Thread akaariai
There is still the possibility that you really have a row where the PK
is somehow null. That would need an investigation through SQL. If so,
there is an error somewhere, either in your database schema, or maybe
in Django itself.

 - Anssi

On Jan 22, 4:49 am, JohnA  wrote:
> Is your code really that simple - I mean get the queryset and
> immediately try to delete something out of it?  If so, maybe it's time
> to step through the delete in the debugger.  Querysets are lazy but I
> assume that referencing an item in the queryset kike you do will cause
> the actual data to get feteched.  Maybe the problem is trying to
> delete something directly out of the queryset, or maybe you're somehow
> deleting the same record twice, or maybe django is somehow getting
> confused while performing the operation.
>
> -- John
>
> On Jan 21, 6:39 pm, Chris Seberino  wrote:
>
>
>
>
>
>
>
> > On Jan 21, 2:43 pm, JohnA  wrote:
>
> > > How are you finding these objects?  That might point to the answer.
>
> > > Probably the likeliest explanation is that you are creating the
> > > objects but not saving them.
>
> > In the Django shell I do
>
> > quests = Question.objects.all()
> > quests[579].delete()
>
> > Why does the objects.all() invocation add this id=None crud to quests
> > list?
>
> > cs

-- 
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: Internationalization and localization

2012-01-22 Thread Daniel Gerzo

On 21.1.2012 22:53, Radek Valachovic wrote:

but thats developer edition not released yet


well you can use https://github.com/brocaar/django-i18nurls instead 
(which is basically the same thing which was imported into django) until 
1.4 is released.



you need django 1.4 and i18n_patterns:

https://docs.djangoproject.__com/en/dev/topics/i18n/__translation/#django.conf.urls.__i18n.i18n_patterns




--
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 Form - This field is required.What am I missing.

2012-01-22 Thread Johan
Hi I have a form that has a required email field. This due to the fact
that the model requires an email. However, I don't display the email
field on the form. So when the post gets back into my view the email
field is empty. I then thought I would do the following just before
the form.is_valid() :

 form = students.forms.StudentForm(request.POST)
 form.instance.email=user.email

User is a session variable which contains the correct email for the
session. The above code however still fail with is_valid. I even
changed the forms clean_email() to return the correct email. But, I
still get 'This field is required'.

Any help would be appreciated.

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



Setting Network settings from Python/Django

2012-01-22 Thread Ganesh Kumar
Hi guys

I'm working on a simple web interface for an embedded computer. The
computer will ship with a static default ip that will then need to be
updated by the install tech who may not be tech/linux savvy.

Basicly I need to change the following system settings from a Django app.

   1. IP Addres
   2. Subnet
   3. Default Gateway
   4. DNS Servers 1&2

I realize that I can could just overwrite the config files in linux but I
was wondering if there is a more "Python" way of doing it.

I want any ready to use module is there, please guide me.


-Ganesh.
Did I learn something today? If not, I wasted it.

-- 
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 can I go about this?

2012-01-22 Thread coded kid
Thanks for the reply. I don't really mean twitter clone, just want
want users to post update, so their friends can comment, and reshare
the post. And it will be build in django.

Donald Casson wrote:
> This is a very open ended question.  There are many different ways in which 
> you could achieve the same thing.
>
>
> Just offering a suggestion here:
>
> I would take a read through the retwis docs, although it is php and redis it 
> should give you enough of an understanding on how to implement some of the 
> ideas in django.
>
> http://redis.io/topics/twitter-clone
>
> Cheers
> Don
>
>
>
> On 22/01/2012, at 6:11 PM, coded kid wrote:
>
> > Hey guys, please I want you to give me a brief on how I can go about
> > making users post status update for their friends to see. Just like
> > how its been done on twitter. Where you tweet whats happening and
> > after tweeting its will display your status with reply, retweet and
> > favourite button below. Hope you get my point?
> >
> > --
> > 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 can I go about this?

2012-01-22 Thread Donald Casson
This is a very open ended question.  There are many different ways in which you 
could achieve the same thing.


Just offering a suggestion here: 

I would take a read through the retwis docs, although it is php and redis it 
should give you enough of an understanding on how to implement some of the 
ideas in django.

http://redis.io/topics/twitter-clone

Cheers
Don



On 22/01/2012, at 6:11 PM, coded kid wrote:

> Hey guys, please I want you to give me a brief on how I can go about
> making users post status update for their friends to see. Just like
> how its been done on twitter. Where you tweet whats happening and
> after tweeting its will display your status with reply, retweet and
> favourite button below. Hope you get my point?
> 
> -- 
> 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.



How can I go about this?

2012-01-22 Thread coded kid
Hey guys, please I want you to give me a brief on how I can go about
making users post status update for their friends to see. Just like
how its been done on twitter. Where you tweet whats happening and
after tweeting its will display your status with reply, retweet and
favourite button below. Hope you get my point?

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