Re: 'CSRF verification failed." from django.contrib.comments. can you help solve it? django 1.3

2012-07-16 Thread brycenesbitt
It works now that I have fully uninstalled pybbm.
Pybbm was incompatible with my app because it also extended the User
object (something apparently you can only do once?)

-- 
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: m2m through intermediate model: template friendly syntax not working. dj1.3

2012-07-16 Thread brycenesbitt

>
> Using 'for entry in category.ce_.all', as suggested elsewhere also fails 
>>   
>
>

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



Extend groups admin interface

2012-07-16 Thread yillkid
Hi all !

I want to extend my group admin interface, 
url is "/admin/auth/group/add/"

Now my interface have 2 fields
1.  name
2.  permissions

And now I want to add a country field.

In UserProfile extend I just follow this link and work very good:
http://jessenoller.com/2011/12/19/quick-example-of-extending-usercreationform-in-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/-/FWyXi6GV38AJ.
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: access the state of a Model object prior to it's modification ?

2012-07-16 Thread Jani Tiainen
Probably you want to do that logic a slightly differently on a model level
(so rule would apply always when you save your model).

So you would actually override model save method.

Probably rule is something like this:

class MyPublicationModel(Model):
def save(...):  # I don't remember the signature
if self.is_published and not self.publication_date:
# Published previously unpublished - set the date
self.publication_date = date.today()
   elif not self.is_published and self.publication_date:
# Mark already published as unpublished - clear the date
self.publication_date = None

   super(self, MyPublicationModel).save(...)

On Mon, Jul 16, 2012 at 3:39 AM, Nicolas Emiliani  wrote:

>
>
> On Sun, Jul 15, 2012 at 8:10 PM, Jani Tiainen  wrote:
>
>> Hi,
>>
>> How about telling us what are you trying to achieve by comparing to
>> previous state of the object?
>>
>>
> Well, the model has a boolean field called published, and a publish_date
> that gets set "automatically"
> when the user through the admin panel sets the flag published to true. He
> could also unpublish it, but the
> date would still remain the same (on the date it was first published). And
> here comes the problem :
>
> If the user decides to republish I would have to set the date to current
> date, but how do I know if he
> is republishing or he modified some other field that has nothing to do
> with that attribute ? I would be
> republishing only if it's previous state was not published. But how can I
> acces that previous state ?
>
> Sounds waky :P
>
>
>
>> On Sun, Jul 15, 2012 at 1:49 AM, Nicolas Emiliani wrote:
>>
>>> Hi,
>>>
>>> Is there a way to access the state of a Model object prior to it's
>>> modification through a form ?
>>> Kind of a nasty question :S, let me explain.
>>>
>>> The thing is that if i use the save_model hook and the user modifies the
>>> model through the form,
>>> the obj parameter that I receive has already all the modifications
>>> loaded, so if  I have, let's say,
>>> a boolean attribute called "published"  and the user clicked published
>>> then :
>>>
>>> obj.published == True
>>>
>>> Is there a way to know which was the state of the model, in this case
>>> the state of obj.published,
>>> before the user clicked on the save button on the admin form ? or should
>>> I use a second model
>>> attribute and hide it on the form to keep the previous state ? is there
>>> a "Django" way to do this ?
>>>
>>> It's my first post, be gentle :P
>>>
>>> Thanks !
>>>
>>> --
>>> Nicolas Emiliani
>>>
>>> Lo unico instantaneo en la vida es el cafe, y es bien feo.
>>>
>>> --
>>> 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.
>>>
>>
>>
>>
>> --
>> Jani Tiainen
>>
>> - Well planned is half done, and a half done has been sufficient before...
>>
>>  --
>> 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.
>>
>
>
>
> --
> Nicolas Emiliani
>
> Lo unico instantaneo en la vida es el cafe, y es bien feo.
>
> --
> 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.
>



-- 
Jani Tiainen

- Well planned is half done, and a half done has been sufficient before...

-- 
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: 'NoneType' object has no attribute 'datetime' bug?

2012-07-16 Thread dobrysmak
Thank's for help , i did this and now i've got this 

AttributeError at /wejdz-do-gry/76/
'NoneType' object has no attribute 'now'

This is strange because the shell import works fine but the server script 
throus an exception.

>>> from datetime import datetime, time, date
> >>> print datetime.now()
> 2012-07-14 14:14:17.897023
> >>> print datetime.combine(date.today(),time(19,30))
> 2012-07-14 19:30:00
> >>> 
>
Ok, that's true but the script does not even reach the 'combine' function 
it died on 'now'. 

 

W dniu sobota, 14 lipca 2012 19:15:56 UTC+2 użytkownik Guevara napisał:
>
> Try this:
>
> from datetime import datetime, time, date
>
> current_date = datetime.now()
>
> today = datetime.combine(date.today(), time(19,30))
>
> Look:
>
> >>> from datetime import datetime, time, date
> >>> print datetime.now()
> 2012-07-14 14:14:17.897023
> >>> print datetime.combine(date.today(),time(19,30))
> 2012-07-14 19:30:00
> >>> 
>
> o/
>
>
> 2012/7/14 dobrysmak 
>
>> Hi guys,
>> i have run into this.
>>
>> Traceback:
>> File 
>> "/usr/local/lib/python2.7/dist-packages/django/core/handlers/base.py" in 
>> get_response
>> 111. response = callback(request, *callback_args, **callback_kwargs)
>> File 
>> "/usr/local/lib/python2.7/dist-packages/django/contrib/auth/decorators.py" 
>> in _wrapped_view
>> 20. return view_func(request, *args, **kwargs)
>> File "/usr/local/lib/python2.7/dist-packages/django/utils/decorators.py" 
>> in _wrapped_view
>>  91. response = view_func(request, *args, **kwargs)
>> File "/home/user/dev/xyz/coupon/views.py" in enter_game
>> 69. Coupon(coupon=coupon, player=player, credicts=credicts).save()
>> File "/home/user/dev/xyz/coupon/models.py" in save
>> 253. self.coupon.close_coupon()
>> File "/home/user/dev/xyz/coupon/models.py" in close_coupon
>>  78. current_date = datetime.datetime.now()
>>
>> Exception Type: AttributeError at /wejdz-do-gry/49/
>> Exception Value: 'NoneType' object has no attribute 'datetime'
>> Request information:
>> GET: No GET data
>>
>> and the cuntion "close_coupon" looks like this
>>
>> class Coupon(models.Model): .
>> .
>>  . end_date = models.DateTimeField(default=None, null=True, blank=True) 
>> def close_coupon(self):
>> current_date = datetime.datetime.now() today = 
>> datetime.datetime.combine(datetime.date.today(), datetime.time(19,30))
>> .
>>   .
>> end_date = current_date
>>
>> Don't know if that's a bug. Does anyone know how to deal with this issue? 
>> Cheers!
>>
>> -- 
>> 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/-/iH-0-noK-zkJ.
>> 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/-/cqKjBDZ5XgEJ.
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 present a calculated field in a admin edit form.

2012-07-16 Thread Erlend Dalen
Hi,

I'm using Django 1.0 (beta_1) and have the following issue:
I have a method in a model that returns a calculated value and I would like 
this value to be displayed in the admin edit form related to that view.
I have no problem showing the field in the list_display, but if I add it to 
fields in the fields property in the ModelAdmin, I get an error message 
saying that there is no such key.

Is there an easy way of solving this?

/Erlend

-- 
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/-/YJPK19HiCYAJ.
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 Distance from User

2012-07-16 Thread tWoolie
Just use Lat/Lon. You can fidget over which projection to use later as long 
as your data is good. (WGS84 is the best btw)

For geolocation, you can use the HTML5 Geolocation API that will use the 
person's browser to give you a location usually accurate to 200m (better if 
they're on a phone with gps), more than enough given your search radius of 
200miles.

For distance lookups, go with a simple bounding box algorithm (bounded by 
map edges, distance calc by pythagoras). Again exact positioning is NOT 
ESSENTIAL for your use case, especially on the 25mi scale.

If you ever find yourself needing better/more accurate position 
calculation. use postgis, but never install from source, use your distro's 
packages (it Just Works tm). Should be called 'postgresql-9.1-postgis' on 
most distros. do a search. make sure you have libproj and libgeos installed 
as well.

-- 
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/-/Eqo7IdbDiDsJ.
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: 'NoneType' object has no attribute 'datetime' bug?

2012-07-16 Thread tWoolie
somehow, your global datetime variable is being clobbered with the value 
None. Find where that happens, and your bug will disappear.

-- 
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/-/scs2VRdTe4IJ.
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 present a calculated field in a admin edit form.

2012-07-16 Thread tWoolie
What would it mean to django to have a formfield for a method anyway?

You need to override the edit page template for that model. 
or
You need to supply a custom form for the edit page that takes care of 
inserting and removing the calculated data on __init__ and clean

-- 
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/-/ZYDwibhIWE8J.
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: Extend groups admin interface

2012-07-16 Thread yillkid
upload a screen shut

I want to extend it:
https://picasaweb.google.com/lh/photo/WF1hH23eRHse3IsmmERcDdMTjNZETYmyPJy0liipFm0?feat=directlink

yillkid於 2012年7月16日星期一UTC+8下午3時35分23秒寫道:
>
> Hi all !
>
> I want to extend my group admin interface, 
> url is "/admin/auth/group/add/"
>
> Now my interface have 2 fields
> 1.  name
> 2.  permissions
>
> And now I want to add a country field.
>
> In UserProfile extend I just follow this link and work very good:
>
> http://jessenoller.com/2011/12/19/quick-example-of-extending-usercreationform-in-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/-/O5qMNXXTl-IJ.
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.



Nested querysets or a smarter template?

2012-07-16 Thread Alex Strickland

Hi all

I am new to Django and a bit lost at sea. I want to use Bootstrap and 
their accordion control. I have these models:


class Research_Category_Group(models.Model):
name = models.CharField(max_length=40)
class Meta:
ordering = ["name"]

class Research_Category(models.Model):
name = models.CharField(max_length=40)
group = models.ForeignKey(Research_Category_Group)
class Meta:
ordering = ["group","name"]

I want to see something like this (if you can picture it via ascii-art):


Bonds
US
Europe

Equities
Japan
Germany


but I get:


Bonds
US

Europe

Equities
Japan

Germany


My view is:

def add_document(request):
category_list = Research_Category.objects.all()
	return render_to_response("research/add_document.html", 
{"category_list": category_list}, 
context_instance=RequestContext(request))		


The template is:
  

  {% for category in category_list %}
  {% ifchanged category.group %}
  
		data-parent="#category_accordion" href="#{{ category.group }}">

  {{ category.group }}

  
  
  {% endifchanged %}

		{{ category.name 
}}


  {% ifchanged category.group %}
  
  {% endifchanged %}
  {% endfor %}

  


So I figure I need to have a nested queryset - which I can't figure how 
to do. If I managed it I'm not sure I would know how to use it in the 
template.


Or, I need to be cleverer in the template, I am using {% ifchanged 
category.group %}, but that is not enough to group the things within 
each accordion heading, as I don't know how to "delay" that trailing 
 properly.


Anyone able to help?
--
Regards
Alex

--
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: Nested querysets or a smarter template?

2012-07-16 Thread Alex Strickland

On 2012/07/16 11:28 AM, Alex Strickland wrote:


I am new to Django and a bit lost at sea. I want to use Bootstrap and
their accordion control. I have these models:


Write a request for help, and then you'll work it out pretty soon after:

  
{% for group in group_list %}

  
		data-parent="#group_accordion" href="#{{ group.name }}">

  {{ group.name }}

  
	  


{% for user in group.user_set.all %}
		{{ user.first_name 
}} {{ user.last_name }}

{% endfor %}

  

{% endfor %}
  

Thanks and sorry for the noise.

--
Regards
Alex


--
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: Handling millions of rows + large bulk processing (now 700+ mil rows)

2012-07-16 Thread Cal Leeming [Simplicity Media Ltd]
Hi guys,

This has now been confirmed for the following date:

 - Thursday 9th August 2012 - 7:00 PM (UTC)

Webcast details will be sent 48 hours before.

Cheers

Cal

On Sun, Jul 1, 2012 at 4:09 PM, Cal Leeming [Simplicity Media Ltd] <
cal.leem...@simplicitymedialtd.co.uk> wrote:

> Wow - glad to see there's people interested in this!
>
> Here is the schedule, could everyone please select which days/times they
> are available (enter more than one if possible)
>
> http://www.doodle.com/8ptehyqr6uezhtsy
>
> I'll leave the schedule open until 14th July, whichever slot gets the most
> votes wins.
>
> Given our awful experiences with conferencing software, we'll probably be
> using livestream, and a backup stream from one of our own servers - both
> have a maximum capacity of 50 users at 720p.
>
> Cal
>
> On Sat, Jun 30, 2012 at 4:10 PM, Cal Leeming [Simplicity Media Ltd] <
> cal.leem...@simplicitymedialtd.co.uk> wrote:
>
>> Hi all,
>>
>> As some of you know, I did a live webcast last year (July 2011) on our
>> LLG project, which explained how we overcome some of the problems
>> associated with large data processing.
>>
>> After reviewing the video, I found that the sound quality was very
>> poor, the slides weren't very well structured, and some of the information
>> is now out of date (at the time it was 40mil rows, now we're dealing with
>> 700+mil rows).
>>
>> Therefore, I'm considering doing another live webcast (except this time
>> it'll be recorded+posted the next day, the stream will be available in
>> 1080p, it'll be far better structured, and will only last 50 minutes).
>>
>> The topics I'd like to cover are:
>>
>> * Bulk data processing where bulk_insert() is still not viable (we went
>> from 30 rows/sec to 8000 rows/sec on bulk data processing, whilst still
>> using the ORM - no raw sql here!!)
>> * Applying faux child/parent relationship when standard ORM is too
>> expensive (allows for ORM approach without the cost)
>> * Applying faux ORM read-only structure to legacy applications (allows
>> ORM usage on schemas that weren't properly designed, and cannot be changed
>> - for example, vendor software with no source code).
>> * New Relic is beautiful, but expensive. Hear more about our plans to
>> make an open source version.
>> * Appropriate use cases for IAAS vs colo with SSDs.
>> * Percona is amazing, some of the tips/tricks we've learned over.
>>
>> If you'd like to see this happen, please leave a reply in the thread - if
>> enough people want this, then we'll do public vote for the scheduled date.
>>
>> Cheers
>>
>> Cal
>>
>
>

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



Directory indexes are not allowed here. for Grappilli

2012-07-16 Thread chhots
 Page not found (404)  Request Method: GET  Request URL: 
http://localhost:8080/static/grappelli/  
 
Directory indexes are not allowed here.
 
You're seeing this error because you have DEBUG = True in your Django 
settings file. Change that to False, and Django will display a standard 404 
page. 

Plz help


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

2012-07-16 Thread Eugène Ngontang
Ok!

I think several times and solved the problem.

In fact I think the admin was waiting an address to build the http response
it self, not really a http response.

I remove the HttpResponse or HttpResponseRedirect method  from the return
statement, and it worked as I expected.

The wrong code line :
   *#return HttpResponseRedirect('10.136.37.19:8080%s/'
% reverse 'app.views.job_exec_user_error', args=(self.jobhistory_id,)))   *

The correct code line :
   #return (reverse('app.views.job_exec_user_error',
args=(self.jobhistory_id,)))

Now I'm dealing whith asyncronous communications.



2012/7/16 Eugène Ngontang 

> Hi!
>
> To complete my HttpResponseRedirect issue, here is a screenshot i have
> when clinking on the link.
>
> The browser does not know the page content type, and I don't see the to
> set the content type with HttpResponseRedirect method, cause it takes only
> one argument, which is the address to redirect to.
>
> Thank for advance for your answer.
>
> 2012/7/15 Eugène Ngontang 
>
>> Hi all!
>>
>> Hope you still remember this post which helps dive into django. I have
>> gone really ahead with my developments, and now i'm willing to make some
>> optimization and have some few issues. I don't know if I should open a new
>> thread for each one. You will tell me, but I prefered to do it here because
>> the initial thread was this one.
>>
>> - First I can't use the HttpResponseRedirect() method in my application,
>> it does not work like it should. In fact in my models module, I have a
>> JobHistory class and a member function in that class which returns a link
>> for the listdisplay of that model in the admin module.
>> But when the id i'm looking for in the database does not exist, i would
>> like to redirect the user to a custum error page. And to that I used
>> HttpResponseRedirect() wich is unable to return the right address to the
>> browser. I tried such things, read the documentation several times but
>> nothing. I thought it was the reverse function which does not locate the
>> page but no, because even with google address the browser receive a
>> response address with some headers concatanated, and the browser cannot
>> access the page, cause it has an invalid address:
>> the code line in the models module:
>> def get_executing_user_url(self):
>> user_list = SystemUser.objects.filter(systemuser_name =
>> self.job_executing_user, host = self.job.host)
>> if not user_list:
>>  return HttpResponseRedirect('
>> http://www.google.com/')
>>
>> #return HttpResponseRedirect('10.136.37.19:8080%s/'
>> % reverse('fancycron.views.job_exec_user_error',
>> args=(self.jobhistory_id,)))
>> else:
>> return '../systemuser/%s/' %
>> (user_list[0].systemuser_id)
>>
>> You can see I've even tried to hardput the server address, but it did not
>> work, and I even tested with google and it didn't work too. Tell me if I
>> missed something in the use of HttpResponseRedirect. The error is not a
>> django error, but the returned address is just not accessible each any time
>> i try.
>>
>> - The second issue is that I have implement my middleware (django) and
>> remote backend communication using django signals. It works, but as you can
>> expected, it's synchronous, and I would like now to do it asynchronously.
>> Is Celery the best option? If yes, could you please indicate me the
>> simplest and efficient way to set that up? Anyway, ho can I send messages
>> to my remote backend, without block in my browser rendering?
>>
>> Some good and working tutorials are welcome.
>>
>> Thank you a lot guys.
>> Eugène NG
>>
>>
>> 2012/5/20 Eugène Ngontang 
>>
>>> Yes you're right Marc!
>>>
>>> It's just that I wanted to mention the fact my application is not only a
>>> web site accessible via a web browser only, but a client-server application
>>> with web-based GUI.
>>>
>>> But now things are clear, we're all now ok with the problematic and with
>>> your help and great responses, i noticed it's better to do all my system
>>> communication based on HTTP.
>>>
>>> I thank you for all your attention, all new ideas are still well come,
>>> and i'll let you follow up the evelution of the development.
>>>
>>> Thanks guys.
>>>
>>>
>>>
>>>
>>> 2012/5/20 Marc Aymerich 
>>>
 On Sat, May 19, 2012 at 8:01 PM, Eugène Ngontang 
 wrote:
 > Hi Jani.
 > I don't know why you say
 >
 > " 3) Are you now trying to figure out how to plug in Django in "Adming
 > module/PC with GUI block"?"
 >
 > My admin module and the gui do not share anything. They are not on
 the same
 > pc.
 > Gui is for displaying and admin for the page content management like
 any web
 > aplication works.
 >
 > I please us unot to build a myster arround this thread. The problem
 was
 > simple:


 HI Eugène,
 the problem wa

Excluding items from a queryset

2012-07-16 Thread Sithembewena Lloyd Dube
Hi everyone,

I have a queryset of categories and would like to exclude categories with
no items associated. I am cycling through the queryset as follows, without
the desired result:

for cat in categories:
if cat.item_set.count() == 0:
categories.exclude(pk=cat.pk)

How can I remove those categories (please note, I do not intend to delete
them)?

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



Built-in filter "linebreaks" does not do what it says in the documentation

2012-07-16 Thread Daniel Klein
So the bog-standard built-in filter linebreaks is supposed to do the 
following:

"Replaces line breaks in plain text with appropriate HTML"

The doc string is:

 """Converts newlines into  and s."""

However, it doesn't do this at all. It neither replaces nor converts; 
instead it leaves linebreaks in place and ADDS html tags:

return u'\n\n'.join(paras)

I could write my own filter that simply returns join(paras), but there's 
got to be a better way, no? And shouldn't we try to make the documentation 
talk about what is actually happening?

-- 
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/-/Jzn_DeRxWGUJ.
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: access the state of a Model object prior to it's modification ?

2012-07-16 Thread Nicolas Emiliani
Jani, thanks for the idea, some thoughts below your code.


>
> class MyPublicationModel(Model):
> def save(...):  # I don't remember the signature
> if self.is_published and not self.publication_date:
> # Published previously unpublished - set the date
> self.publication_date = date.today()
>elif not self.is_published and self.publication_date:
> # Mark already published as unpublished - clear the date
> self.publication_date = None
>
>super(self, MyPublicationModel).save(...)
>
>
Yes, you are right, but you are clearing the date, the thing
is that I don't want to clear it. That's why I thought of having
an attribute in the model that does not render in the form,
that would allow me to keep the previous state unchanged
and use that in my logic.


> On Mon, Jul 16, 2012 at 3:39 AM, Nicolas Emiliani wrote:
>
>>
>>
>> On Sun, Jul 15, 2012 at 8:10 PM, Jani Tiainen  wrote:
>>
>>> Hi,
>>>
>>> How about telling us what are you trying to achieve by comparing to
>>> previous state of the object?
>>>
>>>
>> Well, the model has a boolean field called published, and a publish_date
>> that gets set "automatically"
>> when the user through the admin panel sets the flag published to true. He
>> could also unpublish it, but the
>> date would still remain the same (on the date it was first published).
>> And here comes the problem :
>>
>> If the user decides to republish I would have to set the date to current
>> date, but how do I know if he
>> is republishing or he modified some other field that has nothing to do
>> with that attribute ? I would be
>> republishing only if it's previous state was not published. But how can I
>> acces that previous state ?
>>
>> Sounds waky :P
>>
>>
>>
>>> On Sun, Jul 15, 2012 at 1:49 AM, Nicolas Emiliani wrote:
>>>
 Hi,

 Is there a way to access the state of a Model object prior to it's
 modification through a form ?
 Kind of a nasty question :S, let me explain.

 The thing is that if i use the save_model hook and the user modifies
 the model through the form,
 the obj parameter that I receive has already all the modifications
 loaded, so if  I have, let's say,
 a boolean attribute called "published"  and the user clicked published
 then :

 obj.published == True

 Is there a way to know which was the state of the model, in this case
 the state of obj.published,
 before the user clicked on the save button on the admin form ? or
 should I use a second model
 attribute and hide it on the form to keep the previous state ? is there
 a "Django" way to do this ?

 It's my first post, be gentle :P

 Thanks !

 --
 Nicolas Emiliani

 Lo unico instantaneo en la vida es el cafe, y es bien feo.

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

>>>
>>>
>>>
>>> --
>>> Jani Tiainen
>>>
>>> - Well planned is half done, and a half done has been sufficient
>>> before...
>>>
>>>  --
>>> 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.
>>>
>>
>>
>>
>> --
>> Nicolas Emiliani
>>
>> Lo unico instantaneo en la vida es el cafe, y es bien feo.
>>
>> --
>> 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.
>>
>
>
>
> --
> Jani Tiainen
>
> - Well planned is half done, and a half done has been sufficient before...
>
>  --
> 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.
>



-- 
Nicolas Emiliani

Lo unico instantaneo en la vida es el cafe, y es bien feo.

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

Re: Why am I getting an error when send e-mail from hosting?

2012-07-16 Thread Nicolas Emiliani
On Mon, Jul 16, 2012 at 4:05 AM, Andrejus wrote:

> I've got a Django instance (1.4, python 2.7.2) running via FastCGI on
> vds-hosting.
> The problem is:
>
> (mypython)-bash-4.1$ python manage.py shell
> Python 2.7.2 (default, Dec  8 2011, 12:06:29)
> [GCC 4.4.4 20100726 (Red Hat 4.4.4-13)] on linux2
> Type "help", "copyright", "credits" or "license" for more information.
> (InteractiveConsole)
> >>> import django
> >>> from django.core.mail import EmailMessage
> >>> email = EmailMessage('Hello', 'World', to=['bla-...@bla-bla.ru'])
> >>> email.send()
> Traceback (most recent call last):
>   File "", line 1, in 
>   File "/home/vhosts/
> e-pyfan.com/private/mypython/lib/python2.7/site-packages/Django-1.4-py2.7.egg/django/core/mail/message.py",
> line 248, in send
> return self.get_connection(fail_silently).send_messages([self])
>   File "/home/vhosts/
> e-pyfan.com/private/mypython/lib/python2.7/site-packages/Django-1.4-py2.7.egg/django/core/mail/backends/smtp.py",
> line 92, in send_messages
> sent = self._send(message)
>   File "/home/vhosts/
> e-pyfan.com/private/mypython/lib/python2.7/site-packages/Django-1.4-py2.7.egg/django/core/mail/backends/smtp.py",
> line 110, in _send
> email_message.message().as_string())
>   File "/opt/python27/lib/python2.7/smtplib.py", line 728, in sendmail
> raise SMTPDataError(code, resp)
> SMTPDataError: (554, 'mail server permanently rejected message (#5.3.0)')
>

I would check a few things, first :

What smtp server are you using ?
Did you configured your django app to use the SMTP server?, I think you
need to add some SMTP_ vars to your settings.py,
because otherwise you will end up using sendmail (if it's linux) and it
might be shutoff for security reasons.

If you have an SMTP server in your hosting access it using TELNET and try
to send an email through the CLI interface
to check that it works correctly.

Hope it helps.



>
> When I tested e-mail sending on my PC with locally installed mail server I
> didn't have any problem, mailing worked well.
> Please anybody help.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/django-users/-/pI8qXk50AaEJ.
> 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.
>



-- 
Nicolas Emiliani

Lo unico instantaneo en la vida es el cafe, y es bien feo.

-- 
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 and django-admin-tools

2012-07-16 Thread Tomas Neme
Yes, you'll need to get your hands dirty, and merge the two admin
templates, since both apps redefine templates/admin/index.html and
some other templates.

The best approach, I think, is just use django-admin-tools' templates
and create custom dashboard/modules to duplicate satchmo's templates'
behavior

On Sun, Jul 15, 2012 at 7:12 PM, אברהם סרור  wrote:
> Hi,
>
> I'm trying to use django admin tools with satchmo, I installed satchmo in my
> dev machine and made a store with clonesatchmo.py
> after that the store seemed to be running fine, so I installed
> django-admin-tools using the instructions on their website
>
> but I didn't manage to make it work, I spent about a week googling, I think
> I must be doing some obvious mistake
>
> anyone had success using both together? where can I see an example
> settings.py?
>
> Also I have in mind grappelli, can the three work together?
>
> any help is appreciated
> thanks
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/django-users/-/PyVTP5tNkqMJ.
> 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 whole of Japan is pure invention. There is no such country, there
are no such people" --Oscar Wilde

|_|0|_|
|_|_|0|
|0|0|0|

(\__/)
(='.'=)This is Bunny. Copy and paste bunny
(")_(") to help him gain world domination.

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



Re: Why am I getting an error when send e-mail from hosting?

2012-07-16 Thread Andrejus
Nicolas, thanks for help.

I'm glad and proud to state I've discovered the cause of the problem myself 
- the problem was SMTP (or maybe the recipient's side) on hosting has been 
configured to reject any message without sender's address. Using send_mail 
with specifying sender explicitly solved my problem. 

понедельник, 16 июля 2012 г., 16:39:52 UTC+4 пользователь Nicolas Emiliani 
написал:
>
>
>
> On Mon, Jul 16, 2012 at 4:05 AM, Andrejus wrote:
>
>> I've got a Django instance (1.4, python 2.7.2) running via FastCGI on 
>> vds-hosting.
>> The problem is:
>>
>> (mypython)-bash-4.1$ python manage.py shell
>> Python 2.7.2 (default, Dec  8 2011, 12:06:29)
>> [GCC 4.4.4 20100726 (Red Hat 4.4.4-13)] on linux2
>> Type "help", "copyright", "credits" or "license" for more information.
>> (InteractiveConsole)
>> >>> import django
>> >>> from django.core.mail import EmailMessage
>> >>> email = EmailMessage('Hello', 'World', to=['bla-...@bla-bla.ru'])
>> >>> email.send()
>> Traceback (most recent call last):
>>   File "", line 1, in 
>>   File "/home/vhosts/
>> e-pyfan.com/private/mypython/lib/python2.7/site-packages/Django-1.4-py2.7.egg/django/core/mail/message.py",
>>  
>> line 248, in send
>> return self.get_connection(fail_silently).send_messages([self])
>>   File "/home/vhosts/
>> e-pyfan.com/private/mypython/lib/python2.7/site-packages/Django-1.4-py2.7.egg/django/core/mail/backends/smtp.py",
>>  
>> line 92, in send_messages
>> sent = self._send(message)
>>   File "/home/vhosts/
>> e-pyfan.com/private/mypython/lib/python2.7/site-packages/Django-1.4-py2.7.egg/django/core/mail/backends/smtp.py",
>>  
>> line 110, in _send
>> email_message.message().as_string())
>>   File "/opt/python27/lib/python2.7/smtplib.py", line 728, in sendmail
>> raise SMTPDataError(code, resp)
>> SMTPDataError: (554, 'mail server permanently rejected message (#5.3.0)')
>>
>
> I would check a few things, first :
>
> What smtp server are you using ?
> Did you configured your django app to use the SMTP server?, I think you 
> need to add some SMTP_ vars to your settings.py,
> because otherwise you will end up using sendmail (if it's linux) and it 
> might be shutoff for security reasons.
>
> If you have an SMTP server in your hosting access it using TELNET and try 
> to send an email through the CLI interface
> to check that it works correctly.
>
> Hope it helps.
>
>  
>
>>
>> When I tested e-mail sending on my PC with locally installed mail server 
>> I didn't have any problem, mailing worked well.
>> Please anybody help.
>>
>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "Django users" group.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msg/django-users/-/pI8qXk50AaEJ.
>> 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.
>>
>
>
>
> -- 
> Nicolas Emiliani
>
> Lo unico instantaneo en la vida es el cafe, y es bien feo.
>

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



Progress monitoring using Django model is not syncronized (One writer and multiple readers)

2012-07-16 Thread Wei An


I am implementing a progress monitoring function using Django. However, I 
cannot get the updated value in the front end.

A Django management command is executed by popen to keep updating the 
progress of the model webscan. Scan is a Django model and progress_info is 
an attribute of the model which is saved in database. The code is as 
follows:

d = 10
while (d) :
time.sleep(10)
try:
isBusy = server.call("framework.busy?")
logging.debug(isBusy)
if isBusy.strip() == 'true':
progress = webscan.progress
webscan.progress_info = progress
webscan.save()
logging.debug("%s"%progress)
else:
d = 0
except Exception as e:
logging.debug("In an exception when calling busy. 
Exception: %s and Type %s"%(e, type(e)))
d -= 1

In the front-end, I make an ajax call to get the value of progress_info. 
The handler simply get the value of webscan.progress_infoand returns it to 
the front-end. The code is as follows:

@property
def get_progress(self):
return self.progress_info

Using the GUI of the DB, I can see that the value of progress_info is kept 
updated. However, the ajax call keeps returning 0 to the front-end until 
the command finishes (0 is the initial value ofprogress_info).

I guess it is because of the locking mechanism of DB or Django but do not 
fully understand why. Could anyone help me with it? Thanks a lot~

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



Re: Why am I getting an error when send e-mail from hosting?

2012-07-16 Thread Sergiy Khohlov
 good  question contains  answer:

SMTPDataError: (554, 'mail server permanently rejected message (#5.3.0)')

 your SMTP reject  your message

 thanks
Serge

2012/7/16 Andrejus :
> Nicolas, thanks for help.
>
> I'm glad and proud to state I've discovered the cause of the problem myself
> - the problem was SMTP (or maybe the recipient's side) on hosting has been
> configured to reject any message without sender's address. Using send_mail
> with specifying sender explicitly solved my problem.
>
> понедельник, 16 июля 2012 г., 16:39:52 UTC+4 пользователь Nicolas Emiliani
> написал:
>>
>>
>>
>> On Mon, Jul 16, 2012 at 4:05 AM, Andrejus 
>> wrote:
>>>
>>> I've got a Django instance (1.4, python 2.7.2) running via FastCGI on
>>> vds-hosting.
>>> The problem is:
>>>
>>> (mypython)-bash-4.1$ python manage.py shell
>>> Python 2.7.2 (default, Dec  8 2011, 12:06:29)
>>> [GCC 4.4.4 20100726 (Red Hat 4.4.4-13)] on linux2
>>> Type "help", "copyright", "credits" or "license" for more information.
>>> (InteractiveConsole)
>>> >>> import django
>>> >>> from django.core.mail import EmailMessage
>>> >>> email = EmailMessage('Hello', 'World', to=['bla-...@bla-bla.ru'])
>>> >>> email.send()
>>> Traceback (most recent call last):
>>>   File "", line 1, in 
>>>   File
>>> "/home/vhosts/e-pyfan.com/private/mypython/lib/python2.7/site-packages/Django-1.4-py2.7.egg/django/core/mail/message.py",
>>> line 248, in send
>>> return self.get_connection(fail_silently).send_messages([self])
>>>   File
>>> "/home/vhosts/e-pyfan.com/private/mypython/lib/python2.7/site-packages/Django-1.4-py2.7.egg/django/core/mail/backends/smtp.py",
>>> line 92, in send_messages
>>> sent = self._send(message)
>>>   File
>>> "/home/vhosts/e-pyfan.com/private/mypython/lib/python2.7/site-packages/Django-1.4-py2.7.egg/django/core/mail/backends/smtp.py",
>>> line 110, in _send
>>> email_message.message().as_string())
>>>   File "/opt/python27/lib/python2.7/smtplib.py", line 728, in sendmail
>>> raise SMTPDataError(code, resp)
>>> SMTPDataError: (554, 'mail server permanently rejected message (#5.3.0)')
>>
>>
>> I would check a few things, first :
>>
>> What smtp server are you using ?
>> Did you configured your django app to use the SMTP server?, I think you
>> need to add some SMTP_ vars to your settings.py,
>> because otherwise you will end up using sendmail (if it's linux) and it
>> might be shutoff for security reasons.
>>
>> If you have an SMTP server in your hosting access it using TELNET and try
>> to send an email through the CLI interface
>> to check that it works correctly.
>>
>> Hope it helps.
>>
>>
>>>
>>>
>>> When I tested e-mail sending on my PC with locally installed mail server
>>> I didn't have any problem, mailing worked well.
>>> Please anybody help.
>>>
>>> --
>>> You received this message because you are subscribed to the Google Groups
>>> "Django users" group.
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msg/django-users/-/pI8qXk50AaEJ.
>>> 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.
>>
>>
>>
>>
>> --
>> Nicolas Emiliani
>>
>> Lo unico instantaneo en la vida es el cafe, y es bien feo.
>
> --
> 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/-/ivb5Ws9yLqgJ.
>
> 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.



Directory indexes are not allowed here. for Grappilli

2012-07-16 Thread Brent
Did you try changing your settings.py file from DEBUG=True to DEBUG=False?

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



Is Tutorial / Part 4 wrong? (or is it me?)

2012-07-16 Thread Bill Torcaso

Django is great, and the tutorial is great.  I'm having a problem at the 
very end of tutorial-4.

I try to use generic views, and I get an error when I Redirect from the 
POST request in vote() to the Results page.  Details below.

The tutorial code says to put this in my urls.py:

url(r'^(?P\d+)/results/$',
DetailView.as_view(
model=Poll,
template_name='polls/results.html')
,name="poll_results" 
),

And this in my views.py:

 from django.shortcuts import get_object_or_404, render_to_response
from django.http import HttpResponseRedirect, HttpResponse
from django.core.urlresolvers import reverse
from django.template import RequestContext
from polls.models import Choice, Poll


def vote(request, poll_id):
p = get_object_or_404(Poll, pk=poll_id)
try:
selected_choice = p.choice_set.get(pk=request.POST['choice'])
except (KeyError, Choice.DoesNotExist):
# Redisplay the poll voting form.
return render_to_response('polls/detail.html', {
'poll': p,
'error_message': "You didn't select a choice.",
}, context_instance=RequestContext(request))
else:   
selected_choice.votes += 1
selected_choice.save()
# Always return an HttpResponseRedirect after successfully dealing
# with POST data. This prevents data from being posted twice if a
# user hits the Back button.

 

return HttpResponseRedirect(reverse('polls_results', args=(p.id,)))
### OKAY:return HttpResponseRedirect("/polls/%i/results" % p.id)
### OKAY:return render_to_response("polls/results.html", 
{"poll": p})
### BAD:   return 
HttpResponseRedirect(reverse('polls.views.results', args=(p.id,)))



NoReverseMatch at /polls/4/vote/

Reverse for 'polls_results' with arguments '(4,)' and keyword arguments 
'{}' not found.
  
*Request Method:*
 
POST
  
*Request URL:*
 
http://127.0.0.1:8000/polls/4/vote/
  
*Django Version:*
 
1.4
  
*Exception Type:*
 
NoReverseMatch
  
*Exception Value:*
 
Reverse for 'polls_results' with arguments '(4,)' and keyword arguments 
'{}' not found.
  
*Exception Location:*
 
/Library/Python/2.7/site-packages/django/core/urlresolvers.py in 
_reverse_with_prefix, line 407
  
*Python Executable:*
 
/usr/bin/python
  
*Python Version:*
 
2.7.1
  
*Python Path:*
 
['/Users/s3/Desktop/CODE/APPSS3/EdAssistant/experiments/djtest',

 
'/Library/Python/2.7/site-packages/mercurial-2.0.2-py2.7-macosx-10.7-intel.egg',

 '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python27.zip',

 '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7',

 
'/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-darwin',

 
'/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac',

 
'/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac/lib-scriptpackages',

 '/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python',

 
'/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-tk',

 
'/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-old',

 
'/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload',

 
'/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/PyObjC',

 '/Library/Python/2.7/site-packages']
  
*Server time:*
 
Mon, 16 Jul 2012 11:53:21 -0500
  

-- 
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/-/f-sjN1OtNuwJ.
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: values() and order_by()

2012-07-16 Thread dmik
https://code.djangoproject.com/ticket/17144 has patch fixing this problem

On Tuesday, July 3, 2012 2:51:17 PM UTC+4, jjmaestro wrote:
>
> Hi there! 
>
> I have the following model: 
>
>   class Visit(models.Model): 
>   user = models.ForeignKey(User) 
>   visitor = models.ForeignKey(User, related_name="visitor") 
>   last_visit = models.DateTimeField(default=timezone.now()) 
>   count_visits = models.IntegerField(default=0) 
>
> I would like to make the following SQL query using the Django ORM: 
>
>   SELECT last_visit, SUM(count_visits) AS total_count_visits 
>   FROM core_visit 
>   WHERE user_id=42 
>   GROUP BY user_id 
>   ORDER BY last_visit DESC 
>
> So far, I haven't been able to do it. When I use values('user') and 
> order_by('-last_visit') the last_visit column is automatically added 
> to the GROUP BY clause. I've read in the Django doc that this is how 
> it's supposed to be but I can't seem to understand it. Why do I have 
> to group the results by whatever I choose as order? What am I missing? 
>
> Also, I know I can do a RawQuerySet but unfortunately, I would like to 
> be able to use a full QuerySet (this query goes into Tastypie and so 
> far, I haven't been successful in using it with anything but full 
> QuerySets, not even ValueQuerySets...) 
>
> All help and ideas would be greatly appreciated. 
>
> Thanks a lot in advanced, 
>
> -- 
> J. Javier Maestro  
>

-- 
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/-/hjN-fd4PGngJ.
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: Is Tutorial / Part 4 wrong? (or is it me?)

2012-07-16 Thread Tomas Neme
It's the second time this issue appears in the list in two weeks, maybe
it's time to recheck the tutorial?

There's no "polls" in your results' url, doesn't the tutorial say you
should have two urls file? one in project/urls.py and another one in
polls/urls.py ?

the polls-specific urls shouldn't start with "^polls/" and be in
polls/urls.py, and in project/urls.py there should be a line with

url(r'^polls/', include('polls.urls')),

On Mon, Jul 16, 2012 at 1:59 PM, Bill Torcaso  wrote:

>
> Django is great, and the tutorial is great.  I'm having a problem at the
> very end of tutorial-4.
>
> I try to use generic views, and I get an error when I Redirect from the
> POST request in vote() to the Results page.  Details below.
>
> The tutorial code says to put this in my urls.py:
>
> url(r'^(?P\d+)/results/$',
> DetailView.as_view(
> model=Poll,
> template_name='polls/results.html')
> ,name="poll_results"
> ),
>
> And this in my views.py:
>
>  from django.shortcuts import get_object_or_404, render_to_response
> from django.http import HttpResponseRedirect, HttpResponse
> from django.core.urlresolvers import reverse
> from django.template import RequestContext
> from polls.models import Choice, Poll
>
>
> def vote(request, poll_id):
> p = get_object_or_404(Poll, pk=poll_id)
> try:
> selected_choice = p.choice_set.get(pk=request.POST['choice'])
> except (KeyError, Choice.DoesNotExist):
> # Redisplay the poll voting form.
> return render_to_response('polls/detail.html', {
> 'poll': p,
> 'error_message': "You didn't select a choice.",
> }, context_instance=RequestContext(request))
> else:
> selected_choice.votes += 1
> selected_choice.save()
> # Always return an HttpResponseRedirect after successfully dealing
> # with POST data. This prevents data from being posted twice if a
> # user hits the Back button.
>
>
>
> return HttpResponseRedirect(reverse('polls_results', args=(p.id
> ,)))
> ### OKAY:return HttpResponseRedirect("/polls/%i/results" %
> p.id)
> ### OKAY:return render_to_response("polls/results.html",
> {"poll": p})
> ### BAD:   return
> HttpResponseRedirect(reverse('polls.views.results', args=(p.id,)))
>
>
>
> NoReverseMatch at /polls/4/vote/
>
> Reverse for 'polls_results' with arguments '(4,)' and keyword arguments
> '{}' not found.
>
> *Request Method:*
>
> POST
>
> *Request URL:*
>
> http://127.0.0.1:8000/polls/4/vote/
>
> *Django Version:*
>
> 1.4
>
> *Exception Type:*
>
> NoReverseMatch
>
> *Exception Value:*
>
> Reverse for 'polls_results' with arguments '(4,)' and keyword arguments
> '{}' not found.
>
> *Exception Location:*
>
> /Library/Python/2.7/site-packages/django/core/urlresolvers.py in
> _reverse_with_prefix, line 407
>
> *Python Executable:*
>
> /usr/bin/python
>
> *Python Version:*
>
> 2.7.1
>
> *Python Path:*
>
> ['/Users/s3/Desktop/CODE/APPSS3/EdAssistant/experiments/djtest',
>
>
>  
> '/Library/Python/2.7/site-packages/mercurial-2.0.2-py2.7-macosx-10.7-intel.egg',
>
>
>  '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python27.zip',
>
>  '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7',
>
>
>  
> '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-darwin',
>
>
>  
> '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac',
>
>
>  
> '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac/lib-scriptpackages',
>
>
>  '/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python',
>
>
>  
> '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-tk',
>
>
>  
> '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-old',
>
>
>  
> '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload',
>
>
>  
> '/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/PyObjC',
>
>  '/Library/Python/2.7/site-packages']
>
> *Server time:*
>
> Mon, 16 Jul 2012 11:53:21 -0500
>
>  --
> 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/-/f-sjN1OtNuwJ.
> 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 whole of Japan is pure invention. There is no such country, there are
no such people" --Oscar Wilde

|_|0|_|
|_|_|0|
|0|0|0|

(\__/)
(='.'=)This is Bunny. Copy and paste bunny
(")_(") to help him gain world domination.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, s

Re: Directory indexes are not allowed here. for Grappilli

2012-07-16 Thread Thomas Orozco
What is your actual problem here?

Do you not understand the message? Do you have a reason for which you'd
want this directory indexed?
Le 16 juil. 2012 13:24, "chhots"  a écrit :

> Page not found (404)  Request Method: GET  Request URL:
> http://localhost:8080/static/grappelli/
>
> Directory indexes are not allowed here.
>
> You're seeing this error because you have DEBUG = True in your Django
> settings file. Change that to False, and Django will display a standard
> 404 page.
>
> Plz help
>
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/django-users/-/Osk9n9mFErAJ.
> 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: satchmo and django-admin-tools

2012-07-16 Thread Avraham Serour
I thought they extended the templates instead of trying to replace
everything

do you know which templates would I have to redefine? everything I find in
both?

On Mon, Jul 16, 2012 at 6:09 PM, Tomas Neme  wrote:

> Yes, you'll need to get your hands dirty, and merge the two admin
> templates, since both apps redefine templates/admin/index.html and
> some other templates.
>
> The best approach, I think, is just use django-admin-tools' templates
> and create custom dashboard/modules to duplicate satchmo's templates'
> behavior
>
> On Sun, Jul 15, 2012 at 7:12 PM, אברהם סרור  wrote:
> > Hi,
> >
> > I'm trying to use django admin tools with satchmo, I installed satchmo
> in my
> > dev machine and made a store with clonesatchmo.py
> > after that the store seemed to be running fine, so I installed
> > django-admin-tools using the instructions on their website
> >
> > but I didn't manage to make it work, I spent about a week googling, I
> think
> > I must be doing some obvious mistake
> >
> > anyone had success using both together? where can I see an example
> > settings.py?
> >
> > Also I have in mind grappelli, can the three work together?
> >
> > any help is appreciated
> > thanks
> >
> > --
> > You received this message because you are subscribed to the Google Groups
> > "Django users" group.
> > To view this discussion on the web visit
> > https://groups.google.com/d/msg/django-users/-/PyVTP5tNkqMJ.
> > 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 whole of Japan is pure invention. There is no such country, there
> are no such people" --Oscar Wilde
>
> |_|0|_|
> |_|_|0|
> |0|0|0|
>
> (\__/)
> (='.'=)This is Bunny. Copy and paste bunny
> (")_(") to help him gain world domination.
>
> --
> 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: Excluding items from a queryset

2012-07-16 Thread Avraham Serour
isn't it possible to define this in the query? to return only non empty
categories? or return categories where it has more than 1 member?

On Mon, Jul 16, 2012 at 2:38 PM, Sithembewena Lloyd Dube
wrote:

> Hi everyone,
>
> I have a queryset of categories and would like to exclude categories with
> no items associated. I am cycling through the queryset as follows, without
> the desired result:
>
> for cat in categories:
> if cat.item_set.count() == 0:
> categories.exclude(pk=cat.pk)
>
> How can I remove those categories (please note, I do not intend to delete
> them)?
>
> Thanks.
> --
> 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.



Handling millions of rows + large bulk processing (now 700+ mil rows)

2012-07-16 Thread Fadi Samara
Interested.

-- 
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/-/RWAeYm45nIEJ.
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: m2m through intermediate model: template friendly syntax not working. dj1.3

2012-07-16 Thread brycenesbitt
I'm still stuck on this.  Is there any tutorial example that shows access 
m2m intermediate model data from a template.  The issue is the template 
library won't accept parameters.  Do I have to write a custom tag to get 
the m2m intermediate data fields?

-- 
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/-/xY_5d2gz3l8J.
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: m2m through intermediate model: template friendly syntax not working. dj1.3

2012-07-16 Thread Ramiro Morales
On Mon, Jul 16, 2012 at 4:10 PM, brycenesbitt
 wrote:
> I'm still stuck on this.  Is there any tutorial example that shows access
> m2m intermediate model data from a template.  The issue is the template
> library won't accept parameters.  Do I have to write a custom tag to get the
> m2m intermediate data fields?

The problem you've found isn't related to access to the relationship model
from template but that you aren't using the right names to access them.

Reading
https://docs.djangoproject.com/en/1.4/ref/models/fields/#manytomanyfield
and
https://docs.djangoproject.com/en/1.4/topics/db/models/#intermediary-manytomany
will be of great help.

-- 
Ramiro Morales

-- 
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 and django-admin-tools

2012-07-16 Thread Tomas Neme
> I thought they extended the templates instead of trying to replace
> everything

they don't replace everything. But the admin site's index template is
called 'admin/index.html', so it's not easy to extend them. They DO
extend admin/base.html.


This is my dashboard.py file, where I create a module that emulates
satchmo's template additions.

https://gist.github.com/3124534

There's a couple of things that are MY PREFERENCES, so it might not
all be to your liking, please do try to read, understand, and modify
as you like.

with this, I just use dashboards' admin/index.html template

-- 
"The whole of Japan is pure invention. There is no such country, there
are no such people" --Oscar Wilde

|_|0|_|
|_|_|0|
|0|0|0|

(\__/)
(='.'=)This is Bunny. Copy and paste bunny
(")_(") to help him gain world domination.

-- 
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 Unit Tests Missing Database Columns

2012-07-16 Thread Simon


I created a unit test on Django to create a user account and send a 
verification e-mail. The user is created, but the e-mail fails to send. The 
e-mail's default contents are supposed to be created as a field in the user 
when a user is created, but for some reason, Django is claiming -

DatabaseError: no such column: app_userprofile.default_email_header

It works fine when the account is created manually, though for some reason 
it fails to create that column in the database when done from a unit test. 
Any suggestions for fixing this?

-- 
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/-/qKW3y9F4OiEJ.
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 in MovablePython

2012-07-16 Thread Michael Palumbo
Hi,

I have been recently concerned about getting a portable Django development 
environment as well. I wanted it to work on any computers without 
installing anything.
I could get it to work, I can now carry my environment and projects on a 
USB stick. :)
I assume it is a bit late for your case now but maybe it will help someone 
else.
I made a tutorial on my blog:
http://webdevon.com/setting-up-a-django-development-environment-from-scratch-on-windows/
 

Feel free to leave comment and/or send me your feedback to improve my 
"homemade" solution.
Also, updating the wiki might be nice for next people looking for it? What 
do you think?

Michael


Le vendredi 2 janvier 2009 17:57:55 UTC+1, Taser a écrit :
>
> I've installed Django using the instructions found on 
> http://code.djangoproject.com/wiki/MovablePythonInstall on a USB drive 
> and following the Django on-site tutorial. I'm getting the following 
> error when trying to do 'python manage.py syncdb'. 
>
> - - - - START error message 
> Traceback (most recent call last): 
>   File "main.py", line 1048, in  
>   File "manage.py", line 11, in  
>   File "H:\Programming\MovablePython-MegaPack\mega-pack\interpreters 
> \movpy-2.5\l 
> ib\django\core\management\__init__.py", line 340, in execute_manager 
>   File "H:\Programming\MovablePython-MegaPack\mega-pack\interpreters 
> \movpy-2.5\l 
> ib\django\core\management\__init__.py", line 295, in execute 
>   File "H:\Programming\MovablePython-MegaPack\mega-pack\interpreters 
> \movpy-2.5\l 
> ib\django\core\management\base.py", line 192, in run_from_argv 
>   File "H:\Programming\MovablePython-MegaPack\mega-pack\interpreters 
> \movpy-2.5\l 
> ib\django\core\management\base.py", line 210, in execute 
>   File "H:\Programming\MovablePython-MegaPack\mega-pack\interpreters 
> \movpy-2.5\l 
> ib\django\utils\translation\__init__.py", line 73, in activate 
>   File "H:\Programming\MovablePython-MegaPack\mega-pack\interpreters 
> \movpy-2.5\l 
> ib\django\utils\translation\__init__.py", line 36, in delayed_loader 
> IndexError: list index out of range 
> Python 2.5 (r25:51908, Sep 19 2006, 09:52:17) [MSC v.1310 32 bit 
> (Intel)] on win 
> 32 
> Type "help", "copyright", "credits" or "license" for more information. 
> (InteractiveConsole) 
> >>> 
> - - - - END error Message 
>
> The only changes made from the default settings.py were: 
>
> DATABASE_ENGINE = 'sqlite3' 
> DATABASE_NAME = 'H:/Programming/MovablePython-MegaPack/mega-pack/ 
> interpreters/movpy-2.5/mytestsite/mytestsitedb.db' 
>
> Does anyone have any pointers as to how I can fix this? 
>
> Tony R. 
> aka Taser 
>

-- 
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/-/HUewXJA0l54J.
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 and django-admin-tools

2012-07-16 Thread Avraham Serour
thanks for sharing, I'll try to understand it.

where should I put this file? inside localsite?

what admin template are you talking about? the admin tools or the plain
admin?

I thought of using the admin tools templates and building from that, but
all I got was noReverseMatch erros, looks like the INSTALLED_APPS order is
significative and I don't understand it well.

how can I configure it to ignore the satchmo admin templates?

btw, could I make all this work with grappelli? it seems I could enjoy some
of the image uploading and wysiwyg editor

thanks
avraham

On Mon, Jul 16, 2012 at 10:33 PM, Tomas Neme  wrote:

> > I thought they extended the templates instead of trying to replace
> > everything
>
> they don't replace everything. But the admin site's index template is
> called 'admin/index.html', so it's not easy to extend them. They DO
> extend admin/base.html.
>
>
> This is my dashboard.py file, where I create a module that emulates
> satchmo's template additions.
>
> https://gist.github.com/3124534
>
> There's a couple of things that are MY PREFERENCES, so it might not
> all be to your liking, please do try to read, understand, and modify
> as you like.
>
> with this, I just use dashboards' admin/index.html template
>
> --
> "The whole of Japan is pure invention. There is no such country, there
> are no such people" --Oscar Wilde
>
> |_|0|_|
> |_|_|0|
> |0|0|0|
>
> (\__/)
> (='.'=)This is Bunny. Copy and paste bunny
> (")_(") to help him gain world domination.
>
> --
> 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: Excluding items from a queryset

2012-07-16 Thread Michael Elkins

On Mon, Jul 16, 2012 at 01:38:47PM +0200, Sithembewena Lloyd Dube wrote:

I have a queryset of categories and would like to exclude categories with
no items associated. I am cycling through the queryset as follows, without
the desired result:

for cat in categories:
   if cat.item_set.count() == 0:
   categories.exclude(pk=cat.pk)

How can I remove those categories (please note, I do not intend to delete
them)?


You can use an annotation:

categories.objects.annotate(Count(item)).exclude(item__count=0)

What this does is add a temporary attribute on each category 
object named `item__count', then you can exclude based on that 
attribute.


https://docs.djangoproject.com/en/1.4/ref/models/querysets/#annotate

me

--
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 and django-admin-tools

2012-07-16 Thread Tomas Neme
> thanks for sharing, I'll try to understand it.
>
> where should I put this file? inside localsite?
>
> what admin template are you talking about? the admin tools or the plain
> admin?

dashboard's (it's part of admin_tools) admin/index template.

> I thought of using the admin tools templates and building from that, but all
> I got was noReverseMatch erros, looks like the INSTALLED_APPS order is
> significative and I don't understand it well.

well, I should probably just point you to this:
http://django-admin-tools.readthedocs.org/en/latest/index.html

and specifically this:
http://django-admin-tools.readthedocs.org/en/latest/quickstart.html

You probably didn't add dashboard to INSTALLED_APPS and you're
probably missing the urls as well.

> how can I configure it to ignore the satchmo admin templates?

and some of django's documentation as well..
https://docs.djangoproject.com/en/dev/ref/templates/api/#loading-templates

The short version is, usually, you put under
yourproject/templates/admin/index.html whatever template you want to
be used, but do go and read those docs

> btw, could I make all this work with grappelli? it seems I could enjoy some
> of the image uploading and wysiwyg editor

you can most probably make everything work with everything, I don't
know what grappelli is, bear in mind you might need to dig deep in the
admin templates to make javascript (specially jquery) play nice with
every app you use

-- 
"The whole of Japan is pure invention. There is no such country, there
are no such people" --Oscar Wilde

|_|0|_|
|_|_|0|
|0|0|0|

(\__/)
(='.'=)This is Bunny. Copy and paste bunny
(")_(") to help him gain world domination.

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

2012-07-16 Thread Kurtis Mullins
I'd suggest taking a step back from the data structure of your application,
decide what you want to do with your data, and then take another stab at
it.

If you have more questions, I'd recommend posting your questions using your
application's real domain instead of continuing to use "similar" ideas.

Good luck!

-- 
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: Is upgrading to a newer Django version generally hassle-free?

2012-07-16 Thread sadpluto
Thanks to all for the feedback. It looks safe enough. I guess I was hoping 
for a 2to3-like tool for these properly announced upgrades!

-- 
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/-/m-am_G3vxUcJ.
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 forms.py works

2012-07-16 Thread 银涛 徐
Dear all,
I am a learner  and reading Django Documentation, how forms.py works? does it 
like models.py, Django can find it automatically? or everytime I need use 
"import forms"?

-- 
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: Excluding items from a queryset

2012-07-16 Thread akaariai
On 16 heinä, 14:38, Sithembewena Lloyd Dube  wrote:
> Hi everyone,
>
> I have a queryset of categories and would like to exclude categories with
> no items associated. I am cycling through the queryset as follows, without
> the desired result:
>
> for cat in categories:
>                 if cat.item_set.count() == 0:
>                     categories.exclude(pk=cat.pk)

Querysets are always cloned on calling a method, so the right syntax
is:
categories = categories.exclude(pk=cat.pk).
For efficiency reasons you might want to collect all the pks into a
list, and then after the loop do one:
categories = categories.exclude(pk__in=pk_list)

The queryset cloning can be expensive if you do a lot of operations.

Of course, the annotation way given downthread is likely to be the
most effective way to do this.

 - Anssi

-- 
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: Built-in filter "linebreaks" does not do what it says in the documentation

2012-07-16 Thread Russell Keith-Magee
On Mon, Jul 16, 2012 at 7:43 PM, Daniel Klein  wrote:
> So the bog-standard built-in filter linebreaks is supposed to do the
> following:
>
> "Replaces line breaks in plain text with appropriate HTML"
>
> The doc string is:
>
>  """Converts newlines into  and s."""
>
> However, it doesn't do this at all. It neither replaces nor converts;
> instead it leaves linebreaks in place and ADDS html tags:
>
> return u'\n\n'.join(paras)
>
> I could write my own filter that simply returns join(paras), but there's got
> to be a better way, no? And shouldn't we try to make the documentation talk
> about what is actually happening?

I don't accept your argument that the documentation is incorrect (or
that it's significantly misleading).

If you have plain text with newlines, you will usually want those
newlines preserved in rendered HTML. The way you do that -- the
"appropriate HTML" is to use  and  elements.

The implementation splits on newline characters, inserts the required
 and  elements -- and then joins with newlines to preserve
human readability of the output HTML. Newlines are a valid (if
ignored) part of the HTML spec; the newlines in the original markup
have therefore been "replaced" with the "appropriate HTML'.

If you can think of a better phrasing, we're always open to
suggestions. The current description has served us well for several
years, but that doesn't mean we're not willing to improve on it.

As for your actual problem: I'm not sure exactly what you're trying to
achieve -- i.e., why a strict join(paras) is an important operation to
you. Newlines are interpreted as whitespace in HTML, there's no
difference between text with newlines, and text without newlines
(other than human readability of the output).

If you're generating something other than HTML, then you're going to
need to build your own set of template filters; Django's builtin tags
are very much focussed at generating HTML.

Either way, a strict "join" filter isn't that complex -- maybe half a
dozen lines of code all up. If you truly need a strict join(), then
writing your own tag *is* the better way, in this case.

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.



start with django

2012-07-16 Thread Arian Asadi
hello all I learnt very small of python and django . what I must to do  to 
learn these?
can you get me a link to download the learn video ?

-- 
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/-/ueYRZeBZgdgJ.
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 on shared hosting

2012-07-16 Thread Jarrett Chisholm
Hi all,

I'm trying to setup django on greengeeks (shared hosting).

I've setup flup and django and a small app.  I've also created my cgi file 
(mysite.cgi) that runs from my cgi-bin directory.  I originally setup my 
.htaccess file as well, but it seems to redirect fine without any changes 
to .htaccess (running with the changes to .htaccess didn't seem to help...I 
dunno, maybe the .htaccess stuff I was entering is wrong, I don't know)...

>From my browser, I point to my django site, and get a 500 server error.

When I run 'python mysite.cgi' from the console (on the server) I get all 
of the expected django HTML getting printed...

When I change the mysite.cgi file and add :
print "Content-type: text/html\n\n"
print 'HI MOM'

and then point my browser to my site, it outputs 'HI MOM' on the screen 
(but nothing else)...

SO, mysite.cgi is being called!  Unfortunately, the django HTML is not 
being captured (or something) and returned to the browser (...).

I'm not really sure how to proceed from here...how do I get the HTML that 
django prints to the browser?

Here's my mysite.cgi

import sys, os

# Add a custom Python path.
sys.path.insert(0, "/home/icebreak/bin/python")
sys.path.append("/home/icebreak/lib/python2.4/site-packages")
sys.path.append("/home/icebreak/bin")
sys.path.append("/home/icebreak/django_projects/icebreak")

# Switch to the directory of your project. (Optional.)
os.chdir("/home/icebreak/django_projects/icebreak/mysite")

# Set the DJANGO_SETTINGS_MODULE environment variable.
os.environ['DJANGO_SETTINGS_MODULE'] = "mysite.settings"

from django.core.servers.fastcgi import runfastcgi

#print "Content-type: text/html\n\n"
#print 'wtfd'
runfastcgi(method="threaded", daemonize="false", 
outlog="/home/icebreak/django_out.log", 
errlog="/home/icebreak/django_err.log")


I've got a question on stack overflow, but not much luck 
(http://stackoverflow.com/questions/11493803/django-on-shared-hosting-greengeeks).

I appreciate any help you guys can provide!!

Thanks!

Jarrett 

-- 
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/-/SWbLrYVoauYJ.
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: FastCGI Problems

2012-07-16 Thread Jarrett Chisholm
Hey Newt,

not sure if this is your problem, but I think 

os.environ["DJANGO_SETTINGS_MODULE"] = "settings.py"

should be 

os.environ["DJANGO_SETTINGS_MODULE"] = "proj1.settings"

good luck

On Saturday, 14 July 2012 14:05:35 UTC-4, Newt wrote:
>
> (Sorry if this is a repost - it isn't showing up in the groups for me)
>
> I've tried to set up Django to use a sub-directory on my local PC - I'm 
> using Apache2.0.
>
> This is the relevant part from httpd.conf:
>
> Alias /django /stuff/django/proj1/proj1
>
> 
> Options +execCGI
> AllowOverride FileInfo
> Order allow,deny
> Allow from all
> 
>
> This is from .htaccess:
>
>   AddHandler fastcgi-script .fcgi 
>
>   RewriteEngine On 
>   RewriteCond %{REQUEST_FILENAME} !-f 
>   RewriteRule ^(.*)$ mysite.fcgi/$1 [QSA,L] 
>
> And this is mysite.fcgi
>
> #!/usr/bin/python
>
> import os,sys
>
> #sys.path.insert(0, "/stuff/django/proj1/proj1")
> sys.path.append('/stuff/django/proj1')
> sys.path.append('/stuff/django/proj1/proj1')
> #os.environ.setdefault("DJANGO_SETTINGS_MODULE", "proj1.settings")
>
> os.chdir("/stuff/django/proj1/proj1")
>
> os.environ["DJANGO_SETTINGS_MODULE"] = "settings.py"
>
> from django.core.servers.fastcgi import runfastcgi
> runfastcgi(method="threaded", daemonize="false")
>
> However, accessing http://localhost/django gives:
>
> Not Found
>
> The requested URL /stuff/django/proj1/proj1/mysite.fcgi/ was not found on 
> this server.
> --
> Apache/2.2.15 (Scientific Linux) Server at localhost Port 80
> Can anyone spot what I've got configured wrongly?
> TIA, N.
>

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



Any free cloud database hosting ?

2012-07-16 Thread surya
I am building a facebook application where I have to use database models 
(very small size ~ 1MB - 2MB). Is there any good cloud db storage website 
for hosting the database??

I looked around Amazon Web Services, it has really great offers but "I 
don't have credit card" :(  

I thought of using Google Cloud but I need to use "django-no rel". As there 
are some external lib involved in my project which create tables, I don't 
think I can tweak them successfully!

So, how exactly I should host the database??

-- Actually, I am using fandjango, facepy libs which need a database 
models..

-- 
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/-/bWaPhd8NASIJ.
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: Any free cloud database hosting ?

2012-07-16 Thread Alec Taylor
Heroku or Red Hat Open Cloud

On Tue, Jul 17, 2012 at 1:27 PM, surya  wrote:

> I am building a facebook application where I have to use database models
> (very small size ~ 1MB - 2MB). Is there any good cloud db storage website
> for hosting the database??
>
> I looked around Amazon Web Services, it has really great offers but "I
> don't have credit card" :(
>
> I thought of using Google Cloud but I need to use "django-no rel". As
> there are some external lib involved in my project which create tables, I
> don't think I can tweak them successfully!
>
> So, how exactly I should host the database??
>
> -- Actually, I am using fandjango, facepy libs which need a database
> models..
>
>  --
> 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/-/bWaPhd8NASIJ.
> 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: Any free cloud database hosting ?

2012-07-16 Thread surya
Heroku even needs "credit card". and let me check about red hat!

On Tuesday, July 17, 2012 9:06:18 AM UTC+5:30, Alec Taylor wrote:
>
> Heroku or Red Hat Open Cloud
>
> On Tue, Jul 17, 2012 at 1:27 PM, surya  wrote:
>
>> I am building a facebook application where I have to use database models 
>> (very small size ~ 1MB - 2MB). Is there any good cloud db storage website 
>> for hosting the database??
>>
>> I looked around Amazon Web Services, it has really great offers but "I 
>> don't have credit card" :(  
>>
>> I thought of using Google Cloud but I need to use "django-no rel". As 
>> there are some external lib involved in my project which create tables, I 
>> don't think I can tweak them successfully!
>>
>> So, how exactly I should host the database??
>>
>> -- Actually, I am using fandjango, facepy libs which need a database 
>> models..
>>
>>  -- 
>> 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/-/bWaPhd8NASIJ.
>> 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/-/sE_JjV050NAJ.
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 Distance from User

2012-07-16 Thread JJ Zolper
So wait,

Does UTM have to do with the timezones in the USA? Do some of the lines match 
to tomezone lines? You also never really answered my question before. Sure it 
sounds like you know what UTM is but I sure dont and thats all youre talking 
about.

If this is about the timezones or whatever then yes I can sort of imagine the 
issue youre talking about. I know what pythagoreans theorem is im a math guy 
but i cant quite pick how it applies to any of what we are talking about. Are 
you saying i need it to be able to calculate the circle and distances from a 
point in a 25 mile radius so x^2 +y^2 = 25 mi ^2?

Sorry if i seem slow. Still new to this.

JJ

-- 
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/-/yUDYlBFabCgJ.
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: Any free cloud database hosting ?

2012-07-16 Thread Alec Taylor
No, I have a heorku account without a credit card.

Admittedly it was automatically created via facebook... :P

So just do the same thing, create an app on facebook and it'll say "special
offer from partner" click that and you'll be setup for free on Heroku

On Tue, Jul 17, 2012 at 1:39 PM, surya  wrote:

> Heroku even needs "credit card". and let me check about red hat!
>
>
> On Tuesday, July 17, 2012 9:06:18 AM UTC+5:30, Alec Taylor wrote:
>>
>> Heroku or Red Hat Open Cloud
>>
>> On Tue, Jul 17, 2012 at 1:27 PM, surya  wrote:
>>
>>> I am building a facebook application where I have to use database models
>>> (very small size ~ 1MB - 2MB). Is there any good cloud db storage website
>>> for hosting the database??
>>>
>>> I looked around Amazon Web Services, it has really great offers but "I
>>> don't have credit card" :(
>>>
>>> I thought of using Google Cloud but I need to use "django-no rel". As
>>> there are some external lib involved in my project which create tables, I
>>> don't think I can tweak them successfully!
>>>
>>> So, how exactly I should host the database??
>>>
>>> -- Actually, I am using fandjango, facepy libs which need a database
>>> models..
>>>
>>>  --
>>> 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/-/**bWaPhd8NASIJ
>>> .
>>> To post to this group, send email to django-users@googlegroups.com.
>>> To unsubscribe from this group, send email to django-users+unsubscribe@*
>>> *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/-/sE_JjV050NAJ.
>
> 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: Query Distance from User

2012-07-16 Thread JJ Zolper
I absolutely agree! That sounds like a much better way to install postgis and 
the other various packages.

No more fiddling with my configure issues. I will try installing all of it 
tomorrow.

-- 
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/-/eSyJKGzdjigJ.
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 Distance from User

2012-07-16 Thread JJ Zolper
 Just use Lat/Lon. You can fidget over which ojection to use later as long as 
your data is good. (WGS84 is the best btw)

I agree lat long sounds beautiful to me! Well thats good.


For geolocation, you can use the HTML5 Geolocation API that will use the 
person's browser to give you a location usually accurate to 200m (better if 
they're on a phone with gps), more than enough given your search radius of 
200miles.

Oh okay ill keep that in mind in case i make a iphone app cause right now i 
like the idea of lat long.

For distance lookups, go with a simple bounding box algorithm (bounded by map 
edges, distance calc by pythagoras). Again exact positioning is NOT ESSENTIAL 
for your use case, especially on the 25mi scale.

What about a circle? Use lat long equated to a city or address and do a circle 
with that point in lat long and find all the data within the circle?

If you ever find yourself needing better/more accurate position calculation. 
use postgis, but never install from source, use your distro's packages (it Just 
Works tm). Should be called 'postgresql-9.1-postgis' on most distros. do a 
search. make sure you have libproj and libgeos installed as well.

Is "it just works" a programming catch phrase? Haha. Yes the distros this next 
time not the other way.

-- 
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/-/W95IyM6TCqcJ.
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 use admin with apache

2012-07-16 Thread Matt Smith
Background: I work on my projects using apache2 on my desktop machine, 
then just rsync across to the actual server (also apache2), that way I 
thought I could avoid the hassle of having things work with the dev 
server, but not with apache. Not so. Today I've discovered that the 
admin works under the dev server, but not with my apache setup. I 
replicated this using a brand new helloWorld project. I've searched the 
archives, the docs, the book, also ordinary web search. Found some 
people had similar problems and fixed it with apache Alias directives 
pointing ADMIN_MEDIA_PREFIX to DJANGO_SRC/contrib/admin/media but this 
didn't work for me. I get a 500 internal server error, regardless of DEBUG.


Appreciate any help with this.

--
Matt Smith
http://mattsmith.org.nz

--
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 toggle active/inactive items on webpage using Djnago/python......?

2012-07-16 Thread Pervez Mulla
Hey,

In my webpage how can Active/Inactive some items based on user
subscription?

If customer is subscribed (Active)then he can able to access all the
futures ,else customer will able to access only few(limited) items in
webpage? How can do this in Djnago...?

Please help me

Thank You
Pervez

-- 
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: Any free cloud database hosting ?

2012-07-16 Thread surya
Hi Alex,

Actually I am perfectly aware of Heroku. The point is, when I tried to 
install Postgre add-on in it, its asking to "verify" my account. i.e., to 
provide credit card details.

Thats the problem...

So I looked around OpenShift and I think most of it is for free. can you 
tell me more on it? How it works (Its up-time, speed etc)..

PS: do we really need to provide credit card details for Heroku to use db 
?..

On Tuesday, July 17, 2012 9:29:02 AM UTC+5:30, Alec Taylor wrote:
>
> No, I have a heorku account without a credit card.
>
> Admittedly it was automatically created via facebook... :P
>
> So just do the same thing, create an app on facebook and it'll say 
> "special offer from partner" click that and you'll be setup for free on 
> Heroku
>
> On Tue, Jul 17, 2012 at 1:39 PM, surya  wrote:
>
>> Heroku even needs "credit card". and let me check about red hat!
>>
>>
>> On Tuesday, July 17, 2012 9:06:18 AM UTC+5:30, Alec Taylor wrote:
>>>
>>> Heroku or Red Hat Open Cloud
>>>
>>> On Tue, Jul 17, 2012 at 1:27 PM, surya  wrote:
>>>
 I am building a facebook application where I have to use database 
 models (very small size ~ 1MB - 2MB). Is there any good cloud db storage 
 website for hosting the database??

 I looked around Amazon Web Services, it has really great offers but "I 
 don't have credit card" :(  

 I thought of using Google Cloud but I need to use "django-no rel". As 
 there are some external lib involved in my project which create tables, I 
 don't think I can tweak them successfully!

 So, how exactly I should host the database??

 -- Actually, I am using fandjango, facepy libs which need a database 
 models..

  -- 
 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/-/**bWaPhd8NASIJ
 .
 To post to this group, send email to django-users@googlegroups.com.
 To unsubscribe from this group, send email to django-users+unsubscribe@
 **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/-/sE_JjV050NAJ.
>>
>> 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/-/SqA4_hVJgYEJ.
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 TypeError

2012-07-16 Thread Sandeep kaur
I want to have different views for my application for different types
of users. For this I have this code for my views.py file :

def index1(request):
u = User.objects.all()
if u.is_staff ==1 and u.is_active == 1 and u.is_superuser == 1:
return render_to_response('tcc11_12/index1.html',
context_instance=RequestContext(request))
elif u.is_staff == 1 and u.is_active == 1 and u.is_superuser == 0:
return render_to_response('tcc11_12/index2.html',
context_instance=RequestContext(request))
else:
return render_to_response('index3.html',
context_instance=RequestContext(request))

But it gives TypeError as :
 "cannot convert dictionary update sequence element #0 to a sequence"

Is there anything wrong in above code?

-- 
Sandeep Kaur
E-Mail: mkaurkha...@gmail.com
Blog: sandymadaan.wordpress.com

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

2012-07-16 Thread @@
 u = User.objects.all()
u is not a user.

On Tue, Jul 17, 2012 at 2:00 PM, Sandeep kaur  wrote:

> I want to have different views for my application for different types
> of users. For this I have this code for my views.py file :
>
> def index1(request):
> u = User.objects.all()
> if u.is_staff ==1 and u.is_active == 1 and u.is_superuser == 1:
> return render_to_response('tcc11_12/index1.html',
> context_instance=RequestContext(request))
> elif u.is_staff == 1 and u.is_active == 1 and u.is_superuser == 0:
> return render_to_response('tcc11_12/index2.html',
> context_instance=RequestContext(request))
> else:
> return render_to_response('index3.html',
> context_instance=RequestContext(request))
>
> But it gives TypeError as :
>  "cannot convert dictionary update sequence element #0 to a sequence"
>
> Is there anything wrong in above code?
>
> --
> Sandeep Kaur
> E-Mail: mkaurkha...@gmail.com
> Blog: sandymadaan.wordpress.com
>
> --
> 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.