Re: how to get the time from date-based generic views

2011-02-25 Thread John Yeukhon Wong
OHHH this is really impressive. I didn't really think of that.

Thanks! Now I have another concept loaded under my belt. Hhaha

THank!

On Feb 26, 12:18 am, Russell Keith-Magee 
wrote:
> On Sat, Feb 26, 2011 at 1:09 PM, John Yeukhon Wong
>
>  wrote:
> > Suppose we have a django page using
> > django.views.generic.date_based.object_detail (or even archive_index..
> > actually doesn't really matter...)
>
> > In the model class I saved the datetime.datetime.now which suppose to
> > include the day, month, year, and time.
>
> > But I have no idea how to access the time part when i am using this
> > generic views
>
> > What I want is Feb 26, 2011,  01:12:04 AM
> > I can get the calendar part by {{ object.pub_date}}
>
> > How do I get the time part?
>
> The answer doesn't really have anything to do with class based views
> -- it's a templating issue.
>
> Your model has a field that contains a datetime field -- a single
> field, called pub_date, that contains a date component and a time
> component. When you output {{ object.pub_date }}, it's outputting the
> entire date-time content. If you want to only show the time component,
> you have two options:
>
> 2) Call the time() method on the pub_date attribute.
>
> {{ object.pub_date.time }}
>
> This is possible because all datetime objects (whichs is what
> object.pub_date is returning) have a built-in method called time()
> that returns the time component, and Django's template engine will
> traverse (and invoke) built-in methods as part of the dot-notation
> syntax.
>
> 1) Use the |date filter to only print time-related components.
>
> {{ object.pub_date|date:"P" }}
>
> would output "1:12 AM". This is ultimately the most flexible approach,
> because you can determine exactly how dates are displayed. See the
> docs on the date filter [1] for other formatting options.
>
> [1]http://docs.djangoproject.com/en/1.2/ref/templates/builtins/#date
>
> Yours
> Russ Magee %-)

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



Re: how to get the time from date-based generic views

2011-02-25 Thread Russell Keith-Magee
On Sat, Feb 26, 2011 at 1:09 PM, John Yeukhon Wong
 wrote:
> Suppose we have a django page using
> django.views.generic.date_based.object_detail (or even archive_index..
> actually doesn't really matter...)
>
> In the model class I saved the datetime.datetime.now which suppose to
> include the day, month, year, and time.
>
> But I have no idea how to access the time part when i am using this
> generic views
>
> What I want is Feb 26, 2011,  01:12:04 AM
> I can get the calendar part by {{ object.pub_date}}
>
> How do I get the time part?

The answer doesn't really have anything to do with class based views
-- it's a templating issue.

Your model has a field that contains a datetime field -- a single
field, called pub_date, that contains a date component and a time
component. When you output {{ object.pub_date }}, it's outputting the
entire date-time content. If you want to only show the time component,
you have two options:

2) Call the time() method on the pub_date attribute.

{{ object.pub_date.time }}

This is possible because all datetime objects (whichs is what
object.pub_date is returning) have a built-in method called time()
that returns the time component, and Django's template engine will
traverse (and invoke) built-in methods as part of the dot-notation
syntax.

1) Use the |date filter to only print time-related components.

{{ object.pub_date|date:"P" }}

would output "1:12 AM". This is ultimately the most flexible approach,
because you can determine exactly how dates are displayed. See the
docs on the date filter [1] for other formatting options.

[1] http://docs.djangoproject.com/en/1.2/ref/templates/builtins/#date

Yours
Russ Magee %-)

-- 
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: Number of Django powered sites?

2011-02-25 Thread Russell Keith-Magee
On Sat, Feb 26, 2011 at 6:49 AM, Adrian Andreias  wrote:
> Hello,
>
> I'm looking for some global statistics like:
> - number of django powered web sites
> - number of python powered sites
> - web framework popularity index
> - number of django developers
>
> I know it's the most popular py web framework, I'm just looking for
> numbers, absolute or relative.
>
> I'm already a Django developer, so it's not about choosing a
> framework, I just need numbers for a research.

I'd like these number too :-)

Seriously -- this is something that's really hard to give concrete
numbers for, because Django doesn't require any specific registration
process, and there's no 'telltale sign' that can be used to
automatically identify a Django site when it's in the wild.

It's an imprecise science, but here's a few suggestions for ways you
can get numbers that reflect the size of the Django audience:

 * Number of subscribers to django-dev and django-users mailing lists.
However, these numbers aren't comprehensive -- almost everyone I know
that is using Django professionally *isn't* on these mailing lists.

 * Number of job ads mentioning Django.

 * Alexa numbers djangoproject.com. Inaccurate an incomplete, but
easily available.

 * Google trend numbers for Django. Problematic because "django" also
describes a Jazz musician, an Italian spaghetti western movie, and a
professional pool player (amongst others).

The other approach that's worth looking into: rather than looking for
specific numbers, look for case studies that demonstrate large
established companies that are using Django. We've got a
work-in-progress list of some such success stories on our wiki [1];
we're hoping to turn this in a more useful resource.

[1] http://code.djangoproject.com/wiki/CaseStudyLeads

Sorry I can't give any better answer than that. If you manage to find
any other source of useful data, I'm certainly interested to hear
about it.

Yours,
Russ Magee %-)

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



how to get the time from date-based generic views

2011-02-25 Thread John Yeukhon Wong
Suppose we have a django page using
django.views.generic.date_based.object_detail (or even archive_index..
actually doesn't really matter...)

In the model class I saved the datetime.datetime.now which suppose to
include the day, month, year, and time.

But I have no idea how to access the time part when i am using this
generic views

What I want is Feb 26, 2011,  01:12:04 AM
I can get the calendar part by {{ object.pub_date}}

How do I get the time part?


For example, in urls.py

entry_info_dict = {
'queryset': Entry.publish.all(),
'date_field': 'pub_date',
}

Here's the doc for quick access
http://docs.djangoproject.com/en/dev/ref/class-based-views/#date-based-views

Thank you guys.

-- 
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: Number of Django powered sites?

2011-02-25 Thread Shawn Milochik
This will give you some info on Django in particular, but not
comparisons to other frameworks:

http://www.djangosites.org/stats/

Shawn

-- 
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 Donations App

2011-02-25 Thread Francisco Ceruti
A few months ago I successfully used this app 
https://github.com/johnboxall/django-paypal

I hope this can help you :)

On Feb 25, 6:24 pm, Brad Reardon  wrote:
> Heya django-users,
>
> I have been working on a website for a client, and they are in need of
> an app that is for donations. Being no PayPal IPN-processing expert, I
> unfortunately do not know how to program an app that would display the
> names and amounts of the donations received. I have checked out django-
> donation, found on Launchpad, but it doesn't seem to perform the way I
> would like.
>
> If you would, could you guys provide me with a link to an app that
> does the functions I require? If not, documentation on the PayPal API
> would be nice, so that I could process the requests.
>
> One more thing; instead of the name of the person that had donated
> that PayPal provides, I would like for them to be able to input an
> alias.
>
> Thanks!
> Brad Reardon

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



searching a model in admin with data from a related model

2011-02-25 Thread Bobby Roberts
consider this model (only a portion of it):

class Tracker (models.Model):
id = models.AutoField (primary_key=True)
Barcode = models.IntegerField(unique = True, blank=False)
OrderId = models.IntegerField(blank=False)
CustomerId = models.CharField (max_length=20, blank=False)
   [[sniped]]


when you view the Tracker model in /admin on the list page, there is a
search box in the top right corner.  Is it possible to search on
another model called Customer for Customer.firstname,
customer.LastName?  If you notice we have CustomerId as a charfield...
if we changed that to a foreign key, is it possible to search the
Tracker model by customer firstname/lastname and if so, how?

thanks in advance!





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



Number of Django powered sites?

2011-02-25 Thread Adrian Andreias
Hello,

I'm looking for some global statistics like:
- number of django powered web sites
- number of python powered sites
- web framework popularity index
- number of django developers

I know it's the most popular py web framework, I'm just looking for
numbers, absolute or relative.

I'm already a Django developer, so it's not about choosing a
framework, I just need numbers for a research.

Thanks for any pointers to finding hard facts.


-- 
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 Error - Invalid block tag: 'thumbnail', expected 'else' or 'endif'

2011-02-25 Thread Bobby Roberts
anyone have any other ideas?

On Feb 22, 5:02 pm, Bobby Roberts  wrote:
> Hey Daniel -
>
> we've got {% load thumbnail%} at the top of the template (a standard
> satchmo template anyway)... running version 3.2.5 for sorl.
>
> On Feb 22, 4:25 pm, Daniel Roseman  wrote:
>
> > On Tuesday, February 22, 2011 6:22:16 PM UTC, Bobby Roberts wrote:
>
> > > Hi group.  I've posted this in the satchmo group but am posting here
> > > as well in hopes of getting some help.
>
> > > This error is caused by this code:
>
> > > {% if product.main_image %}
> > >               
> > >               {% thumbnail product.main_image.picture 85x85 as image
> > > %}
> > >                > > src="{{ image }}" width="{{ image.width }}"
> > > height="{{ image.height }}" />
> > >               
> > > {% endif %}
>
> > > it makes use of sorl thumbnail to resize images on the fly i believe.
> > > We can import sorl thumbnail into python from command line just fine.
>
> > > If anyone uses satchmo for their ecommerce store have you run into
> > > this error?  How did you resolve.  Please help and thank you in
> > > advance.
>
> > You haven't loaded the template tag library that defines the thumbnail tag.
>
> >     {% load thumbnail_tags %}
>
> > or whatever.
> > --
> > DR.

-- 
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 Donations App

2011-02-25 Thread Shawn Milochik
So, what's your Django question?

Shawn

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



Streaming a csv file

2011-02-25 Thread bfrederi
I've tried a couple of different methods for streaming a large csv
file (it takes a few minutes to download entirely). The most recent
method I pulled from here:
http://stackoverflow.com/questions/2922874/how-to-stream-an-httpresponse-with-django

I turned off the GZipMiddleware and added the
@condition(etag_func=None)

get_row_data() is generating output when I raise and error within the
generator, but when the response sends, it is empty.

If you prefer to view it in a paste, here it is: http://dpaste.com/hold/449407/

import csv, cStringIO, time
from django.db import models
from django.db.models.fields.related import RelatedField
from django.http import HttpResponse
from django.views.decorators.http import condition

@condition(etag_func=None)
def csv_view(request, app_label, model_name):
""" Based on the filters in the query, return a csv file for the
given model """

#Get the model
model = models.get_model(app_label, model_name)

#if there are filters in the query
if request.method == 'GET':
#if the query is not empty
if request.META['QUERY_STRING'] != None:
keyword_arg_dict = {}
for key, value in request.GET.items():
#get the query filters
keyword_arg_dict[str(key)] = str(value)
#generate a list of row objects, based on the filters
objects_list = model.objects.filter(**keyword_arg_dict)
else:
#get all the model's objects
objects_list = model.objects.all()
else:
#get all the model's objects
objects_list = model.objects.all()
#max_items = 0
#loop through all the requested rows
#for row in objects_list:
#Create the csv wrapper for returning the csv file
#csv_wrapper = CSVWrapper(cStringIO.StringIO(), model,
objects_list)
#create the reponse object with a csv mimetype
response = HttpResponse(
stream_response_generator(model, objects_list),
mimetype='text/plain',
)
#Create the csv filename
filename = "%s_%s.csv" % (app_label, model_name)
#Set the response as an attachment with a filename
#response['Content-Disposition'] = "attachment; filename=%s" %
(filename)
return response

def stream_response_generator(model, objects_list):
"""Streaming function to return data iteratively """
yield get_field_headers(model)
for row_item in objects_list:
yield get_row_data(model, row_item)
time.sleep(1)

def get_row_data(model, row):
"""Get a row of csv data from an object"""
#Create a temporary csv handle
csv_handle = cStringIO.StringIO()
#create the csv output object
csv_output = csv.writer(csv_handle)
value_list = []
for field in model._meta.fields:
#Set the item amount to the amount of fields to start
#item_amount = len(model._meta.fields)
#if the field is a related field (ForeignKey, ManyToMany,
OneToOne)
if isinstance(field, RelatedField):
#get the related model from the field object
related_model = field.rel.to
for key in row.__dict__.keys():
#find the field in the row that matches the related
field
if key.startswith(field.name):
#Get the unicode version of the row in the related
model, based on the id
try:
entry = related_model.objects.get(
id__exact=int(row.__dict__[key]),
)
except:
pass
else:
value = entry.__unicode__().encode("utf-8")
#item_amount += 1
break
#if it isn't a related field
else:
#get the value of the field
if isinstance(row.__dict__[field.name], basestring):
value = row.__dict__[field.name].encode("utf-8")
else:
value = row.__dict__[field.name]
#Determine of the current item amount is larger, make it the
max
#max_items = max(max_items, item_amount)
value_list.append(value)
#add the row of csv values to the csv file
csv_output.writerow(value_list)
#Return the string value of the csv output
return csv_handle.getvalue()

def get_field_headers(model):
"""Get the headers of the model's csv"""
#Create a temporary csv handle
csv_handle = cStringIO.StringIO()
#create the csv output object
csv_output = csv.writer(csv_handle)
field_names = []
#gather all the field names, in the same order they were defined
in the model
for field in model._meta.fields:
field_names.append(field.name)
#write them as the first csv row
csv_output.writerow(field_names)
#Return the string value of the csv output
return csv_handle.getvalue()

-- 
You received this message because you are subscribed to the Google 

Re: sqlite path

2011-02-25 Thread Tim
On Feb 25, 4:00 pm, Andre Terra  wrote:
> On Fri, Feb 25, 2011 at 5:28 PM, Tim  wrote:
> > hi,
> > I'm using Django 1.2.3 and I have a new sqlite (3.7.5) installed in a
> > custom location.
> > There is an old sqlite (3.6.23.1) installed in /usr/local/bin/.
>
> > How do I tell Django to use the new sqlite? I'm on FreeBSD 8.0.
>
> > thanks,
> > --Tim Arnold
>
> > --
> Try appending the custom location to the beginning of your PYTHONPATH.
>
> Sincerely,
> Andre Terra

Thanks I just tried that, but still no luck. My PYTHONPATH never did
have /usr/local/lib in in though, just a lot of pointers into /usr/
local/lib/python2.7, etc.

Maybe this is an apache/wsgi issue instead of django, but django is
where I'm getting errors (disk io error). That would look like  a file
permission issue, but just for testing purposes, i set the database
file and its parent dir to 777 permission.

arrrggg. thanks,
--Tim

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



grouping results in change_list admin view

2011-02-25 Thread Dan Christensen
I'd like to group the results shown on the admin change_list view
according to one (or more) fields.  For example, if my model
had author and title fields, I might like a display that looks
like:

Author1:
  Book1
  Book2
  Book3
Author2:
  Book4
Author3:
  Book5
  Book6

So each author name appears only once, and it is visually separated from
the book titles.

I know that this is the sort of thing that {% regroup %} can handle, so
my question is whether I can easily adapt the default admin templates 
to use {% regroup %}.  I tried digging into this, but found that this
part of the page is generated by some complicated code in admin_list.py,
so it's not clear to me what the best way to accomplish this is.

Any suggestions or pointers?

Thanks,

Dan

-- 
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 Donations App

2011-02-25 Thread Brad Reardon
Heya django-users,

I have been working on a website for a client, and they are in need of
an app that is for donations. Being no PayPal IPN-processing expert, I
unfortunately do not know how to program an app that would display the
names and amounts of the donations received. I have checked out django-
donation, found on Launchpad, but it doesn't seem to perform the way I
would like.

If you would, could you guys provide me with a link to an app that
does the functions I require? If not, documentation on the PayPal API
would be nice, so that I could process the requests.

One more thing; instead of the name of the person that had donated
that PayPal provides, I would like for them to be able to input an
alias.

Thanks!
Brad Reardon

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

2011-02-25 Thread Andre Terra
Try appending the custom location to the beginning of your PYTHONPATH.

Sincerely,
Andre Terra

On Fri, Feb 25, 2011 at 5:28 PM, Tim  wrote:

> hi,
> I'm using Django 1.2.3 and I have a new sqlite (3.7.5) installed in a
> custom location.
> There is an old sqlite (3.6.23.1) installed in /usr/local/bin/.
>
> How do I tell Django to use the new sqlite? I'm on FreeBSD 8.0.
>
> thanks,
> --Tim Arnold
>
> --
> 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.



Foreignkey troubles : some key look ups give me a ValueError: invalid literal for int() with base 10 error

2011-02-25 Thread hari jayaram
Hi Everyone ,

I am using the svn version of django to write a django app to hook into a
legacy database.
I am having some problem with querying by a ForeignKey which is not a
Primary key. The sql datatype for the foreign key  is  VARCHAR(256) , but
lookups only succeed with integer fields . The original database has integer
and non-integer values for this field. Only Non-int fields throw a
ValueError when I try to use the filter in django.


here is my test case:

I have a Parent table and a child table.  Both parent and child have their
own primary keys. The child table has the parent attribute called ssn ( in
SQL a VARCHAR(256)) as a foreign key constraint. The SQL for my test case is
given below.
After creating this test database  and then creating my models with django
manage.py inspectdb and running syncdb , I get the following behavior (see
below). The ForeignKey Lookup succeeds only for int fields but fails for non
int fields. The test db and models.py is pasted below.

What am i doing wrong

Thanks
Hari




>>> c = Child.objects.filter(parents_ssn="2354234234")

Suceeds!

>>> print c[0].name
werwer sdfgsdg

The following lookup fails

>>> cfails = Child.objects.filter(parents_ssn="g354234234c")
Traceback (most recent call last):
  File "", line 1, in 
  File "/home/hari/djtrunk/django/db/models/manager.py", line 141, in filter
return self.get_query_set().filter(*args, **kwargs)
  File "/home/hari/djtrunk/django/db/models/query.py", line 550, in filter
return self._filter_or_exclude(False, *args, **kwargs)
  File "/home/hari/djtrunk/django/db/models/query.py", line 568, in
_filter_or_exclude
clone.query.add_q(Q(*args, **kwargs))
  File "/home/hari/djtrunk/django/db/models/sql/query.py", line 1170, in
add_q
can_reuse=used_aliases, force_having=force_having)
  File "/home/hari/djtrunk/django/db/models/sql/query.py", line 1105, in
add_filter
connector)
  File "/home/hari/djtrunk/django/db/models/sql/where.py", line 67, in add
value = obj.prepare(lookup_type, value)
  File "/home/hari/djtrunk/django/db/models/sql/where.py", line 316, in
prepare
return self.field.get_prep_lookup(lookup_type, value)
  File "/home/hari/djtrunk/django/db/models/fields/related.py", line 136, in
get_prep_lookup
return self._pk_trace(value, 'get_prep_lookup', lookup_type)
  File "/home/hari/djtrunk/django/db/models/fields/related.py", line 209, in
_pk_trace
v = getattr(field, prep_func)(lookup_type, v, **kwargs)
  File "/home/hari/djtrunk/django/db/models/fields/__init__.py", line 882,
in get_prep_lookup
return super(IntegerField, self).get_prep_lookup(lookup_type, value)
  File "/home/hari/djtrunk/django/db/models/fields/__init__.py", line 292,
in get_prep_lookup
return self.get_prep_value(value)
  File "/home/hari/djtrunk/django/db/models/fields/__init__.py", line 876,
in get_prep_value
return int(value)
ValueError: invalid literal for int() with base 10: 'g354234234c'



models.py has:


from django.db import models

class Parent(models.Model):
id = models.IntegerField(primary_key=True)
name = models.CharField(max_length=384, blank=True)
ssn = models.CharField(max_length=768, blank=True)
class Meta:
db_table = u'Parent'
app_label = u'mydjapp'

class Child(models.Model):
id = models.IntegerField(primary_key=True)
name = models.CharField(max_length=384, blank=True)
parents_ssn = models.ForeignKey(Parent, null=True,
db_column='parents_ssn', blank=True)
class Meta:
db_table = u'child'
app_label= u'mydjapp'

~
#
The database columns are:
##

mysql> select * from Parent;
++--+--+
| id | name | ssn  |
++--+--+
|  1 | Aefwesk baob | 42s354234234 |
|  2 | Ask bob  | 2354234234   |
|  3 | Seelan Cyata | 2354234234c  |
|  4 | Hdel Abnot   | g354234234c  |
++--+--+
4 rows in set (0.00 sec)


mysql> select * from child;
+++-+
| id | name   | parents_ssn |
+++-+
|  1 | werwer sdfgsdg | 2354234234  |
|  2 | Hyadr Abnot| g354234234c |
+++-+
2 rows in set (0.00 sec)



##
The raw SQL test was setup :
###
CREATE TABLE `Parent` (
 `id` int(11) NOT NULL,
 `name` varchar(128) DEFAULT NULL,
 `ssn` varchar(256) DEFAULT NULL,
 PRIMARY KEY (`id`),
 KEY `parents_ssn_fk` (`ssn`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 |


CREATE TABLE `child` (
 `id` int(11) NOT NULL,
 `name` varchar(128) DEFAULT NULL,
 `parents_ssn` varchar(256) DEFAULT NULL,
 PRIMARY KEY (`id`),
 KEY `parents_ssn` (`parents_ssn`),
 CONSTRAINT `child_ibfk_1` FOREIGN KEY (`parents_ssn`) REFERENCES `Parent`
(`ssn`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 |

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" 

sqlite path

2011-02-25 Thread Tim
hi,
I'm using Django 1.2.3 and I have a new sqlite (3.7.5) installed in a
custom location.
There is an old sqlite (3.6.23.1) installed in /usr/local/bin/.

How do I tell Django to use the new sqlite? I'm on FreeBSD 8.0.

thanks,
--Tim Arnold

-- 
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-pluggables urlconf problem (NoReverseMatch TemplateSyntaxError)

2011-02-25 Thread Andre Terra
Hey Nowell,

Sorry for not replying earlier, but I just made it work today. Apparently, I
hadn't set up my report views properly, which is the PluggableApp. I didn't
think to look inside __init__.py at first, and it turns out I was missing a
lot of code in there.

Thanks anyway for your prompt response!


Sincerely,
André Terra


On Fri, Feb 25, 2011 at 1:45 PM, Nowell Strite wrote:

> Hey Andra,
>
> I will try and take a look at this this weekend or next week. Can you
> post your urls.py file that corresponds to the page generating the
> error and for the requested pluggable_url
>
> Thanks,
> Nowell
>
> On Feb 24, 10:15 am, Andre Terra  wrote:
> > Hello, folks
> >
> > I'm trying to use django-pluggables (
> https://github.com/nowells/django-pluggables) and I'm having a very hard
> > time figuring out how to set it up. The documentation is slender and the
> > example app has the same name as its one and only model, which is very
> > different from my case. So far, a lot is working, but the pluggable
> urlconf
> > has been giving me a real hard time for a couple of days now.
> >
> > I have a main app called 'analysis' that defines models Order and
> Customer.
> > I also have a secondary app called 'report' which I would like to use to
> > generate statistics on Orders and Customers on a table-level.
> >
> > The problem is that I can't do an url reverse on urls defined on that
> > 'report' app, no matter how I try to import its urls. If anyone could
> please
> > explain how django-pluggables expects me set this up, I'd be eternally
> > thankful.
> >
> > Here are some tiny, yet relevant parts of my code which should make my
> case
> > clearer:
> >
> >
> http://tinyurl.com/analysis-urlshttp://tinyurl.com/analysis-viewshttp://tinyurl.com/report-urls-traditional
> >
> > I think one of the issues that needs attention is this line from the
> example
> > app:
> https://github.com/nowells/django-pluggables/blob/master/examples/sil...
> >
> > What exactly am I supposed to pass to my version of that class?
> >
> > Finally, my traceback:http://dpaste.com/444858/
> >
> > FTR, using {% url %} instead of {% pluggable_url %} yields the same
> error.
> >
> > Thanks again in advance!
> >
> > Sincerely,
> > Andre Terra
>
> --
> 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: Cross Site Request Forgery (csrf) via POST / JQuery

2011-02-25 Thread Casey S. Greene
I'm not sure if you ever solved this, but the provided code didn't work 
with jquery 1.5.0 for me (though it does with 1.4.4 and 1.5.1).


Maybe this is what you are observing.

Hope this helps!
Casey

On 02/22/2011 08:30 PM, gorans wrote:

Hi

I'm using Django's CSRFViewMiddleware and am making a POST request in
a page (using JQuery) in the form of:

$.post('{% url posted_to_wall %}', {
network: 'FBK',
action_type: 'feed',
effect: 1
});

In order to satisfy the csrf_token check, I have implemented the
instructions from the Django docs: 
http://docs.djangoproject.com/en/dev/ref/contrib/csrf/
(with some tweaks to only run the csrf on POST and not GET)

$('html').ajaxSend(function(event, xhr, settings) {
 xhr.setRequestHeader("x-testing1", 'testme1');
 function getCookie(name) {
 var cookieValue = null;
 if (document.cookie&&  document.cookie != '') {
 var cookies = document.cookie.split(';');
 // optimise this!
 for (var i = 0; i<  cookies.length; i++) {
 var cookie = jQuery.trim(cookies[i]);
 // Does this cookie string begin with the name we
want?
 if (cookie.substring(0, name.length + 1) == (name +
'=')) {
 cookieValue =
decodeURIComponent(cookie.substring(name.length + 1));
 //console.log('cookie is ' + cookieValue);
 break;
 }
 }
 }
 return cookieValue;
 }

//console.log(/^http:.*/.test(settings.url));

if (settings.type == 'POST') {
if (!(/^http:.*/.test(settings.url) || /
^https:.*/.test(settings.url))) {
// Only send the token to relative URLs i.e. locally.
// console.log('we\'re local ajax');
xhr.setRequestHeader("X-CSRFToken", getCookie('csrftoken'));
}
}
});

However, the X-CSRFToken request is not being set by the command
xhr.setRequestHeader("X-CSRFToken", getCookie('csrftoken'));

I have tried on both Chrome 11.0.672.2 dev and Firefox 4.0b11

I have worked around the issue by adding  csrfmiddlewaretoken: $
('input[name|="csrfmiddlewaretoken"]').attr('value')  to my POST data,
but would prefer to have it all done with the .ajaxSend method
presented in the Django Docs.

Does anyone have any suggestions as to why the xhr.setRequestHeader()
doesn't work?

Thanks is advance

Goran!



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

2011-02-25 Thread Marc DM
On Feb 25, 11:18 am, "Szabo, Patrick \(LNG-VIE\)"
 wrote:
> Hi,
>
> I was trying to get "An AJAX Select Widget for Django"
> (http://code.djangoproject.com/wiki/AJAXWidgetComboBox) running but i
> found out that it doesn't work with newer versions of django (correct me
> if I'm wrong.)
>
> Is there an alternative or a way to make it work with the newest version
> ?!


If you're using jQuery, you could take a look at the combobox example
on the jQueryUI autocomplete page.

http://jqueryui.com/demos/autocomplete/#combobox

They use the autocomplete widget from jQueryUI and create a basic
combobox. The good thing is that the code is all right there and quite
easy to understand. So, if it doesn't do EXACTLY what you want, you
can modify it.

There seems to be no real consensus on how the combobox should work so
there are many incompatible versions out there. Try using the jQuery
one as a starting point and make what you want.

Just my $0.02


Marc DM
DjangoMuser

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



Model Question

2011-02-25 Thread Noah Nordrum
I'm trying to cram the ORM into an existing schema and have an issue I
can't seem to get around.

I have a number of tables with a timestamp column, but the column name
is inconsistent. I would like to put the timestamp field in an
abstract superclass, but I can't seem to figure out how to override
the column name in the subclass. Can I do this?

Also, is there a better way to check for existence of a field in a
models.Manager method than the following:

def filteredResults(self):
qs = super(MyManager, self).get_query_set()
for field in qs.model._meta.fields:

It works, but not sure how hacky this is...

New to django and python (from primarily Java recently).

-- 
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-pluggables urlconf problem (NoReverseMatch TemplateSyntaxError)

2011-02-25 Thread Nowell Strite
Hey Andra,

I will try and take a look at this this weekend or next week. Can you
post your urls.py file that corresponds to the page generating the
error and for the requested pluggable_url

Thanks,
Nowell

On Feb 24, 10:15 am, Andre Terra  wrote:
> Hello, folks
>
> I'm trying to use django-pluggables 
> (https://github.com/nowells/django-pluggables) and I'm having a very hard
> time figuring out how to set it up. The documentation is slender and the
> example app has the same name as its one and only model, which is very
> different from my case. So far, a lot is working, but the pluggable urlconf
> has been giving me a real hard time for a couple of days now.
>
> I have a main app called 'analysis' that defines models Order and Customer.
> I also have a secondary app called 'report' which I would like to use to
> generate statistics on Orders and Customers on a table-level.
>
> The problem is that I can't do an url reverse on urls defined on that
> 'report' app, no matter how I try to import its urls. If anyone could please
> explain how django-pluggables expects me set this up, I'd be eternally
> thankful.
>
> Here are some tiny, yet relevant parts of my code which should make my case
> clearer:
>
> http://tinyurl.com/analysis-urlshttp://tinyurl.com/analysis-viewshttp://tinyurl.com/report-urls-traditional
>
> I think one of the issues that needs attention is this line from the example
> app:https://github.com/nowells/django-pluggables/blob/master/examples/sil...
>
> What exactly am I supposed to pass to my version of that class?
>
> Finally, my traceback:http://dpaste.com/444858/
>
> FTR, using {% url %} instead of {% pluggable_url %} yields the same error.
>
> Thanks again in advance!
>
> Sincerely,
> Andre Terra

-- 
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: Collaborative text editor with Django

2011-02-25 Thread william ratcliff
If it were me, I would look into using "orbited".  We've used it for doing
real time plotting of data using django.  I'm not sure how it scales
though...

William

On Fri, Feb 25, 2011 at 11:36 AM, Pete  wrote:

> I was looking into doing this too! Ethereal is written in java so we
> either need to port the code or use jython.  Hookbox would be a good
> alternative.
>
> If anyone has done 'multiplayer' in Google docs or spreadsheet then
> they will see the value of this app
>
> On Feb 24, 12:35 pm, Piotr Zalewa  wrote:
> > On 02/23/11 08:32, Anoop Thomas Mathew wrote:
> >
> > > Is there any collaborative text editing application available for
> django.
> > > Has anybody tried with etherpad(www.etherpad.org
> > > ) along with django?
> >
> > If you'd start building it - I'd be collaborating.
> >
> > zalun
> > --
> > blog  http://piotr.zalewa.info
> > jobs  http://webdev.zalewa.info
> > twit  http://twitter.com/zalun
> > face  http://facebook.com/zaloon
>
> --
> 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: Collaborative text editor with Django

2011-02-25 Thread Pete
I was looking into doing this too! Ethereal is written in java so we
either need to port the code or use jython.  Hookbox would be a good
alternative.

If anyone has done 'multiplayer' in Google docs or spreadsheet then
they will see the value of this app

On Feb 24, 12:35 pm, Piotr Zalewa  wrote:
> On 02/23/11 08:32, Anoop Thomas Mathew wrote:
>
> > Is there any collaborative text editing application available for django.
> > Has anybody tried with etherpad(www.etherpad.org
> > ) along with django?
>
> If you'd start building it - I'd be collaborating.
>
> zalun
> --
> blog  http://piotr.zalewa.info
> jobs  http://webdev.zalewa.info
> twit  http://twitter.com/zalun
> face  http://facebook.com/zaloon

-- 
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: jquery document ready aggregation

2011-02-25 Thread kost BebiX
Here's a usage example of that: http://paste.pocoo.org/show/33/

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



jquery document ready aggregation

2011-02-25 Thread kost BebiX
Hi! I would like to write two simple tags, one would be called {% domready 
%}, and another one is {% domready_render %}, first will add some js to some 
buffer and second will just join it alltogather and print it (at base 
template in some $(document).ready(...)). So my question is: where/how do I 
need to store some variables between those tags? (maybe some current request 
context or what?) 

I mean, I wrote something like:

@register.tag
def domready(parser, token):
nodelist = parser.parse(('enddomready',))
parser.delete_first_token()
return DomreadyNode(nodelist)

class DomreadyNode(template.Node):
def __init__(self, nodelist):
self.nodelist = nodelist

def render(self, context):
if 'dom_ready' not in context:
context['dom_ready'] = []

context['dom_ready'].append(self.nodelist.render(context))
return ''

@register.tag
def domready_render(parser, token):
return DomreadyRenderNode()

class DomreadyRenderNode(template.Node):
def render(self, context):
if 'dom_ready' in context:
return u"\n".join(context['dom_ready'])
return ''

But it doesn't work in different templates (contexts are different?).

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.



Re: Python/Django AMQP?

2011-02-25 Thread Tom Evans
Note that zeromq is not an AMQP compliant messaging queue.

Some benefits of directly using AMQP are:
You can cater for use cases that carrot doesn't consider - carrot is
targeted squarely at handling tasks asynchronously, amqp allows many
more use cases, pub/sub, logging event monitoring etc.
You aren't tied to one vendor or tool - the purpose of AMQP is to have
vendor neutral bus that any compliant tool can connect to and operate
on.

Of course, nothing stops you using both carrot and AMQP directly,
which is what I do.

Cheers

Tom

On Fri, Feb 25, 2011 at 2:42 PM, CrabbyPete  wrote:
> I just started looking at 0MQ it looks interesting
> http://zguide.zeromq.org/
>
>
> On Feb 24, 11:58 am, Brian Bouterse  wrote:
>> +1 for Celery and django-celery.  I use them also.
>>
>> On Thu, Feb 24, 2011 at 9:07 AM, Shawn Milochik  wrote:
>> > +1 on Celery and django-celery. I use them both.
>>
>> > --
>> > 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.
>>
>> --
>> Brian Bouterse
>> ITng Services
>
> --
> 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: Python/Django AMQP?

2011-02-25 Thread CrabbyPete
I just started looking at 0MQ it looks interesting
http://zguide.zeromq.org/


On Feb 24, 11:58 am, Brian Bouterse  wrote:
> +1 for Celery and django-celery.  I use them also.
>
> On Thu, Feb 24, 2011 at 9:07 AM, Shawn Milochik  wrote:
> > +1 on Celery and django-celery. I use them both.
>
> > --
> > 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.
>
> --
> Brian Bouterse
> ITng Services

-- 
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: Using user data from another project

2011-02-25 Thread Benedict Verheyen
On 25/02/2011 12:38, bruno desthuilliers wrote:

> Won't work that way.
> 
>> I need to set the user object in site B to get the user info (I display the 
>> username on every page amongst other data)
>>
>> Is that even possible?
> 
> Yeps, using multi-db support (to share the user tables) and a custom
> auth backend (so your siteB delegates auth to SiteA) :
> 
> * http://docs.djangoproject.com/en/1.2/topics/db/multi-db/
> * 
> http://docs.djangoproject.com/en/1.2/topics/auth/#other-authentication-sources
> 
> HTH

On first glance, this looks exactly what i need !
I will try and see if i get there.

Super, thanks,
Benedict


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

2011-02-25 Thread Norberto Leite
"WARNING: This write-up is quite old, and has not been updated to use
newforms."

N.

On Fri, Feb 25, 2011 at 12:18 PM, Szabo, Patrick (LNG-VIE) <
patrick.sz...@lexisnexis.at> wrote:

>  Hi,
>
>
> I was trying to get „An AJAX Select Widget for Django” (
> http://code.djangoproject.com/wiki/AJAXWidgetComboBox ) running but i
> found out that it doesn’t work with newer versions of django (correct me if
> I’m wrong.)Is there an alternative or a way to make it work with the
> newest version ?! Kind regards
>
>  . . . . . . . . . . . . . . . . . . . . . . . . . .
>
>  **
>
> Patrick Szabo
> XSLT-Entwickler
>
> LexisNexis
> Marxergasse 25, 1030 Wien
>
> patrick.sz...@lexisnexis.at
>
> Tel.: +43 (1) 534 52 - 1573
>
> Fax: +43 (1) 534 52 - 146
>
>
>
>  --
> 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.
>



-- 
Norberto Leite

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



Re: How to merge querysets and sort it?

2011-02-25 Thread Thomas Rega
I think you could solve your "problem" by usage of backward related objects ...
(assuming there exists a relation between your (two?) models)

http://docs.djangoproject.com/en/dev/topics/db/queries/#backwards-related-objects

"If a model has a ForeignKey, instances of the foreign-key model will
have access to a Manager that returns all instances of the first
model. By default, this Manager is named FOO_set, where FOO is the
source model name, lowercased. "

good luck,
TR



2011/2/25 Thomas Rega :
> could you paste the definition of the models? I think there is the
> need of a relationship between 'Data_Siswa' and 'Users'.
>
> regards,
> TR
>
>
> 2011/2/22  :
>> I'm not so sure if I'm answering your question but there's a way you can 
>> chain querysets.
>> In your views.py file import Q from django.db.models.
>> You could check django documentation. I think it works well.
>> Sent from my BlackBerry wireless device from MTN
>>
>> -Original Message-
>> From: Ryan Wijaya 
>> Sender: django-users@googlegroups.com
>> Date: Tue, 22 Feb 2011 07:01:49
>> To: Django users
>> Reply-To: django-users@googlegroups.com
>> Subject: How to merge querysets and sort it?
>>
>> For me it takes more than a week to solve it alone...
>> So to the point, is it possible to merge two querysets and sort it as
>> well?
>> Recently I've used itertools, but it returns a table with duplicated
>> value and requested objects not properly displayed (the get_full_name
>> displayed separately with other, creating a new row)
>>
>>
>> here's the codes
>> views.py
>>
>> def view_siswa(request):
>>        # list_detail.object_list, {"queryset": Data_Siswa.objects.all(),
>> "template_name": "views/view-siswa-list.html"}
>>        namasiswa = User.objects.all().exclude(is_staff='false')
>>        datasiswa = Data_Siswa.objects.all().order_by('kode_nis')
>>        query = chain(datasiswa, namasiswa)
>>        variables = RequestContext(request, {'siswa':query,})
>>        # variables = RequestContext(request, {'siswa':datasiswa,})
>>        return render_to_response(
>>                'views/view-siswa-list.html',
>>                # { 'siswa':namasiswa, 'datasiswa': datasiswa, }
>>                variables,
>>        )
>>
>>
>> template
>>
>> {% for object in siswa %}
>>                        
>>                                {{ 
>> object.username }}
>>                                {{ object.kode_nis }}
>>                                {{ object.first_name }}
>>                                {{ object.kode_jurusan }}
>>                                > href="/jurnal/siswa/
>> {{ object.id }}/">Lihat
>>                                Edit
>>                        
>>                        {% endfor %}
>>
>>
>> Muchly appreciated any help... btw I'm new in Django
>>
>> Regards
>>
>> Rian
>>
>> --
>> 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.
>>
>>
>
>
>
> --
> --- http://thoreg.org/ ---
>



-- 
--- http://thoreg.org/ ---

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



Re: How to merge querysets and sort it?

2011-02-25 Thread Thomas Rega
could you paste the definition of the models? I think there is the
need of a relationship between 'Data_Siswa' and 'Users'.

regards,
TR


2011/2/22  :
> I'm not so sure if I'm answering your question but there's a way you can 
> chain querysets.
> In your views.py file import Q from django.db.models.
> You could check django documentation. I think it works well.
> Sent from my BlackBerry wireless device from MTN
>
> -Original Message-
> From: Ryan Wijaya 
> Sender: django-users@googlegroups.com
> Date: Tue, 22 Feb 2011 07:01:49
> To: Django users
> Reply-To: django-users@googlegroups.com
> Subject: How to merge querysets and sort it?
>
> For me it takes more than a week to solve it alone...
> So to the point, is it possible to merge two querysets and sort it as
> well?
> Recently I've used itertools, but it returns a table with duplicated
> value and requested objects not properly displayed (the get_full_name
> displayed separately with other, creating a new row)
>
>
> here's the codes
> views.py
>
> def view_siswa(request):
>        # list_detail.object_list, {"queryset": Data_Siswa.objects.all(),
> "template_name": "views/view-siswa-list.html"}
>        namasiswa = User.objects.all().exclude(is_staff='false')
>        datasiswa = Data_Siswa.objects.all().order_by('kode_nis')
>        query = chain(datasiswa, namasiswa)
>        variables = RequestContext(request, {'siswa':query,})
>        # variables = RequestContext(request, {'siswa':datasiswa,})
>        return render_to_response(
>                'views/view-siswa-list.html',
>                # { 'siswa':namasiswa, 'datasiswa': datasiswa, }
>                variables,
>        )
>
>
> template
>
> {% for object in siswa %}
>                        
>                                {{ object.username 
> }}
>                                {{ object.kode_nis }}
>                                {{ object.first_name }}
>                                {{ object.kode_jurusan }}
>                                 href="/jurnal/siswa/
> {{ object.id }}/">Lihat
>                                Edit
>                        
>                        {% endfor %}
>
>
> Muchly appreciated any help... btw I'm new in Django
>
> Regards
>
> Rian
>
> --
> 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.
>
>



-- 
--- http://thoreg.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.



Pinax static files in windows7 virtualenv

2011-02-25 Thread Kopch
Hi all! I'm noob in django. I've installed Pinax project in windows
virtualenv, after i've made static files collect with build_media.
Everything were collected in the site_media\static. But pinax project
doesn't see them anyway. ADMIN_MEDIA_PREFIX is '/site_media/static/
admin' and all files are there.
In Ubuntu everything works fine, but i need to work in windows. Please
help me somebody and sorry for my English.

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



FormWizard and FormPreview

2011-02-25 Thread Merijn
Hey Guys,

I've got a problem with FormWizard and FormPreview and I need some the
direction.

First let me give you a quick view of the situation. What i'm looking
for is a FormWizard with multiple steps and on the last step a
FormPreview with all the data from the FromWizard. I think this a very
common situation, can't imagine i'm the only person who needs this.
But the problem is that:

* FormWizard does not accept FormPreview as a step
* FormPreview can not be based on a FormWizard (only on a single
form)

So as you can see I hit a dead end and need some direction or feedback
to try some new things.

My question is:
- How do you guys solve this situation?
- Is there maybe a common workform for this problem?

Thanks a million!

Greets Merijn

-- 
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: Using user data from another project

2011-02-25 Thread bruno desthuilliers
On 25 fév, 11:28, Benedict Verheyen 
wrote:
> Hi,
>
> i have 2 sites that use the standard Django authentication system.
> I use the first site, say site A, as the site to manage logon's.
> My point is to achieve that when a user is logged in on site A, he/she is 
> automatically logged in on site B.
>
> Now, when a user visits site B, he/she gets redirected to site A to get 
> authenticated (Active Directory)
> After I authenticate the user, i would want to use that User object in site B.
>
> Sending the session key of site A to site B doesn't work as the projects have 
> their own database.
> I then tried to put the user object on the cache (i use memcached) and 
> sending the cache key to site B.
> I can get the user object in site B but when i want to log in using the 
> standard
> login(request, user); i get this error message:
>
> django.core.exceptions.ImproperlyConfigured
> ImproperlyConfigured: Error importing authentication backend 
> siteA.auth.ldap_authenticate: "No module named siteA.auth.ldap_authenticate"

Won't work that way.

> I need to set the user object in site B to get the user info (I display the 
> username on every page amongst other data)
>
> Is that even possible?

Yeps, using multi-db support (to share the user tables) and a custom
auth backend (so your siteB delegates auth to SiteA) :

* http://docs.djangoproject.com/en/1.2/topics/db/multi-db/
* http://docs.djangoproject.com/en/1.2/topics/auth/#other-authentication-sources

HTH

-- 
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: mod_wsgi or mod_fcgi

2011-02-25 Thread km
yes nginx+uwsgi seems to be the best combination for django.
KM
On Fri, Feb 25, 2011 at 5:36 AM, Eugene MechanisM <
eugene.mechan...@gmail.com> wrote:

> > I used this for several months, and encountered all kinds of horrible
> memory
> > allocation problems, crashes, etc etc.
> it's can be posiible with any server software if this server is bad
> configured.
> I'll never use apache or cherokee or lighttpd, coz nginx faster and
> better.
>
> --
> 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.



combobox

2011-02-25 Thread Szabo, Patrick (LNG-VIE)
Hi, 

 


I was trying to get "An AJAX Select Widget for Django"
(http://code.djangoproject.com/wiki/AJAXWidgetComboBox ) running but i
found out that it doesn't work with newer versions of django (correct me
if I'm wrong.)


Is there an alternative or a way to make it work with the newest version
?!


 


Kind regards


. . . . . . . . . . . . . . . . . . . . . . . . . .
Patrick Szabo
 XSLT-Entwickler 
LexisNexis
Marxergasse 25, 1030 Wien

mailto:patrick.sz...@lexisnexis.at
Tel.: +43 (1) 534 52 - 1573 
Fax: +43 (1) 534 52 - 146 





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



Using user data from another project

2011-02-25 Thread Benedict Verheyen
Hi,

i have 2 sites that use the standard Django authentication system.
I use the first site, say site A, as the site to manage logon's.
My point is to achieve that when a user is logged in on site A, he/she is 
automatically logged in on site B.

Now, when a user visits site B, he/she gets redirected to site A to get 
authenticated (Active Directory)
After I authenticate the user, i would want to use that User object in site B.

Sending the session key of site A to site B doesn't work as the projects have 
their own database.
I then tried to put the user object on the cache (i use memcached) and sending 
the cache key to site B.
I can get the user object in site B but when i want to log in using the standard
login(request, user); i get this error message:

django.core.exceptions.ImproperlyConfigured
ImproperlyConfigured: Error importing authentication backend 
siteA.auth.ldap_authenticate: "No module named siteA.auth.ldap_authenticate"

I need to set the user object in site B to get the user info (I display the 
username on every page amongst other data)

Is that even possible?
Are there other (easy) ways to achieve cross site login?

Thanks,
Benedict

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



How to display that forms?

2011-02-25 Thread galago
I'm thinking how to display forms in that configuration:
I have 3 simple models:
class Province(models.Model):
name = models.CharField(max_length=30)
slug = models.SlugField(max_length=30, unique=True)

class UserProvince(models.Model):
user = models.ForeignKey(User)
province = models.ForeignKey(Province)

class UserCity(models.Model):
user = models.ForeignKey(User)
province = models.ForeignKey(Province)
city = models.CharField(max_length=10)
slug = models.SlugField(max_length=100, editable=False)


now, each user can have several provinces added. then, he can add several 
cities to his each added province.
province1
city1
city2
city3
province2
city4
city5
city6
province3
city7
city8
city9

I want to display all his provinces and under each of it, I want to display 
form with input to add city to it. What is the best way to do this? There's 
going to be unknown number of provinces.

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