Re: Newbie Django queryset question

2012-03-15 Thread Shawn Milochik

On 03/15/2012 11:22 PM, Murilo Vicentini wrote:
Uhmmm, thank you a lot. That was what I was looking for! Sorry for 
wasting your time. One last question, does this double-underscore 
notation work at my html template? Because after filtering I will want 
to display the information of the different models at one row of my table.




Try it and find out. ^_^

Also, a word of caution for things like that -- they lead to amazingly 
slow pages. Make sure you read up on select_related before you go crazy 
referring to related items in your templates (or views, for that matter).


https://docs.djangoproject.com/en/1.3/ref/models/querysets/#select-related

I suggest ignoring the "depth" kwarg and using the method demonstrated 
with "room__building" as an example. But read the preceding text first 
to understand how it works in general.



--
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: Query Set to search for a combination of model fields?

2012-03-15 Thread Shawn Milochik
Look at how the Q objects are being used in the example and it's clear 
why that is. It's using the pipe (|) to do an "or" query.


If you want to change how the search works you'll have to add more code:

1. Split the search parameters on whitespace.
2. Create Q objects for searching in either or both fields for the 
values and use pipe (|) and ampersand (&) to "or" or "and" them as 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-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.



Query Set to search for a combination of model fields?

2012-03-15 Thread Gchorn
Hello All,

As a learning project, I am currently putting together a site to track
all of the teams and players in the NBA along with their basic
statistics and information.  My two models so far are, as you might
expect, players and teams.  For the player model, I have separate
database fields for the player's first name and last name.  Setting it
up this way just seemed like good practice for being able to sort on
last name, etc., later on.  However, now that I am trying to implement
a simple player search function on the site, I am coming up against a
wee problem.

I am using the following method (from here: 
http://www.djangobook.com/en/1.0/chapter07/)
to allow for a simple search through my database for players based on
their first and last names:

from django.db.models import Q

def search(request):
query = request.GET.get('q','')
if query:
qset = (
Q(first_name__icontains=query) |
Q(last_name__icontains=query)
)
results = Player.objects.filter(qset).distinct()
else:
results = []
return render(request,'search.html', {
'results': results,
'query': query
})

And then in my view (html file):



Player name: 




{% if query %}
Search Results for "{{ query|escape }}":

{% if results %}

{% for player in results %}
{{ 
player|escape }}

{% endfor %}

{% else %}
No players matched the search.
{% endif %}
{% endif %}


This has been working fine, EXCEPT that it only allows the user to
search for a player's first name OR last name, and not their full
name.  I know that this is because the query is only looking into the
individual model fields for results.  In my models.py file I have a
custom method defined that returns the player's full name by joining
the first and last name fields for a given player together, but this
doesn't help because currently, my search function will only look
through model fields in the database.

I know that one option is for me to add an additional field in my
database for a player's "full name", but that seems to violate the DRY
principle, and feels stupid.  So it seems I have two other choices:

1) Make my search method able to search the results of custom model
methods, rather than just model fields.  So rather than just looking
at player.first_name and player.last_name, it looks at those two
fields AND the result of

def name(self):
return self.first_name+' '+self.last_name

2) Make my search method able to break up a multi-word input into
individual words and return the results for any and all of these words
found in the database.  I have found a method that appears to do
something like this here:
http://julienphalip.com/post/2825034077/adding-search-to-a-django-site-in-a-snap,
but I don't understand what it does very well as the author doesn't
explain it for newbs like me (I know he's using regexes to break up
the search input, but after that I don't get it), and I don't know
where to put the first bit of code he writes (I don't understand "copy/
paste the following snippet anywhere in your project"--does this mean
in the views.py file, or in its own separate file which I then have to
import as a module in the views.py file, or somewhere else?).

Any help with this would be much appreciated--I feel like I'm 90% of
the way there, but being able to search only for first OR last name
(and not full name as well) seems really lame so I want to figure this
out!

thanks,
Guillaume

PS - I know I referenced an outdated version of the Django book, but
if that's really an issue, please explain how I should update my code
rather than just wagging your finger at me and linking to the latest
docs, as the only reason I'm using this outdated Django book version
is because I couldn't find anything about how to implement this kind
of search in the latest docs!  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: Newbie Django queryset question

2012-03-15 Thread Murilo Vicentini
Uhmmm, thank you a lot. That was what I was looking for! Sorry for wasting 
your time. One last question, does this double-underscore notation work at 
my html template? Because after filtering I will want to display the 
information of the different models at one row of my table.

On Friday, March 16, 2012 12:09:44 AM UTC-3, Shawn Milochik wrote:
>
>  You can certainly use Q objects to query across models, just as you can 
> in a normal QuerySet, by using the double-underscore notation.
>
>
> https://docs.djangoproject.com/en/1.3/topics/db/queries/#lookups-that-span-relationships
>
>
>  

-- 
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/-/sXps3T_6bDEJ.
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: Newbie Django queryset question

2012-03-15 Thread Shawn Milochik
You can certainly use Q objects to query across models, just as you can 
in a normal QuerySet, by using the double-underscore notation.


https://docs.djangoproject.com/en/1.3/topics/db/queries/#lookups-that-span-relationships


--
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: Newbie Django queryset question

2012-03-15 Thread Murilo Vicentini
But if I got it correctly I can use Q objects to make complex filters but 
they only apply to one model, what I need is a combination of the models. 
And since the search can return more than one (or even zero) objects I 
can't use get() to see the related objects. 

On Thursday, March 15, 2012 9:58:52 PM UTC-3, Shawn Milochik wrote:
>
>  If you don't know which fields your users will be searching on in 
> advance, you'll have to create Q objects and dynamically build your query 
> in your view.
>
>
> https://docs.djangoproject.com/en/1.3/topics/db/queries/#complex-lookups-with-q-objects
>
>
>  

-- 
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/-/P8Jn4YsOabEJ.
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: models and NULL in postgres

2012-03-15 Thread hack
Ahhh, that makes sense.  Thanks.  :)

On Thursday, March 15, 2012 10:19:47 PM UTC-4, dstufft wrote:
>
> Django uses an empty string instead of a NULL for an empty value for 
> CharField and Charfield subclasses 
>  
> On Thursday, March 15, 2012 at 10:18 PM, hack wrote:
>
> Something is a little strange with my database.  My models have fields 
> where the value is set as blank=True to allow null values.  My forms seem 
> to be saving values to the database just fine, even if the are blank/null. 
>  However, when I look at my database in phppgadmin all the rows show they 
> are set as NOT NULL, which implies they should not allow null values to be 
> saved.  Is there some bug with django and postres, which I am not aware of? 
>  Maybe just a bug in phppgadmin.  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/-/WPIOw8u8trkJ.
> 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 view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/BUUBMT0M4M4J.
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: models and NULL in postgres

2012-03-15 Thread Donald Stufft
Django uses an empty string instead of a NULL for an empty value for CharField 
and Charfield subclasses 


On Thursday, March 15, 2012 at 10:18 PM, hack wrote:

> Something is a little strange with my database.  My models have fields where 
> the value is set as blank=True to allow null values.  My forms seem to be 
> saving values to the database just fine, even if the are blank/null.  
> However, when I look at my database in phppgadmin all the rows show they are 
> set as NOT NULL, which implies they should not allow null values to be saved. 
>  Is there some bug with django and postres, which I am not aware of?  Maybe 
> just a bug in phppgadmin.  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/-/WPIOw8u8trkJ.
> To post to this group, send email to django-users@googlegroups.com 
> (mailto:django-users@googlegroups.com).
> To unsubscribe from this group, send email to 
> django-users+unsubscr...@googlegroups.com 
> (mailto: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.



models and NULL in postgres

2012-03-15 Thread hack
Something is a little strange with my database.  My models have fields 
where the value is set as blank=True to allow null values.  My forms seem 
to be saving values to the database just fine, even if the are blank/null. 
 However, when I look at my database in phppgadmin all the rows show they 
are set as NOT NULL, which implies they should not allow null values to be 
saved.  Is there some bug with django and postres, which I am not aware of? 
 Maybe just a bug in phppgadmin.  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/-/WPIOw8u8trkJ.
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 application performance estimates?

2012-03-15 Thread Kurtis Mullins
Just a quick correction on one of my last statements :)

In my opinion, paying $1,000 for a web application, and therefore expecting
> a large amount of traffic and probably income, is way too little to expect
> any kind of a guarantee -- let alone a guarantee that it'll scale to
> infinite and beyond.


I meant "paying $1,000 for a *scalable* web application, and therefore
expecting a large amount of traffic...". Sorry about that.

On Thu, Mar 15, 2012 at 9:55 PM, Kurtis Mullins wrote:

> Sorry for the late chime-in. Here's the "budget scalability" route we at
> http://www.fireflie.com are taking for our rewrite in Django.
>
> We decided to go with AWS. Initial hosting costs are free for the server
> until we are ready to push to production and need a larger instance. We are
> using Nginx for our front-end and uWSGI for our django application. Nginx
> makes it easy to add more Django Application Servers as needed without any
> down-time (Scaling through Parallelism). We can easily move our database
> (MySQL) to larger and more optimized EC2 Instances as needed. If we ever
> got to a point where we somehow outgrew Amazon (possible?), then it'd
> probably be time to re-think our application design and maybe move to
> dedicated hardware.
>
> There's a few major benefits here. First, there's no real extra
> development requirements to simply add more application servers -- so no
> higher development costs. Second, it's somewhat easy enough to upgrade
> instances as needed so you could write up some easy directions for your
> client and let them handle it if they don't want to pay you. Finally, you
> can take advantage of S3/Cloudfire for *cheap* data storage and the quick
> content delivery network. There's no internal bandwidth charges if you use
> S3 from an EC2 instance.
>
> I can see their perspective for wanting to be scalable off the bat.
> Computers and Bandwidth are cheap, developers are not. In the long run it
> can be very expensive to re-write an entire web application in a scalable
> manner if it's not done so in the beginning. I don't think you'd have this
> problem with Django unless you're doing something very custom and
> server-dependent. In my opinion, paying $1,000 for a web application, and
> therefore expecting a large amount of traffic and probably income, is way
> too little to expect any kind of a guarantee -- let alone a guarantee that
> it'll scale to infinite and beyond.
>
> Good luck!
>
> On Thu, Mar 15, 2012 at 9:10 PM, Sithembewena Lloyd Dube <
> zebr...@gmail.com> wrote:
>
>> And this - over time? I can only think of one phrase now - premature
>> optimisation?
>>
>> Think about it - to optimise an application, a developer needs measurable
>> metrics to work with? So, surely, beyond "good" or "best practice"
>> application architecture, the rest becomes a "wait and see" affair?
>>
>> I have a problem putting a sweeping scalability guarantee on a (for
>> example) USD1000 application. Many firms spend far more on the optimisation
>> alone - and that, with cold hard stats to work with.
>>
>>
>> On Thu, Mar 15, 2012 at 12:57 PM, kenneth gonsalves <
>> law...@thenilgiris.com> wrote:
>>
>>> On Thu, 2012-03-15 at 10:22 +0200, Sithembewena Lloyd Dube wrote:
>>> > Thanks for the response. The project will be hosted at WebFaction
>>> > (which I
>>> > recommended, having used their services with great results in the
>>> > past). It
>>> > will start off on shared hosting and could end up in a dedicated
>>> > server.
>>> > The client wants some sort of "performance guarantee".
>>>
>>> webfaction --> vps --> dedicated server --> many dedicated servers ...
>>> --
>>> 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.
>>>
>>>
>>
>>
>> --
>> Regards,
>> Sithembewena Lloyd Dube
>>
>> --
>> 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 application performance estimates?

2012-03-15 Thread Kurtis Mullins
Sorry for the late chime-in. Here's the "budget scalability" route we at
http://www.fireflie.com are taking for our rewrite in Django.

We decided to go with AWS. Initial hosting costs are free for the server
until we are ready to push to production and need a larger instance. We are
using Nginx for our front-end and uWSGI for our django application. Nginx
makes it easy to add more Django Application Servers as needed without any
down-time (Scaling through Parallelism). We can easily move our database
(MySQL) to larger and more optimized EC2 Instances as needed. If we ever
got to a point where we somehow outgrew Amazon (possible?), then it'd
probably be time to re-think our application design and maybe move to
dedicated hardware.

There's a few major benefits here. First, there's no real extra development
requirements to simply add more application servers -- so no higher
development costs. Second, it's somewhat easy enough to upgrade instances
as needed so you could write up some easy directions for your client and
let them handle it if they don't want to pay you. Finally, you can take
advantage of S3/Cloudfire for *cheap* data storage and the quick content
delivery network. There's no internal bandwidth charges if you use S3 from
an EC2 instance.

I can see their perspective for wanting to be scalable off the bat.
Computers and Bandwidth are cheap, developers are not. In the long run it
can be very expensive to re-write an entire web application in a scalable
manner if it's not done so in the beginning. I don't think you'd have this
problem with Django unless you're doing something very custom and
server-dependent. In my opinion, paying $1,000 for a web application, and
therefore expecting a large amount of traffic and probably income, is way
too little to expect any kind of a guarantee -- let alone a guarantee that
it'll scale to infinite and beyond.

Good luck!

On Thu, Mar 15, 2012 at 9:10 PM, Sithembewena Lloyd Dube
wrote:

> And this - over time? I can only think of one phrase now - premature
> optimisation?
>
> Think about it - to optimise an application, a developer needs measurable
> metrics to work with? So, surely, beyond "good" or "best practice"
> application architecture, the rest becomes a "wait and see" affair?
>
> I have a problem putting a sweeping scalability guarantee on a (for
> example) USD1000 application. Many firms spend far more on the optimisation
> alone - and that, with cold hard stats to work with.
>
>
> On Thu, Mar 15, 2012 at 12:57 PM, kenneth gonsalves <
> law...@thenilgiris.com> wrote:
>
>> On Thu, 2012-03-15 at 10:22 +0200, Sithembewena Lloyd Dube wrote:
>> > Thanks for the response. The project will be hosted at WebFaction
>> > (which I
>> > recommended, having used their services with great results in the
>> > past). It
>> > will start off on shared hosting and could end up in a dedicated
>> > server.
>> > The client wants some sort of "performance guarantee".
>>
>> webfaction --> vps --> dedicated server --> many dedicated servers ...
>> --
>> 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.
>>
>>
>
>
> --
> Regards,
> Sithembewena Lloyd Dube
>
> --
> 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 application performance estimates?

2012-03-15 Thread Sithembewena Lloyd Dube
And this - over time? I can only think of one phrase now - premature
optimisation?

Think about it - to optimise an application, a developer needs measurable
metrics to work with? So, surely, beyond "good" or "best practice"
application architecture, the rest becomes a "wait and see" affair?

I have a problem putting a sweeping scalability guarantee on a (for
example) USD1000 application. Many firms spend far more on the optimisation
alone - and that, with cold hard stats to work with.

On Thu, Mar 15, 2012 at 12:57 PM, kenneth gonsalves
wrote:

> On Thu, 2012-03-15 at 10:22 +0200, Sithembewena Lloyd Dube wrote:
> > Thanks for the response. The project will be hosted at WebFaction
> > (which I
> > recommended, having used their services with great results in the
> > past). It
> > will start off on shared hosting and could end up in a dedicated
> > server.
> > The client wants some sort of "performance guarantee".
>
> webfaction --> vps --> dedicated server --> many dedicated servers ...
> --
> 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.
>
>


-- 
Regards,
Sithembewena Lloyd Dube

-- 
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: Newbie Django queryset question

2012-03-15 Thread Shawn Milochik
If you don't know which fields your users will be searching on in 
advance, you'll have to create Q objects and dynamically build your 
query in your view.


https://docs.djangoproject.com/en/1.3/topics/db/queries/#complex-lookups-with-q-objects


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



Newbie Django queryset question

2012-03-15 Thread Murilo Vicentini
Hey guys, sorry if this is a newbie question, but I'm new at django and I'm 
having a real hard time trying to figure out how to solve this. So I have 
this model.
class Run(models.Model):
speccpus = models.ForeignKey('Speccpu')
hosts = models.ForeignKey('Host')

Task = models.IntegerField()
Path = models.CharField(max_length = 300)
Date_Time = models.DateTimeField()

class Host(models.Model):
Name = models.CharField(max_length = 100)
ip_addr = models.IPAddressField()
admin_ip_addr = models.IPAddressField()
Location = models.CharField(max_length = 100)

class Speccpu(models.Model):
Version = models.CharField(max_length = 50)
Base_score = models.IntegerField()
Peak_score = models.IntegerField()

So what i need to do is search a for an input in any of this fields, so 
they can return more than one row of a table, since i need to display on 
the screen a table containing the Run - Task, Path, Date_Time fields, also 
the Host Name field, and the Speccpu Base and peak score. I was thinking 
about doing something like an inner join of this three models, and then 
filtering. But i can't manage to do it. Does anyone have any ideia of how i 
can do it using the queryset API?

-- 
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/-/rEEVGXSHL4AJ.
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: "Dynamyc" modells

2012-03-15 Thread Juergen Schackmann
hi guys,
django-dynamo https://bitbucket.org/schacki/django-dynamo will let users 
create models dynamically on the fly through the admin. maybe this helps.
regards,
juergen

Am Dienstag, 13. März 2012 08:48:03 UTC+1 schrieb airween:
>
> hi,
>
> On Mon, Mar 12, 2012 at 09:51:43PM -0400, Dennis Lee Bieber wrote:
> > On Mon, 12 Mar 2012 22:14:27 +0100, Ervin Hegedüs 
> > declaimed the following in gmane.comp.python.django.user:
> > 
> > 
> > > Some promotion has few millions of records, different promotions have
> > > different format of codes, ... And general: I'm looking for an ultimate
> > > solution, and may be the next time every ListRecord will have different
> > > columns.
> > >
> > Strangely, your "ultimate solution" might mean implementing a 
> DBMS
> > AS the application, rather than just USING a DBMS...
> > 
> > That is: maintaining a data dictionary which contains "promotion
> > format", "promotion field", "field type", (maybe field position too,
> > along with fields to identify constraints on the valid values);
> [...]
>
> yes, it's absolutely true.
>
> But :), I'm so far from there I implement full of these.
>
>
> It's no problem, I'm just looking for a good solution, first it
> could be enough to implement all() method (and filter()), and
> there is an important invariant: in my (all) cases, the different
> ListItems has an intersect of columns, I mean there are a few
> columns, which exists in all ListItems object.
>
>
> Any idea?
>
>
> Thanks:
>
>
> a.
>
>
> -- 
> I � UTF-8
>
>

-- 
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/-/NonOheQhNWUJ.
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: Satchmo store as an app of a django project

2012-03-15 Thread kooliah

On 03/15/2012 10:41 PM, Joel Goldstick wrote:

My settings won't work for you unless you put your files in the same
directories as I do.
   
I did, i change settings according to my strcture trying either relative 
than absolute path, but it does not solve the problem
I think it's some prefix to put somewhere because moving up of one 
folder (making "store" site root) everything is ok


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: Satchmo store as an app of a django project

2012-03-15 Thread Joel Goldstick
On Thu, Mar 15, 2012 at 4:59 PM, kooliah
 wrote:
> On 03/15/2012 09:22 PM, Joel Goldstick wrote:
>>
>> I had problems similar to you with my static files. First, I am
>> assuming you are using v1.3 of Django?  V1.0 did this differently
>>
>> Below is a snippet from my settings.py:
>>
>> Django is doing some things I don't really understand, but in your
>> case I think you should add entries to the STATICFILES_DIRS tuple.
>> You should read carefully the django docs concerning static file
>> settings.  Its confusing -- at least to me.
>>
>> # Absolute path to the directory static files should be collected to.
>> # Don't put anything in this directory yourself; store your static files
>> # in apps' "static/" subdirectories and in STATICFILES_DIRS.
>> # Example: "/home/media/media.lawrence.com/static/"
>> STATIC_ROOT = os.path.join(PROJECT_PATH,'static/')
>>
>> # URL prefix for static files.
>> # Example: "http://media.lawrence.com/static/;
>> STATIC_URL = '/static/'
>>
>> # URL prefix for admin static files -- CSS, JavaScript and images.
>> # Make sure to use a trailing slash.
>> # Examples: "http://foo.com/static/admin/;, "/static/admin/".
>> ADMIN_MEDIA_PREFIX = '/static/admin/'
>>
>> # Additional locations of static files
>> STATICFILES_DIRS = (
>>     # Put strings here, like "/home/html/static" or
>> "C:/www/django/static".
>>     # Always use forward slashes, even on Windows.
>>     # Don't forget to use absolute paths, not relative paths.
>>     os.path.join(PROJECT_PATH,'project_static'),
>> )
>>
>
> I have django 1.2.3, i try you settings but nothing change
>
> Thanks anyway
>
>
> --
> 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.
>
My settings won't work for you unless you put your files in the same
directories as I do.


-- 
Joel Goldstick

-- 
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 deployment practices -- do people use setup.py?

2012-03-15 Thread Tom Eastman
On 14/03/12 21:47, Thomas Guettler wrote:
> Hey,
> 
> I read your post some days ago and waited what other people say. But
> nobody answered.
> 
> I posted a related question some time ago: Staging (dev,test,prod) in
> django. I explain
> my setup there.
> http://markmail.org/thread/wqwvordnlhyizwyp
> 
> A related thread on django-dev:
> http://groups.google.com/group/django-developers/browse_thread/thread/d919da361273dbc0/8de3c5cf9369eca3?#8de3c5cf9369eca3
> 
> 
> I think it would be very good to have the fundamental parts in django:
>  * stages: DEV, TEST, PROD
>  * get next system: user, host, install-prefix
> 
> Several deployment implementation could use these methods and variables.
> Switching
> between a deployment implementation would be easier.
> 
>   Thomas


Hi Thomas,

Yeah, I didn't get a lot of feedback -- but in the intervening time I've
been using zc.buildout with two of my projects and I've quite liked the
way it does things. Doesn't solve all my problems -- but it does seem to
do a nice job of combining what using virtualenv and setup.py gets you.

Cheers,

Tom



-- 
  Tom Eastman  //  Catalyst IT Ltd.  //  +64 4 803 2432



signature.asc
Description: OpenPGP digital signature


Re: Satchmo store as an app of a django project

2012-03-15 Thread kooliah

On 03/15/2012 09:22 PM, Joel Goldstick wrote:

I had problems similar to you with my static files. First, I am
assuming you are using v1.3 of Django?  V1.0 did this differently

Below is a snippet from my settings.py:

Django is doing some things I don't really understand, but in your
case I think you should add entries to the STATICFILES_DIRS tuple.
You should read carefully the django docs concerning static file
settings.  Its confusing -- at least to me.

# Absolute path to the directory static files should be collected to.
# Don't put anything in this directory yourself; store your static files
# in apps' "static/" subdirectories and in STATICFILES_DIRS.
# Example: "/home/media/media.lawrence.com/static/"
STATIC_ROOT = os.path.join(PROJECT_PATH,'static/')

# URL prefix for static files.
# Example: "http://media.lawrence.com/static/;
STATIC_URL = '/static/'

# URL prefix for admin static files -- CSS, JavaScript and images.
# Make sure to use a trailing slash.
# Examples: "http://foo.com/static/admin/;, "/static/admin/".
ADMIN_MEDIA_PREFIX = '/static/admin/'

# Additional locations of static files
STATICFILES_DIRS = (
 # Put strings here, like "/home/html/static" or "C:/www/django/static".
 # Always use forward slashes, even on Windows.
 # Don't forget to use absolute paths, not relative paths.
 os.path.join(PROJECT_PATH,'project_static'),
)
   

I have django 1.2.3, i try you settings but nothing change

Thanks anyway

--
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: A little InlineModelAdmin help please?

2012-03-15 Thread Marc Aymerich
On Thu, Mar 15, 2012 at 9:32 PM, Jeff Blaine  wrote:
> Easier for me to just draw you a picture:
>
>            ++
>            |   noodle               |
>            ++
>                 |             |
>                 |             |
>           +-+             ++
>           |                        |
>           |                        |
> +---+           +--+
> | foo 1         |           | foo 2        |
> |               |           |              |
> | noodle ref    |           | noodle ref   |--+
> +---+           +--+      |
>                                |              |
>                                    |              |
>                                    |              |
>                             ++  +---+
>                             | bar 1      |  | bar 2     |
>                             |            |  |           |
>                             | foo 2 ref  |  | foo 2 ref |
>                             ++  +---+
>
> I have a ModelAdmin for model "noodle" displaying an
> Inline already of model "foo".  Works fine.
>
> However, I want that existing inline of "foo" to also show
> the associated info from model bar:

seems that what you want is nested inlines and unfortunately there is
no solution for this in the short run, check this ticket
https://code.djangoproject.com/ticket/9025
-- 
Marc

-- 
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: In views.py snippet of Code

2012-03-15 Thread Sami Balbaky
Thank you Kevin, problem solved. I'm actually reading the book from
www.djangobook.com. I need to cross reference with the documentation on
www.thedjangoproject.com.

Best,

SB

On Thu, Mar 15, 2012 at 11:43 AM, Kevin Wetzels  wrote:

>
>
> On Thursday, March 15, 2012 7:32:53 PM UTC+1, Django_for_SB wrote:
>>
>> Hi All,
>>
>> I'm using render_to_response() in my views.py module. And of course,
>> I've imported the method:
>>
>> "from django.shortcuts import render_to_response"
>>
>> # This is the code that's generating the error:
>> def hours_ahead(request, offset):
>> try:
>> offset = int(offset)
>> except ValueError:
>> raise Http404()
>> dt = datetime.datetime.now() + datetime.timedelta(hours =
>> offset)
>> return render_to_response('hours_**ahead.html', {'hour_offset':
>> offset}, {'next_time': dt})
>>
>>
>> Django is complaining that my "render_to_response()" statement is
>> wrong with the following debug statement:
>>
>> "pop expected at least 1 arguments, got 0"
>>
>> Here is the full traceback:
>>
>>
>> Traceback:
>> File "C:\Python27\lib\site-**packages\django\core\handlers\**base.py" in
>> get_response
>>   111. response = callback(request,
>> *callback_args, **callback_kwargs)
>> File "C:\Python27\my_Djando_**projects\HelloWorld\..\**HelloWorld
>> \views.py" in hours_ahead
>>   31. return render_to_response('hours_**ahead.html',
>> {'hour_offset': offset}, {'next_time': dt})
>> File "C:\Python27\lib\site-**packages\django\shortcuts\__**init__.py" in
>> render_to_response
>>   20. return HttpResponse(loader.render_to_**string(*args,
>> **kwargs), **httpresponse_kwargs)
>> File "C:\Python27\lib\site-**packages\django\template\**loader.py" in
>> render_to_string
>>   190. context_instance.pop()
>>
>> Exception Type: TypeError at /time/plus/3/
>> Exception Value: pop expected at least 1 arguments, got 0
>>
>>
>>
>>
>>
>>
>> Since I'm still fairly new to Django, I can't quite see what I'm doing
>> incorrectly here. Any assistance would be greatly appreciated. Thank
>> you.
>>
>> Best,
>>
>> SB
>
>
> You're passing in three parameters to render_to_response. The third one is
> expected to be an instance of Context (see
> https://docs.djangoproject.com/en/dev/topics/http/shortcuts/#django.shortcuts.render_to_response),
> but you're passing in a dictionary.
>
> render_to_response('hours_ahead.html', {'hour_offset': offset,
> 'next_time': dt}) is what you want.
>
> --
> 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/-/2Oq52gruh2cJ.
>
> 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.
>



-- 
Sami Balbaky
System Engineer - Ultrawave Labs

-- 
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 breaks shelve?

2012-03-15 Thread Rainy
Hi, I have some shelved instances that were saved when a module was
run from command line, but when it is run from inside django:

from reminders import *
Tasks()

I get the standard shelve error: 'module' object has no attribute
'Task'.

reminders module has classes Task and Tasks defined.

If I create a test module test.py and do:

from reminders import *
Tasks()

It works without error, so the issue is with some magic namespace
manipulation Django is doing?

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



A little InlineModelAdmin help please?

2012-03-15 Thread Jeff Blaine
Easier for me to just draw you a picture:

   ++
   |   noodle   |
   ++
| |
| |
  +-+ ++
  ||
  ||
+---+   +--+
| foo 1 |   | foo 2|
|   |   |  |
| noodle ref|   | noodle ref   |--+
+---+   +--+  |
   |  |
   |  |
   |  |
++  +---+
| bar 1  |  | bar 2 |
||  |   |
| foo 2 ref  |  | foo 2 ref |
++  +---+

I have a ModelAdmin for model "noodle" displaying an
Inline already of model "foo".  Works fine.

However, I want that existing inline of "foo" to also show
the associated info from model bar:

NOODLE
FOO 1   foofield1foofield2
FOO 2   foofield1foofield2
  BAR 1barfield1barfield2
  BAR 2barfield1barfield2

-- 
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/-/w_jDZmLbERUJ.
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: sending django email via gmail

2012-03-15 Thread infinitylX
Thank guys.

Finally i get why this does not work.

On Thursday, March 15, 2012 5:22:17 AM UTC+2, Karen Tracey wrote:
>
> 2012/3/14 infinitylX :
> > 465 is a port for gmail and code i provide is completely working...
> > but question is why django is not working with same settings...
>
> Because, as JJO stated, the code you show is NOT what Django does when
> establishing a secure email connection. The code you showed
> establishes an SSL connection to the email server. The
> smtplib.SMTP_SSL method you show is a feature new in Python 2.6.
> Django still supports Python 2.5, so cannot use this method. The older
> way of establishing a secure connection to an email server is to begin
> with a non-encrypted connection and upgrade it to secure via the
> STARTTLS command. This is what Django does when you specify
> EMAIL_USE_TLS=True. Gmail doc notes that for the TLS/STARTTLS case,
> you need to use port 587:
> http://support.google.com/mail/bin/answer.py?hl=en=13287
>
> Karen
> -- 
> http://tracey.org/kmt/
>
>

-- 
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/-/DBbrXtHYfIcJ.
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: Satchmo store as an app of a django project

2012-03-15 Thread Joel Goldstick
On Thu, Mar 15, 2012 at 2:29 PM, kooliah
 wrote:
> I’m trying to run a satchmo store as an app of a django project
> I create a django project myprj (django-admin.py startproject myprj)
>
> I create a satchmo store (clonesatchmo.py)
> I copied settings.py and local_settings.py from myprj/store
> I modify myprj/urls to have shop in the /store subfolder of site
>
> code-
> from django.conf.urls.defaults import *
> import store.urls
> from django.contrib import admin
> admin.autodiscover()
> urlpatterns = patterns('', (r'^store/', include(store.urls)),)
> ---
> Going to http://127.0.0.1:8000/store/ the shop starts but it does not find
> the css and all the static stuff
>
> output
> [15/Mar/2012 11:08:29] "GET /static/css/style.css HTTP/1.1" 404 1999
> [15/Mar/2012 11:08:29] "GET
> /static/images/productimage-picture-dj-rocks-2_jpg_85x85_q85.jpg HTTP/1.1"
> 404 2128
> ---
> So i try to copy the static dir from myprj/store/static to myprj/static but
> nothing change, the files are there but it does not find them.
>
> There are some wrong link too
>
> output
> [15/Mar/2012 11:22:42] "GET /accounts/login/?next=/store/ HTTP/1.1" 404 1997
> ---
> like it does not care of the "store" prefix
>
> Do I miss something? I think some prefix to put somewhere
>
> Thank to all
>
> kooliah
>
> --
> 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 had problems similar to you with my static files.  First, I am
assuming you are using v1.3 of Django?  V1.0 did this differently

Below is a snippet from my settings.py:

Django is doing some things I don't really understand, but in your
case I think you should add entries to the STATICFILES_DIRS tuple.
You should read carefully the django docs concerning static file
settings.  Its confusing -- at least to me.

# Absolute path to the directory static files should be collected to.
# Don't put anything in this directory yourself; store your static files
# in apps' "static/" subdirectories and in STATICFILES_DIRS.
# Example: "/home/media/media.lawrence.com/static/"
STATIC_ROOT = os.path.join(PROJECT_PATH,'static/')

# URL prefix for static files.
# Example: "http://media.lawrence.com/static/;
STATIC_URL = '/static/'

# URL prefix for admin static files -- CSS, JavaScript and images.
# Make sure to use a trailing slash.
# Examples: "http://foo.com/static/admin/;, "/static/admin/".
ADMIN_MEDIA_PREFIX = '/static/admin/'

# Additional locations of static files
STATICFILES_DIRS = (
# Put strings here, like "/home/html/static" or "C:/www/django/static".
# Always use forward slashes, even on Windows.
# Don't forget to use absolute paths, not relative paths.
os.path.join(PROJECT_PATH,'project_static'),
)



-- 
Joel Goldstick

-- 
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: extends base.html error

2012-03-15 Thread Joel Goldstick
On Thu, Mar 15, 2012 at 2:52 PM, dpbklyn  wrote:
> YES!!!
>
> This was it.  I had the TAG further down the page, but it was commented out 
> with an HTML comment.  once I removed the tag altogether, the page renders 
> fine.  Is there a way to comment out the {% TAG %}s?
>
>
> On Mar 15, 2012, at 11:31 AM, Joel Goldstick wrote:
>
>> On Thu, Mar 15, 2012 at 10:39 AM, dpbklyn  wrote:
>>> Hello and thank you in advance...
>>>
>>> In Django I have a child template that updates a base.html template. I
>>> keep getting an error:
>>>
>>>     must be the first tag in the
>>> template.
>>>
>>> When the code in the child template looks like this:
>>>
>>>    {% extends "simple/base.html" %}
>>>
>>>     {% block picklist %}
>>>
>>>        
>>>
>>>        Simple Index #...
>>> I dont get why I am getting this error, when the EXTENDS tag is
>>> clearly the first tag.
>>>
>>> Both the base and the child template live in the same directory, in my
>>> template path /simple.
>>>
>>> Thank you,
>>>
>>> dp
>>>
>>> --
>>> 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.
>>>
>> Can you post the exact first several lines of your template?  Do you
>> repeat the {% extends tag somewhere again in your template?
>>
>>
>> --
>> Joel Goldstick
>>
>> --
>> 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 can put comments inside {# bla bla #}.  I've never done this, so
why don't you try it and report back how it worked?

-- 
Joel Goldstick

-- 
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: ANN: Django 1.4 release candidate 2 issued

2012-03-15 Thread victoria
On Thu, Mar 15, 2012 at 4:46 AM, James Bennett  wrote:
> Subject line says it all, and details, as always, are on the weblog:
>
> https://www.djangoproject.com/weblog/2012/mar/14/14rc2/
>

We have also released a new version of BitNami DjangoStack 1.4c2 which
bundles Django 1.4 Release Candidate 2. Native installers and Ubuntu
virtual machines are already available. Amazon Cloud images are in the
way. I'm sure this will make easier to test the new Django version.
Enjoy!

You can get them from http://bitnami.org/stack/djangostack

Cheers,

Victoria.

> --
> 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: extends base.html error

2012-03-15 Thread dpbklyn
YES!!!

This was it.  I had the TAG further down the page, but it was commented out 
with an HTML comment.  once I removed the tag altogether, the page renders 
fine.  Is there a way to comment out the {% TAG %}s?


On Mar 15, 2012, at 11:31 AM, Joel Goldstick wrote:

> On Thu, Mar 15, 2012 at 10:39 AM, dpbklyn  wrote:
>> Hello and thank you in advance...
>> 
>> In Django I have a child template that updates a base.html template. I
>> keep getting an error:
>> 
>> must be the first tag in the
>> template.
>> 
>> When the code in the child template looks like this:
>> 
>>{% extends "simple/base.html" %}
>> 
>> {% block picklist %}
>> 
>>
>> 
>>Simple Index #...
>> I dont get why I am getting this error, when the EXTENDS tag is
>> clearly the first tag.
>> 
>> Both the base and the child template live in the same directory, in my
>> template path /simple.
>> 
>> Thank you,
>> 
>> dp
>> 
>> --
>> 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.
>> 
> Can you post the exact first several lines of your template?  Do you
> repeat the {% extends tag somewhere again in your template?
> 
> 
> -- 
> Joel Goldstick
> 
> -- 
> 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: In views.py snippet of Code

2012-03-15 Thread Kevin Wetzels


On Thursday, March 15, 2012 7:32:53 PM UTC+1, Django_for_SB wrote:
>
> Hi All, 
>
> I'm using render_to_response() in my views.py module. And of course, 
> I've imported the method: 
>
> "from django.shortcuts import render_to_response" 
>
> # This is the code that's generating the error: 
> def hours_ahead(request, offset): 
> try: 
> offset = int(offset) 
> except ValueError: 
> raise Http404() 
> dt = datetime.datetime.now() + datetime.timedelta(hours = 
> offset) 
> return render_to_response('hours_ahead.html', {'hour_offset': 
> offset}, {'next_time': dt}) 
>
>
> Django is complaining that my "render_to_response()" statement is 
> wrong with the following debug statement: 
>
> "pop expected at least 1 arguments, got 0" 
>
> Here is the full traceback: 
>
>
> Traceback: 
> File "C:\Python27\lib\site-packages\django\core\handlers\base.py" in 
> get_response 
>   111. response = callback(request, 
> *callback_args, **callback_kwargs) 
> File "C:\Python27\my_Djando_projects\HelloWorld\..\HelloWorld 
> \views.py" in hours_ahead 
>   31. return render_to_response('hours_ahead.html', 
> {'hour_offset': offset}, {'next_time': dt}) 
> File "C:\Python27\lib\site-packages\django\shortcuts\__init__.py" in 
> render_to_response 
>   20. return HttpResponse(loader.render_to_string(*args, 
> **kwargs), **httpresponse_kwargs) 
> File "C:\Python27\lib\site-packages\django\template\loader.py" in 
> render_to_string 
>   190. context_instance.pop() 
>
> Exception Type: TypeError at /time/plus/3/ 
> Exception Value: pop expected at least 1 arguments, got 0 
>
>
>
>
>
>
> Since I'm still fairly new to Django, I can't quite see what I'm doing 
> incorrectly here. Any assistance would be greatly appreciated. Thank 
> you. 
>
> Best, 
>
> SB


You're passing in three parameters to render_to_response. The third one is 
expected to be an instance of Context (see 
https://docs.djangoproject.com/en/dev/topics/http/shortcuts/#django.shortcuts.render_to_response),
 
but you're passing in a dictionary.

render_to_response('hours_ahead.html', {'hour_offset': offset, 'next_time': 
dt}) is what you want.

-- 
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/-/2Oq52gruh2cJ.
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.



In views.py snippet of Code

2012-03-15 Thread Django_for_SB
Hi All,

I'm using render_to_response() in my views.py module. And of course,
I've imported the method:

"from django.shortcuts import render_to_response"

# This is the code that's generating the error:
def hours_ahead(request, offset):
try:
offset = int(offset)
except ValueError:
raise Http404()
dt = datetime.datetime.now() + datetime.timedelta(hours =
offset)
return render_to_response('hours_ahead.html', {'hour_offset':
offset}, {'next_time': dt})


Django is complaining that my "render_to_response()" statement is
wrong with the following debug statement:

"pop expected at least 1 arguments, got 0"

Here is the full traceback:


Traceback:
File "C:\Python27\lib\site-packages\django\core\handlers\base.py" in
get_response
  111. response = callback(request,
*callback_args, **callback_kwargs)
File "C:\Python27\my_Djando_projects\HelloWorld\..\HelloWorld
\views.py" in hours_ahead
  31. return render_to_response('hours_ahead.html',
{'hour_offset': offset}, {'next_time': dt})
File "C:\Python27\lib\site-packages\django\shortcuts\__init__.py" in
render_to_response
  20. return HttpResponse(loader.render_to_string(*args,
**kwargs), **httpresponse_kwargs)
File "C:\Python27\lib\site-packages\django\template\loader.py" in
render_to_string
  190. context_instance.pop()

Exception Type: TypeError at /time/plus/3/
Exception Value: pop expected at least 1 arguments, got 0






Since I'm still fairly new to Django, I can't quite see what I'm doing
incorrectly here. Any assistance would be greatly appreciated. Thank
you.

Best,

SB

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



Satchmo store as an app of a django project

2012-03-15 Thread kooliah

I'm trying to run a satchmo store as an app of a django project
I create a django project myprj (django-admin.py startproject myprj)

I create a satchmo store (clonesatchmo.py)
I copied settings.py and local_settings.py from myprj/store
I modify myprj/urls to have shop in the /store subfolder of site

code-
from django.conf.urls.defaults import *
import store.urls
from django.contrib import admin
admin.autodiscover()
urlpatterns = patterns('', (r'^store/', include(store.urls)),)
---
Going to http://127.0.0.1:8000/store/ the shop starts but it does not 
find the css and all the static stuff


output
[15/Mar/2012 11:08:29] "GET /static/css/style.css HTTP/1.1" 404 1999
[15/Mar/2012 11:08:29] "GET 
/static/images/productimage-picture-dj-rocks-2_jpg_85x85_q85.jpg 
HTTP/1.1" 404 2128

---
So i try to copy the static dir from myprj/store/static to myprj/static 
but nothing change, the files are there but it does not find them.


There are some wrong link too

output
[15/Mar/2012 11:22:42] "GET /accounts/login/?next=/store/ HTTP/1.1" 404 1997
---
like it does not care of the "store" prefix

Do I miss something? I think some prefix to put somewhere

Thank to all

kooliah

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

2012-03-15 Thread Ovnicraft
On Tue, Mar 13, 2012 at 8:54 PM, hack  wrote:

> This stuff is killing me.  LOL  I think I just don't understand the
> urllib2 yet.
>
> I'm trying something very simple, but am having a terrible time
> figuring out how to get it to work in python and django.  All I want
> to do is post to my site with params.  Here is what I have:
>
> def test(request):
>test = " NOTHING "
>if request.method=='POST':
>test = request.POST.get('test',None)
>print 'data posted'
>print 'test param: ',test
>
>return HttpResponse("Text only, please."+str(test),
> content_type="text/plain")
>
> Here is how I'm trying to call it via IDLE:
>
> >>> parms = urllib.urlencode([('test','testing'),('test2','testing2')])
> >>> print parms
> test=testing=testing2
>
> >>> response = urllib2.urlopen('http://my.ip.address:8080/myapp/test/
> ',parms)
>
> Heres the error:
> Traceback (most recent call last):
>  File "", line 1, in 
>  File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/
> python2.6/urllib2.py", line 124, in urlopen
>return _opener.open(url, data, timeout)
>  File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/
> python2.6/urllib2.py", line 389, in open
>response = meth(req, response)
>  File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/
> python2.6/urllib2.py", line 502, in http_response
>'http', request, response, code, msg, hdrs)
>  File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/
> python2.6/urllib2.py", line 427, in error
>return self._call_chain(*args)
>  File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/
> python2.6/urllib2.py", line 361, in _call_chain
>result = func(*args)
>  File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/
> python2.6/urllib2.py", line 510, in http_error_default
>raise HTTPError(req.get_full_url(), code, msg, hdrs, fp)
> HTTPError: HTTP Error 403: FORBIDDEN
>


Can you check if development mode, check csrf ?

Regards,

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


-- 
Cristian Salamea
@ovnicraft

-- 
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 admin login

2012-03-15 Thread dummyman dummyman
yes its the same username and passwd for database are also same

On Thu, Mar 15, 2012 at 10:10 PM, Joel Goldstick
wrote:

> On Thu, Mar 15, 2012 at 7:40 AM, dummyman dummyman 
> wrote:
> > Hi
> > Still its not working :( getting the same error
> > On Thu, Mar 15, 2012 at 12:59 PM, vikalp sahni 
> > wrote:
> >>
> >> ITS in settigns.py file.
> >>
> >> if its not there just write.g
> >>
> >> SESSION_COOKIE_DOMAIN = "localhost" and then try.
> >>
> >> Regards,
> >> //Vikalp
> >>
> >>
> >> On Wed, Mar 14, 2012 at 11:48 PM, dummyman dummyman  >
> >> wrote:
> >>>
> >>> Wer is the SESSION_COOKIE_DOMAIN ?
> >>>
> >>>
> >>> On Wed, Mar 14, 2012 at 11:32 PM, dummyman dummyman <
> tempo...@gmail.com>
> >>> wrote:
> 
>  hi
> 
>  i got this error msg
> 
>  Please enter a correct username and password. Note that both fields
> are
>  case-sensitive.
> 
> 
>  On Wed, Mar 14, 2012 at 11:21 PM, vikalp sahni  >
>  wrote:
> >
> > Can you share your SESSION_COOKIE_DOMAIN setting. In your settings.py
> > file.
> >
> > Also, is there any error message which is displayed on top of login
> > form when you try to login?
> >
> > Regards,
> > //Vikalp
> >
> >
> > On Wed, Mar 14, 2012 at 11:06 PM, dummyman dummyman
> >  wrote:
> >>
> >> hi ..
> >>
> >> I created a superuser but still getting the same error
> >>
> >> @vikalp: But it works for other projects with the same superuser
> name
> >> and password
> >>
> >>
> >> On Wed, Mar 14, 2012 at 10:57 PM, Denis Darii <
> denis.da...@gmail.com>
> >> wrote:
> >>>
> >>> Try to create your superuser again:
> >>>
> >>> ./manage.py createsuperuser
> >>>
> >>>
> >>> On Wed, Mar 14, 2012 at 6:25 PM, vikalp sahni <
> vikalpsa...@gmail.com>
> >>> wrote:
> 
>  You have to check your
> 
>  SESSION_COOKIE_DOMAIN in settings file if i.e pointing to
>  "localhost" (if not cookies will not properly set and hence login
> will not
>  be allowed)
> 
>  the best would be to use some host entry like example.com127.0.0.1
>  and then use that in SESSION_COOKIE_DOMAIN and for accessing
> project on
>  browser.
> 
>  Regards,
>  //Vikalp
> 
> 
>  On Wed, Mar 14, 2012 at 10:51 PM, dummyman dummyman
>   wrote:
> >
> >
> > Hi,
> > I created a new project in django
> >
> > 1.I created a new database
> > 2. I created a new user
> > 3.python manage syncdb
> > 4.python manae.py runserver
> >
> > when i visit localhost:8080/admin -> it asks for username n
> passwd.
> > but the login fails inspite of entering correct one
> >
> > But it works for a different project
> >
> > --
> > 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.
> >>>
> >>>
> >>>
> >>>
> >>> --
> >>> This e-mail and any file transmitted with it is intended only for
> the
> >>> person or entity to which is addressed and may contain information
> that is
> >>> privileged, confidential or otherwise protected from disclosure.
> Copying,
> >>> dissemination or use of this e-mail or the information herein by
> anyone
> >>> other than the intended recipient is prohibited. If you are not
> the intended
> >>> recipient, please notify the sender immediately by return e-mail,
> delete
> >>> this communication and destroy all copies.
> >>>
> >>> --
> >>> 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
> >>> 

Re: Testing class based views

2012-03-15 Thread Javier Guerra Giraldez
On Thu, Mar 15, 2012 at 10:47 AM, msbuck  wrote:
> I have used class based views in my latest project. Now I'm trying to write
> tests. I can write tests like the ones I wrote for function based views but
> these seem to me to be functional tests. Does anyone do unit testing on a
> class based view methods? I'm not sure how to go about instantiating a view
> to use in a unit test. And I'm wondering if they are really useful and/or
> worth the effort.



typically, in my projects I try to put most of the functionality in
the models, in most cases the views do little more than selecting the
appropriate model object and show with a template, or just do a little
verifications and call some model's methods.

with that in mind, my full process looks like this in relation to tests:

- first i design the data structure that supports the (yet
unimplemented) functionality.  for this i simply write the models.py
files, repeatedly calling the graph_models command so i have an
auto-refreshing graphical view of the structure.  here i spend some
time thinking what belongs where, splitting and merging apps several
times until they look fine, both in code and in graph.

- when the models diagram fits my vision, i start writing tests for
the basic functionality.  usually at this stage i write them in the
same models.py, and interact only with the models layer.  in a typical
TDD methodology, i write tests that exercise the concepts and then
write the methods to implement them.  sometimes this grows to the
point where i have to split models.py into a subdirectory.

- when the tests do in python most of what i want the user be able to
do via web, i start to write the views, urls and templates.  sometimes
i found i have to write some extra data handling code.  if i can't
push it down to the models, then i try to factor it out to a
'utils.py'.  there i should (and sometimes do) first write tests (now
in tests.py, not in models.py).  still, the tests are kind of 'unit
tests' trying to test the code out of the web environment (but usually
don't bother to write mock objects to please the Unit test idealists)

- finally, when the views are mostly working, i write some tests that
use the test client to do fake web requests.  these tests are not TDD,
and have more 'integration test' flavor.  typically they're there to
ensure user restrictions and to refuse to do some actions or to show
some data when not appropriate.  I use lots of 'assertRedirects' and
'assertNotContains'.


-- 
Javier

-- 
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 admin login

2012-03-15 Thread Joel Goldstick
On Thu, Mar 15, 2012 at 7:40 AM, dummyman dummyman  wrote:
> Hi
> Still its not working :( getting the same error
> On Thu, Mar 15, 2012 at 12:59 PM, vikalp sahni 
> wrote:
>>
>> ITS in settigns.py file.
>>
>> if its not there just write.g
>>
>> SESSION_COOKIE_DOMAIN = "localhost" and then try.
>>
>> Regards,
>> //Vikalp
>>
>>
>> On Wed, Mar 14, 2012 at 11:48 PM, dummyman dummyman 
>> wrote:
>>>
>>> Wer is the SESSION_COOKIE_DOMAIN ?
>>>
>>>
>>> On Wed, Mar 14, 2012 at 11:32 PM, dummyman dummyman 
>>> wrote:

 hi

 i got this error msg

 Please enter a correct username and password. Note that both fields are
 case-sensitive.


 On Wed, Mar 14, 2012 at 11:21 PM, vikalp sahni 
 wrote:
>
> Can you share your SESSION_COOKIE_DOMAIN setting. In your settings.py
> file.
>
> Also, is there any error message which is displayed on top of login
> form when you try to login?
>
> Regards,
> //Vikalp
>
>
> On Wed, Mar 14, 2012 at 11:06 PM, dummyman dummyman
>  wrote:
>>
>> hi ..
>>
>> I created a superuser but still getting the same error
>>
>> @vikalp: But it works for other projects with the same superuser name
>> and password
>>
>>
>> On Wed, Mar 14, 2012 at 10:57 PM, Denis Darii 
>> wrote:
>>>
>>> Try to create your superuser again:
>>>
>>> ./manage.py createsuperuser
>>>
>>>
>>> On Wed, Mar 14, 2012 at 6:25 PM, vikalp sahni 
>>> wrote:

 You have to check your

 SESSION_COOKIE_DOMAIN in settings file if i.e pointing to
 "localhost" (if not cookies will not properly set and hence login will 
 not
 be allowed)

 the best would be to use some host entry like example.com 127.0.0.1
 and then use that in SESSION_COOKIE_DOMAIN and for accessing project on
 browser.

 Regards,
 //Vikalp


 On Wed, Mar 14, 2012 at 10:51 PM, dummyman dummyman
  wrote:
>
>
> Hi,
> I created a new project in django
>
> 1.I created a new database
> 2. I created a new user
> 3.python manage syncdb
> 4.python manae.py runserver
>
> when i visit localhost:8080/admin -> it asks for username n passwd.
> but the login fails inspite of entering correct one
>
> But it works for a different project
>
> --
> 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.
>>>
>>>
>>>
>>>
>>> --
>>> This e-mail and any file transmitted with it is intended only for the
>>> person or entity to which is addressed and may contain information that 
>>> is
>>> privileged, confidential or otherwise protected from disclosure. 
>>> Copying,
>>> dissemination or use of this e-mail or the information herein by anyone
>>> other than the intended recipient is prohibited. If you are not the 
>>> intended
>>> recipient, please notify the sender immediately by return e-mail, delete
>>> this communication and destroy all copies.
>>>
>>> --
>>> 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
>> 

Re: extends base.html error

2012-03-15 Thread Joel Goldstick
On Thu, Mar 15, 2012 at 10:39 AM, dpbklyn  wrote:
> Hello and thank you in advance...
>
> In Django I have a child template that updates a base.html template. I
> keep getting an error:
>
>     must be the first tag in the
> template.
>
> When the code in the child template looks like this:
>
>    {% extends "simple/base.html" %}
>
>     {% block picklist %}
>
>        
>
>        Simple Index #...
> I dont get why I am getting this error, when the EXTENDS tag is
> clearly the first tag.
>
> Both the base and the child template live in the same directory, in my
> template path /simple.
>
> Thank you,
>
> dp
>
> --
> 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.
>
Can you post the exact first several lines of your template?  Do you
repeat the {% extends tag somewhere again in your template?


-- 
Joel Goldstick

-- 
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: coping source code templates

2012-03-15 Thread Joel Goldstick
On Wed, Mar 14, 2012 at 6:38 AM, Yasmine El_Badry
 wrote:
> Hi,
> Please , I need to know full details about coping the baseline
> template from the source code to my own templates folder so that i can
> change the site name instead of "Django administration".
>
> i don't understand the meaning of not to forget the admin sub
> directory.
>
> Thank you.
>
> --
> 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.
>
The Django site tutorial shows how to do this:
https://docs.djangoproject.com/en/dev/intro/tutorial02/#customize-the-admin-look-and-feel


-- 
Joel Goldstick

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

2012-03-15 Thread Alec Taylor
Also, quick sort-of side-note:

I recommend checking out the python-requests library as an alternative
to urllib2

http://docs.python-requests.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.



Testing class based views

2012-03-15 Thread msbuck
I have used class based views in my latest project. Now I'm trying to write 
tests. I can write tests like the ones I wrote for function based views but 
these seem to me to be functional tests. Does anyone do unit testing on a 
class based view methods? I'm not sure how to go about instantiating a view 
to use in a unit test. And I'm wondering if they are really useful and/or 
worth the effort.


-- 
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/-/Fi8-isg7z5gJ.
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.



show ldap attributes in django

2012-03-15 Thread Marc Patermann

Hi,

I started to learn Django recently, read the tutorial and Django Book etc.
My Goal is to make the functionality of a few system cli scripts for 
ldap and mail available in the web.


I started with a simple existing ldap script that displays attributes of 
an object.

Now I tried to integrate this in a view.

def myattrs(request, myobject):
  object_id = myobject
  con(s_as="cn=human,ou=foo",s_with="password")
  dn,entry = suche(sfilter="(&(mail=foo*)(objectclass=inetorgperson))")
  text = "Mail is %s" % entry['mail'][0]
  return render_to_response('myobject/details.html',{'text' : entry})

And a template:

{{ text }}

Which gives a dictionary with values of lists where most of the list 
have only one value. I can access single of them by {{ text.mail }} or 
{{ text.mail }}.


My goal is to show whatever attribute there is with its values.
Can you point me in the right directions to achieve this?


Marc

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

2012-03-15 Thread Bill Freeman
Are you using the development server?  If so, how about sticking a
pdb.set_trace() at line 510 of
/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/urllib2.py
to see what you're really getting?

On 3/13/12, hack  wrote:
> Yes, I added @csrf_exempt and not I get a 500 error instead.  I'm not sure
> what the deal is.
>
> On Tuesday, March 13, 2012 10:09:37 PM UTC-4, Matt Schinckel wrote:
>>
>> That response indicates you do not have permission to access that resource
>>
>> on that server. Are you sure you are hitting the correct URL?
>>
>> You may want to look into requests, it is a nicer interface for
>> interacting with http servers.
>>
>> Matt.
>>
>
> --
> 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/-/qyd4mTfFDZgJ.
> 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: tornadio2 cached results

2012-03-15 Thread Tom Evans
On Thu, Mar 15, 2012 at 2:12 PM, dobrysmak  wrote:
> Figured out that tornadio2 or tornado is somehow keepeing django's orm data
> in memory pulling that same data on each db request.
> When i'm reffering to mysql database via  python MySQLdb, making connection
> each request. i'm getting updated results, that's ok.
>
> How to force tornadio2/tornado to get the updated data from db via django?
>

Are you mistaking the difference between read committed and repeatable
read DB isolation levels? With repeatable read, all reads within a
transaction will get the same results, until the transaction is
committed.

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.



extends base.html error

2012-03-15 Thread dpbklyn
Hello and thank you in advance...

In Django I have a child template that updates a base.html template. I
keep getting an error:

 must be the first tag in the
template.

When the code in the child template looks like this:

{% extends "simple/base.html" %}

 {% block picklist %}



Simple Index #...
I dont get why I am getting this error, when the EXTENDS tag is
clearly the first tag.

Both the base and the child template live in the same directory, in my
template path /simple.

Thank you,

dp

-- 
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: tornadio2 cached results

2012-03-15 Thread dobrysmak
Figured out that tornadio2 or tornado is somehow keepeing django's orm data 
in memory pulling that same data on each db request.
When i'm reffering to mysql database via  python MySQLdb, making connection 
each request. i'm getting updated results, that's ok. 

How to force tornadio2/tornado to get the updated data from db via django?


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



Problem with tuncated Admin pages in apache + mod_fcgid

2012-03-15 Thread Another Django Newbie
Hi,

I've just started playing with django this week and was following the
example in the Django Book.

I created an example of my own, based on the models.py in the book and
tested it with manage.py runserver. All worked OK, but when I try it
in apache one of my admin pages is truncated - a number of fields are
left off and there is no Save button. The exact number of fields
truncated depends on whether I use Add from the main page or from the
Add page of another field (so that the affected page is a pop-up)

Apache 2.4.1
mod_fcgid 2.3.6
django 1.3.1
Python 2.7.2
cx-Oracle 5.1.1

Has anyone seen this behaviour? I've looked in apache and django logs
but don't see anything recorded when the page loads. Any ideas greatly
appreciated.

Thanks.

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



Re: Initial value in inline form depending on foreign key value

2012-03-15 Thread FraMazz
Well, I got it. In a very UGLY way, but it does its job.
I modified the inline class so that it gets access to the request object by 
overriding the get_formset function

class CheckupInLineAdmin(admin.StackedInline):
model = Checkup
   * form =CheckupAdminForm*
extra = 1

*def get_formset(self, request, obj=None, **kwargs):
self.form.request=request
return super(CheckupInLineAdmin, self).get_formset(request, obj, 
**kwargs)*


Then I defined a form for this class overriding the __init__ function to 
give proper initial values:

class CheckupAdminForm(forms.ModelForm):
class Meta:
model = Checkup

def __init__(self, *args, **kwargs):
super(CheckupAdminForm, self).__init__(*args, **kwargs)
# if it is not an instance (an already saved object)
if not kwargs.has_key('instance'):
# get patient id from request path
# UGLY but I did not find a better way...
# the request path is something like
# /admin/myapp/patient/1/
# where 1 is the patient id
splitted = self.request.META['PATH_INFO'].split('/')
# check the last bit is a int
# this is useful when creating a new patient. In this case
# the request path is
# /admin/myapp/patient/add/ and the last bit is not the 
patient id
try:
id_pat = int(splitted[len(splitted)-2])
pat = Patient.objects.get(id=id_pat)
checkups = pat.checkups.all()
how_many = len(checkups)
# take the last checkup
if how_many > 0:
checkup = checkups[how_many - 1]
# initialize fields depending on the last chechup 
values
self.initial['alcol'] = checkup.alcol
except:
pass

If someone knows a better way, any hint is appreciated.
Cheers
FraMazz

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



Can't save user details when using RemoteUserMiddleware and Active Directory

2012-03-15 Thread honyczek
Hi,

when you use RemoteUserMiddleware (and RemoteUserBackend) for
authentication of users and authenticates against Active Directory
(mod_auth_sspi on Apache or Directory security on IIS), user's name
value is in format domain\username. It works good until you want to
set some details in Django Admin. If you try to save changes of user's
profile, it can't be saved because error "This value may contain only
letters, numbers and @/./+/-/_ characters." is displayed.

Should be disallowed backslash in username or not, if it works? Or are
there any recommendations about using Remote User from Active
Directory?

The Single sign-on authentication against Active Directory is very
important (I hope not only) for me, so it would be great if it should
work smoothly.

Thanks.

Jan

-- 
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 admin login

2012-03-15 Thread dummyman dummyman
Hi
Still its not working :( getting the same error
On Thu, Mar 15, 2012 at 12:59 PM, vikalp sahni wrote:

> ITS in settigns.py file.
>
> if its not there just write.g
>
> SESSION_COOKIE_DOMAIN = "localhost" and then try.
>
> Regards,
> //Vikalp
>
>
> On Wed, Mar 14, 2012 at 11:48 PM, dummyman dummyman wrote:
>
>> Wer is the SESSION_COOKIE_DOMAIN ?
>>
>>
>> On Wed, Mar 14, 2012 at 11:32 PM, dummyman dummyman 
>> wrote:
>>
>>> hi
>>>
>>> i got this error msg
>>>
>>> Please enter a correct username and password. Note that both fields are
>>> case-sensitive.
>>>
>>>
>>> On Wed, Mar 14, 2012 at 11:21 PM, vikalp sahni wrote:
>>>
 Can you share your SESSION_COOKIE_DOMAIN setting. In your settings.py
 file.

 Also, is there any error message which is displayed on top of login
 form when you try to login?

 Regards,
 //Vikalp


 On Wed, Mar 14, 2012 at 11:06 PM, dummyman dummyman  wrote:

> hi ..
>
> I created a superuser but still getting the same error
>
> @vikalp: But it works for other projects with the same superuser name
> and password
>
>
> On Wed, Mar 14, 2012 at 10:57 PM, Denis Darii 
> wrote:
>
>> Try to create your superuser again:
>>
>> ./manage.py createsuperuser
>>
>>
>> On Wed, Mar 14, 2012 at 6:25 PM, vikalp sahni 
>> wrote:
>>
>>> You have to check your
>>>
>>> SESSION_COOKIE_DOMAIN in settings file if i.e pointing to
>>> "localhost" (if not cookies will not properly set and hence login will 
>>> not
>>> be allowed)
>>>
>>> the best would be to use some host entry like example.com 127.0.0.1
>>> and then use that in SESSION_COOKIE_DOMAIN and for accessing project on
>>> browser.
>>>
>>> Regards,
>>> //Vikalp
>>>
>>>
>>> On Wed, Mar 14, 2012 at 10:51 PM, dummyman dummyman <
>>> tempo...@gmail.com> wrote:
>>>

 Hi,
 I created a new project in django

 1.I created a new database
 2. I created a new user
 3.python manage syncdb
 4.python manae.py runserver

 when i visit localhost:8080/admin -> it asks for username n passwd.
 but the login fails inspite of entering correct one

 But it works for a different project

 --
 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.
>>>
>>
>>
>>
>> --
>> This e-mail and any file transmitted with it is intended only for the
>> person or entity to which is addressed and may contain information that 
>> is
>> privileged, confidential or otherwise protected from disclosure. Copying,
>> dissemination or use of this e-mail or the information herein by anyone
>> other than the intended recipient is prohibited. If you are not the
>> intended recipient, please notify the sender immediately by return 
>> e-mail,
>> delete this communication and destroy all copies.
>>
>>  --
>> 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 

Re: How can I print form errors from inside the test

2012-03-15 Thread Mario Gudelj
All I had to do is to change initial=base_data to data=base_data and the
thing worked. is_valid() and is_bound now work.

Cheers,

-m

On 15 March 2012 12:20, Daniel Roseman  wrote:

> On Wednesday, 14 March 2012 16:43:12 UTC-7, somecallitblues wrote:
>>
>> Thanks Daniel and Karen,
>>
>> Karen, I;'m not entirely sure what an unbound form is. :)
>>
>
> Then you must not have read the documentation[1], which goes into great
> detail about bound and unbound forms. That's pretty much a prerequisite
> before asking for help, I'm afraid.
>
>
>>
>> Anyway, this is my test code:
>>
>> def test_appointment_form(self):
>>
>> c = Client()
>>
>> base_data = {
>> 'name':'Foo name',
>> 'slug':'foo-session',
>> 'short_descr':'foo tagline',
>> 'long_descr':'long foo description',
>> 'staff':self.staff,
>> 'business':self.business,
>> 'start_date':'2012-07-24',
>> 'end_date':'2012-07-24',
>> }
>> self.form = AppointmentForm(business=self.**
>> business,staff=self.staff,**initial=base_data)
>>
>
> As that documentation points out, `initial` does not bind the form.
>
>
>> self.failUnless(self.form.is_**valid()) #< This fails
>>
>> print self.form.errors #>
>> response = c.post('/console/appointments/**add',
>> {'form':self.form})
>>
>
> Not the cause of your current problem, but this makes no sense: you can't
> POST a form object.
>
>  [1]:
> https://docs.djangoproject.com/en/1.3/topics/forms/#using-a-form-in-a-view
>
> --
> 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/-/r8lcpGOgA5gJ.
>
> 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 application performance estimates?

2012-03-15 Thread kenneth gonsalves
On Thu, 2012-03-15 at 10:22 +0200, Sithembewena Lloyd Dube wrote:
> Thanks for the response. The project will be hosted at WebFaction
> (which I
> recommended, having used their services with great results in the
> past). It
> will start off on shared hosting and could end up in a dedicated
> server.
> The client wants some sort of "performance guarantee". 

webfaction --> vps --> dedicated server --> many dedicated servers ...
-- 
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.



tornadio2 cached results

2012-03-15 Thread dobrysmak
Hi, 
i'm running tornadio2 server with socket.io and i run into a problem, when 
i'm getting some data from db via django's orm the socket server doesn't 
want to get new fresh data from db, every time the event occurs. He's just 
keeping the same data from begging.
Does anyone had same problem?

Bye.  

-- 
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/-/MAJL0l_fzpQJ.
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: Simplest way to get all models for which admin interface exists

2012-03-15 Thread Gelonida N
Thanks a lot Matt,

On 03/15/2012 03:20 AM, Matt Schinckel wrote:
> All installed ModelAdmin models:
> 
 from django.contrib.admin import site
 site._registry.keys()
> 
> If you only got at this from `manage.py shell`, then you may need to
> import your urls.py file first.
> 
> Getting those that are not registered is a bit longer:
> 
 from django.db.models import get_models
 from django.conf import settings
 set(get_models()).difference(site._registry.keys())
> 
Exactly what I was looking for.


-- 
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: Running manage.py commands in Windows Power Shell

2012-03-15 Thread Sam Lai
On 15 March 2012 04:35, orschiro  wrote:
> Hello,
>
> I have a question which is based on the discussion here:
>
> http://groups.google.com/group/django-users/browse_thread/thread/2333f5dc8d0674f0
>
> I'm working on Windows 7 with the PowerShell. Python 2.7 and the path
> to django-admin.py is stored in my PATH variable.
>
> After creating a project I can make use of the various manage.py
> commands in my PowerShell. However, only in the following way:
>
> 'python manage.py runserver'
>
> If I only type '.\manage.py runserver' then a new CMD window is opened
> running again 'python manage.py runserver'. That is, the command is
> forwarded to the CMD shell which opens it with the Python
> interpreter.
>
> Is there any way to tell the PowerShell to interpret the command given
> within the shell instead of launching a CMD window?

For me, both ways execute within PowerShell's shell. I do have
ActiveState ActivePython installed instead of the Python distribution
from python.org though; I find the ActiveState distribution integrates
much better with Windows than python.org's.

That said, I can't really explain why you're seeing what you're seeing
though. Does it happen if you just do '.\test.py' where test.py just
contains simple Python commands like a couple of print statements?

> Regards,
>
> Robert
>
> --
> 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: Running manage.py commands in Windows Power Shell

2012-03-15 Thread Tom Evans
On Wed, Mar 14, 2012 at 6:53 PM, orschiro  wrote:
> Hello Tom,
>
> I'm aware of that. But do not get me wrong. I only use Power Shell to
> run the commands, for nothing more.
>
> it is simply more comfortable for me than CMD.
>
> By running Python on Windows you mean the Python IDLE?
>
> Regards
>

No, I meant that you will not get much help with launching python
applications via powershell here, because the people on this list are
django developers, and in general do not use powershell.

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.



Re: Django application performance estimates?

2012-03-15 Thread Xavier Ordoquy

Le 15 mars 2012 à 09:34, Sithembewena Lloyd Dube a écrit :

> Xavier, thanks for the link. I'm watching it and I reckon it could help 
> address the query.

This being said, because it is technically possible doesn't mean it is easy or 
will not cost time/money to get there.
One would argue that once you hit performance issues - with a decent code base 
- you'll probably be making enough money to invest on a scalability issues.

Regards,
Xavier Ordoquy,
Linovia.

-- 
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 application performance estimates?

2012-03-15 Thread Sithembewena Lloyd Dube
Xavier, thanks for the link. I'm watching it and I reckon it could help
address the query.

On Thu, Mar 15, 2012 at 10:21 AM, Xavier Ordoquy wrote:

>
> Le 15 mars 2012 à 09:04, kenneth gonsalves a écrit :
>
> > On Thu, 2012-03-15 at 09:46 +0200, Sithembewena Lloyd Dube wrote:
> >> - concurrent active users
> >>   - emails per day
> >>   - lessons uploaded on the system
> >>   - etc.
> >>
> >>
> >> How do I address this sort of query?
> >
> > actually this has nothing to do with django. It depends on hardware.
>
> and architecture.
> Have a look at
> http://blip.tv/pycon-us-videos-2009-2010-2011/pycon-2011-disqus-serving-400-million-people-with-python-4898303
> The talk will give you an idea of what's possible with Python & Django.
> First part will most probably speak to non technicals.
>
> Regards,
> Xavier Ordoquy.
> Linovia.
>
> --
> 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.
>
>


-- 
Regards,
Sithembewena Lloyd Dube

-- 
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 application performance estimates?

2012-03-15 Thread Sithembewena Lloyd Dube
Hi Kenneth,

Thanks for the response. The project will be hosted at WebFaction (which I
recommended, having used their services with great results in the past). It
will start off on shared hosting and could end up in a dedicated server.
The client wants some sort of "performance guarantee". I was tempted to
remind them of the saying "premature optimisation is the root of all evil"
- then I thought, being non-developers, it would make no sense to them.

Some requirements I must agree to include:


   1.

  Ability to accommodate large numbers of active users and content.
  2.

  Ability to scale the system further without requiring a redesign.

I think point two is a moot point. Who ever makes that sort of
generalisation? I need a way to assure them short of just saying "it will
work!".

On Thu, Mar 15, 2012 at 10:04 AM, kenneth gonsalves
wrote:

> On Thu, 2012-03-15 at 09:46 +0200, Sithembewena Lloyd Dube wrote:
> > - concurrent active users
> >- emails per day
> >- lessons uploaded on the system
> >- etc.
> >
> >
> > How do I address this sort of query?
>
> actually this has nothing to do with django. It depends on hardware.
> --
> 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.
>
>


-- 
Regards,
Sithembewena Lloyd Dube

-- 
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 application performance estimates?

2012-03-15 Thread Xavier Ordoquy

Le 15 mars 2012 à 09:04, kenneth gonsalves a écrit :

> On Thu, 2012-03-15 at 09:46 +0200, Sithembewena Lloyd Dube wrote:
>> - concurrent active users
>>   - emails per day
>>   - lessons uploaded on the system
>>   - etc.
>> 
>> 
>> How do I address this sort of query? 
> 
> actually this has nothing to do with django. It depends on hardware.

and architecture.
Have a look at 
http://blip.tv/pycon-us-videos-2009-2010-2011/pycon-2011-disqus-serving-400-million-people-with-python-4898303
The talk will give you an idea of what's possible with Python & Django. First 
part will most probably speak to non technicals.

Regards,
Xavier Ordoquy.
Linovia.

-- 
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 application performance estimates?

2012-03-15 Thread kenneth gonsalves
On Thu, 2012-03-15 at 09:46 +0200, Sithembewena Lloyd Dube wrote:
> - concurrent active users
>- emails per day
>- lessons uploaded on the system
>- etc.
> 
> 
> How do I address this sort of query? 

actually this has nothing to do with django. It depends on hardware.
-- 
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.



Django application performance estimates?

2012-03-15 Thread Sithembewena Lloyd Dube
Hi Everyone,

I am working on a client's project for a public-facing learning application
in Django with various features (think of a platform with courses, tests
etc). I am only finishing the models and the front-end is still undone.
However, the client wants "...guidelines in terms of scalability that us
non-technical people can be more comfortable with...", such as:


   - concurrent active users
   - emails per day
   - lessons uploaded on the system
   - etc.


How do I address this sort of query?

-- 
Regards,
Sithembewena Lloyd Dube

-- 
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 admin login

2012-03-15 Thread vikalp sahni
ITS in settigns.py file.

if its not there just write.

SESSION_COOKIE_DOMAIN = "localhost" and then try.

Regards,
//Vikalp

On Wed, Mar 14, 2012 at 11:48 PM, dummyman dummyman wrote:

> Wer is the SESSION_COOKIE_DOMAIN ?
>
>
> On Wed, Mar 14, 2012 at 11:32 PM, dummyman dummyman wrote:
>
>> hi
>>
>> i got this error msg
>>
>> Please enter a correct username and password. Note that both fields are
>> case-sensitive.
>>
>>
>> On Wed, Mar 14, 2012 at 11:21 PM, vikalp sahni wrote:
>>
>>> Can you share your SESSION_COOKIE_DOMAIN setting. In your settings.py
>>> file.
>>>
>>> Also, is there any error message which is displayed on top of login form
>>> when you try to login?
>>>
>>> Regards,
>>> //Vikalp
>>>
>>>
>>> On Wed, Mar 14, 2012 at 11:06 PM, dummyman dummyman 
>>> wrote:
>>>
 hi ..

 I created a superuser but still getting the same error

 @vikalp: But it works for other projects with the same superuser name
 and password


 On Wed, Mar 14, 2012 at 10:57 PM, Denis Darii wrote:

> Try to create your superuser again:
>
> ./manage.py createsuperuser
>
>
> On Wed, Mar 14, 2012 at 6:25 PM, vikalp sahni 
> wrote:
>
>> You have to check your
>>
>> SESSION_COOKIE_DOMAIN in settings file if i.e pointing to "localhost"
>> (if not cookies will not properly set and hence login will not be 
>> allowed)
>>
>> the best would be to use some host entry like example.com 127.0.0.1
>> and then use that in SESSION_COOKIE_DOMAIN and for accessing project on
>> browser.
>>
>> Regards,
>> //Vikalp
>>
>>
>> On Wed, Mar 14, 2012 at 10:51 PM, dummyman dummyman <
>> tempo...@gmail.com> wrote:
>>
>>>
>>> Hi,
>>> I created a new project in django
>>>
>>> 1.I created a new database
>>> 2. I created a new user
>>> 3.python manage syncdb
>>> 4.python manae.py runserver
>>>
>>> when i visit localhost:8080/admin -> it asks for username n passwd.
>>> but the login fails inspite of entering correct one
>>>
>>> But it works for a different project
>>>
>>> --
>>> 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.
>>
>
>
>
> --
> This e-mail and any file transmitted with it is intended only for the
> person or entity to which is addressed and may contain information that is
> privileged, confidential or otherwise protected from disclosure. Copying,
> dissemination or use of this e-mail or the information herein by anyone
> other than the intended recipient is prohibited. If you are not the
> intended recipient, please notify the sender immediately by return e-mail,
> delete this communication and destroy all copies.
>
>  --
> 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 

Re: Jquery .load() function not responding with django

2012-03-15 Thread Eli_West
Found that jquery ajax does not load correctly in my firefox install.
Stock jquery example wasnt working either so I ran it in  a Windows IE
install.



On Mar 14, 8:59 pm, Eli_West  wrote:
> I just updated the jquery library so I shouldn't be that.
>
> Ive got to be doing something wrong.. theres no way .load() simply
> doesn't work with django.
>
> On Mar 14, 8:39 pm, Eli_West  wrote:
>
>
>
>
>
>
>
> > Thanks for the reply. It is loaded as an external script/file. That is
> > how it listed below right? Ive tried including it right in the file
> > too.
>
> > I think I know what you mean about using the url tag, I justed tried
> > this solution but with no results:
>
> >         $(document).ready(function() {
> >     $('.list').click(function () {
>
> >         $('#message').load('{{ url testload}}');
> >         return false;
> >     });
>
> > });
>
> > which calls a django view to serve the page. Still does not work
> > however, unless I am doing it incorrectly. Could it be a jquery
> > library error. Here is my django view and url now:
>
> > def testload(request):
> >     return render_to_response('tdcreative/testcontent.htm')
>
> > 
> > // in url conf
> >  (r'^tdcreative/testload/$', 'tdcreative.views.testload'),
>
> > On Mar 14, 12:02 pm, Daniel Roseman  wrote:
>
> > > On Wednesday, 14 March 2012 09:21:29 UTC-7, Eli_West wrote:
>
> > > > I've ran into in issue where jquery .load() will load extra content by
> > > > directly opening html file in a browser but if served through Django
> > > > devel server the jquery load() is ignored. Have no idea what could be
> > > > happening but I've seen someone use a django url in the .load() call
> > > > instead of pointing .load() directly to a file:
>
> > > > 
> > > >     $('.myClass').load('{% url update_dropdown %}',
> > > >         {'kind': "Book" },
> > > >         function(data){
> > > >             alert(data);
> > > >      });
>
> > > > 
>
> > > > He said he saw issues with a jquery library Any thoughts would be
> > > > great. BTW not a static file serving issue. Here is the very simple
> > > > code that works w/o django, but same thing loaded through django
> > > > fails:
>
> > > > ///code from apress jquery, thanks to Bintu Harwani
>
> > > > basic jquery load function
>
> > > > $(document).ready(function() {
> > > >     $('.list').click(function () {
> > > > $('#message').load('namesinfo.htm li');
> > > >         return false;
> > > >     });
> > > > });
>
> > > > /basic html file
>
> > > >  > > >         "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd;>
>
> > > > http://www.w3.org/1999/xhtml; xml:lang="en" lang="en">
> > > >   
> > > >         
> > > >         JQuery Examples
> > > >          > > > script>
> > > >