Re: creating project in Django

2014-08-10 Thread Kelly Nicholes
Django-admin has to be on your environments path.  Find where your 
Django-admin.oh file is and do the whole path.  python 
c:\...\Django-admin.python startproject myproject.  Maybe you forgot to 
activate your virtualenv?

Sorry about random capitalization.  Typed on my phone.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/5e899e3e-c70a-4db6-9015-fed2192f43f3%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Class that extends a model that is not a model

2014-03-05 Thread Kelly Nicholes
Just a guess, but have you tried putting it in a file not called models.py?

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/831057be-5a5b-4fb9-a74a-5da810833b5f%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Fast and Easy way to check if an instance of an Model exists in the Database

2014-01-20 Thread Kelly Nicholes
Wait-- Why aren't you using exists()?  Don't even check the pk.  
Model.query.exists() was made for this.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/2bccd6fc-e628-4b66-8299-6516904073d2%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: app to record and play video

2014-01-13 Thread Kelly Nicholes
Django, as far as the front-end is concerned, has little to do with 
actually capturing the video.  This is going to be on the frontend with 
your browser.  Depending on your audience, they might not have browser web 
capture available and will have to use a browser plugin like flash or 
silverlight, as mentioned in 
http://www.html5rocks.com/en/tutorials/getusermedia/intro/.  Otherwise, 
follow that link and see if that'd suit your needs.  


On Sunday, January 12, 2014 11:05:26 AM UTC-7, Piyush D wrote:
>
> Hi,
> I'm trying to build an app that records videos using webcam and plays it 
> on demand. Are there any resources/documentations on how to do this in 
> Django?
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/0bb51e98-b4ce-4174-98ba-23a27fc12c08%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: handling IntegrityError: Duplicate entry in UserCreationForm

2013-04-25 Thread Kelly Nicholes
If you ever want to know how the UserCreationForm works, the source is 
always available not only on your machine but also on 
https://github.com/django/django/blob/master/django/contrib/auth/models.py


On Wednesday, April 24, 2013 9:27:39 AM UTC-6, sachin wrote:
>
> Hello,
>
> I m extending my auth user model to add addition entries like phone 
> numbers and emp_id. In the model I m marking both the fields as unique=True.
> Form generation is using UserCreationForm. But whenever I try to save same 
> phone number or emp_id it throws 
>
> *IntegrityError: (1062, "Duplicate entry '447' for key 'phone_num'")*
>
> How to handle this error and show it to user during form input?
>
> Also how do the same UserCreationForm validates duplicate entry for 
> username etc ??
>
>

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




Re: Need good image on the fly resizing

2013-04-23 Thread Kelly Nicholes
For the problem with sorl-thumbnail not resizing to the same size as the 
others--  Are you cropping the image at all or just resizing?  If you crop, 
I don't understand how the images wouldn't be all the same size.  When I've 
used sorl, if the image is bigger than the dimensions to which I'm 
cropping/resizing, it's always spot-on.

On Sunday, April 21, 2013 6:35:02 PM UTC-6, frocco wrote:
>
> Can someone point me to a good package?
>
> Thanks
>

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




Re: e commerce django framwork

2013-04-04 Thread Kelly Nicholes
I recommend you take a look at 
https://www.djangopackages.com/grids/g/ecommerce/.  I've used satchmo a 
couple times.  I recall setting it up having a couple snags, but nothing 
unmanageable.  Overriding the templates isn't a big deal if you understand 
the TEMPLATE_URLS setting.  I haven't customized it extensively, but for 
what I needed, it was great for me right out of the box.



On Wednesday, April 3, 2013 2:03:51 AM UTC-6, mds...@gmail.com wrote:
>
> I have heard about Satchmo and would love to hear about anyone's 
> experience using it. Are there any other Python/Django based e-commerce 
> (a.k.a. shopping cart) solutions out there that you would recommend? 
>

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




Re: Is there an easy way to popup forms?

2013-02-14 Thread Kelly Nicholes
I was looking for something like this for CBVs about a week ago!  I'm glad 
this guy posted this question more clearly than mine to get this response. 
 I might try this out!  Thanks.  This is a very common pattern, I've found, 
and wasn't sure why it wasn't included in django's core!

On Thursday, February 14, 2013 6:30:27 AM UTC-7, Felipe 'chronos' 
Prenholato wrote:
>
> I use bootstrap modal with some jquery code.
>
> jQuery code isnt hard, on Django side what you need is special treatment 
> for ajax call so you can render template for form (and only form), so you 
> can load it into modal.
>
> Fortunately I wrote a AjaxUpdateView yesterday. It is in beta, but check 
> at 
> https://github.com/chronossc/django-cbv-utils/blob/4d992533925e4bc2e215cbfa8e98d07853d65784/cbv_utils/views.py#L152
>  ... 
> you will see in form_valid and form_invalid methods that I render the form 
> and return with JSON in response to ajax request.
>
> Here is html files and jquery code used with this view: 
> https://gist.github.com/chronossc/4952775 ... consider it a example :)
>  
>
>
> Felipe 'chronos' Prenholato.
> Linux User nº 405489
> Home page: http://devwithpassion.com | http://chronosbox.org/blog
> GitHub: http://github.com/chronossc/ | Twitter: 
> http://twitter.com/chronossc
>
>
> 2013/2/13 
>
>> **
>> Probably the easiest way is to use a JS/CSS framework that has a good 
>> support for popups and forms. There are a lot out there. I have personal 
>> experience with Bootstrap (one of the most popular these days) - check its 
>> documentation (look for both "popup" and "modal"), also search for 
>> available bootstrap plugins - plenty exist.
>>
>> If you wanted to stick with jQuery, check out jQuery UI - a set of 
>> reusable components that might suit your needs.
>>
>> HTH
>>
>> Jirka
>> --
>> *From: * frocco  
>> *Sender: * django...@googlegroups.com  
>> *Date: *Wed, 13 Feb 2013 11:35:36 -0800 (PST)
>> *To: *
>> *ReplyTo: * django...@googlegroups.com  
>> *Cc: *
>> *Subject: *Re: Is there an easy way to popup forms?
>>
>> Thanks Tom,
>>
>> Do you know how I would have a form display using this?
>>
>>
>> On Wednesday, February 13, 2013 11:41:59 AM UTC-5, Tom Evans wrote:
>>>
>>> On Wed, Feb 13, 2013 at 4:12 PM, frocco  wrote: 
>>> > I have a form I want to popup and am having trouble getting this to 
>>> work. 
>>> > This is not in the admin page. 
>>> > 
>>> > Can someone give me an example? 
>>> > 
>>> > Thanks 
>>> > 
>>>
>>> An easy way to do a pop up form is to use a jqueryui dialog¹ 
>>>
>>> http://api.jqueryui.com/**dialog/  
>>>
>>> Cheers 
>>>
>>> Tom 
>>>
>>> ¹ Other dialogs are available, consult your local google 
>>>
>>  -- 
>> You received this message because you are subscribed to the Google Groups 
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to django-users...@googlegroups.com .
>> To post to this group, send email to django...@googlegroups.com
>> .
>> Visit this group at http://groups.google.com/group/django-users?hl=en.
>> For more options, visit https://groups.google.com/groups/opt_out.
>>  
>>  
>>  
>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to django-users...@googlegroups.com .
>> To post to this group, send email to django...@googlegroups.com
>> .
>> Visit this group at http://groups.google.com/group/django-users?hl=en.
>> For more options, visit https://groups.google.com/groups/opt_out.
>>  
>>  
>>
>
>

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




Pattern for Ajax Forms using Django ModelForm and Class Based Views.

2013-02-08 Thread Kelly Nicholes
What's the best practice for this?  In my function based views, I'd check 
if the form is_ajax() and if so, validate the form, render_to_string it to 
a form template, and return that in a json dump along with a status code. 
 Then I check the status code to see if there are errors.  If so, I close 
the modal that the form is in, notify the user of successful addition, and 
move on.  If there are errors, I replace the form's HTML in the modal with 
the new HTML that contains the form with error messages.  This sucks 
because I have to do this for every form and for every view that I have.  

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




Re: No module named models again

2013-02-07 Thread Kelly Nicholes
Yeah, for things like forms.py and views.py, it's best to use relative 
imports for the models.py within the same app.

from .models import Object1


On Wednesday, February 6, 2013 7:22:19 PM UTC-7, frocco wrote:
>
> I found the answer.
> in my app directory called checkout, I also have a checkout.py file.
> from checkout.models import Order in views.py had to be changed to from 
> models import Order
>
> On Wednesday, February 6, 2013 3:02:57 PM UTC-5, Brad Pitcher wrote:
>>
>> On Wed, 2013-02-06 at 11:49 -0800, frocco wrote: 
>> > Line 22 does not make any sense to me as to why it is failing. 
>> > If I remove receipt, it runs fine 
>>
>> It can be surprising sometimes what code can cause other code to get 
>> imported and run. My guess is, in trying to find your url route there, 
>> Django looks through ntw.urls. When it sees 'receipts' it imports 
>> ntw.checkout.views to see if that view is there. Suffice it to say, 
>> Django is trying to run the code in ntw\checkout\views.py and it would 
>> be a good idea to make it work. 
>>
>>

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




Re: On the fly image resize

2013-02-03 Thread Kelly Nicholes
Check out sorl-thumbnail.  https://github.com/sorl/sorl-thumbnail .  This 
lets you specify the desired size in a template.and can deal with cropping. 
 It caches the results so it doesn't have to regenerate it each time.

On Saturday, February 2, 2013 1:33:36 PM UTC-7, nYmo wrote:
>
> Hi all, 
> I'm new to django and also python but have already some programming 
> experience. I'm currently creating my first application in django and get 
> stucked because I'm looking for the best way to resize uploaded images.
> I'm already so far that I can upload/delete/update my images and show them 
> in my view. Now I want to resize the images for my view and thought about 
> the best way?
>
> First question: Is it possible to resize the images on the fly? For 
> example I uploaded an image in 1920x1080px and now want to transform it to 
> 400x200 or something similar when the view is being loaded? Is this a 
> convenient way in django or not?
>
> The only other way in my opinion could be to resize the image during the 
> file is being uploaded. What I don't like about this is that I have more 
> than one copy of one image only because of different image sizes. 
>
> Any other thoughs?
>
> I know that there are some nice packages out there where such problems are 
> already solved. But since I'm new to django I want to learn by myself how 
> to accomplish the basic stufff :) 
>
> Thanks in advance
>
> Regards nymo
>

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




Re: Moving a Django website to another server

2013-01-31 Thread Kelly Nicholes
If you're storing your images in your database (don't) then your db 
migration should have done it.  If you're storing the paths in the 
database, let's hope they're relative paths to the images.  You'll have to 
copy the images to your new server using the same approaches listed above. 
 One alternative is to have a separate server that serves all of your 
static media, then your paths can stay the same, regardless of which 
server(s) your database(s)/code is on.

On Thursday, January 31, 2013 5:47:45 AM UTC-7, אברהם סרור wrote:
>
> similar question on the same topic:
>
> I used dumpdata/loaddata to move from sqlite to postgres, while it was 
> able to move the relations it didn't get any image, any way I could 
> something similar but including the images?
>
> would south be able to do it?
>
>
> On Thu, Jan 31, 2013 at 11:09 AM, John Robertson 
>  > wrote:
>
>> Hi there, thanks for all your very helpful responses. Its all a little 
>> out of my comfort zone so I might employ someone to do it for me. Any 
>> takers/quotes?
>>
>> cheers
>> John
>>
>>
>> On Friday, January 25, 2013 10:20:49 AM UTC, John Robertson wrote:
>>>
>>> Hi there, if I want to move a Django website to another host, is it as 
>>> simple as copying across all the site files and DB (and changing config 
>>> files)? If so, is there some kind of tool to create a zipped folder of the 
>>> website so that FTP does not take several hours! Sorry if this seems a very 
>>> basic question, but I just wanted to check before I proceed with it. They 
>>> are fairly simple, small sites, but still there are thousands of files.
>>>
>>> Many thanks!
>>> John
>>>
>>  -- 
>> You received this message because you are subscribed to the Google Groups 
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to django-users...@googlegroups.com .
>> To post to this group, send email to django...@googlegroups.com
>> .
>> Visit this group at http://groups.google.com/group/django-users?hl=en.
>> For more options, visit https://groups.google.com/groups/opt_out.
>>  
>>  
>>
>
>

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




Re: How do you extend a queryset object with another queryset as in list.extend(another_list)

2012-11-06 Thread Kelly Nicholes
You can always use itertools.chain() if you want to do it in memory. 
 Instead of doing it in memory as you've suggested, perhaps you need to 
index the account's PK so when your Items object manager queries for them, 
it can be quick.  

import itertools

list1 = [1,2,3,4]
list2 = ['a','b','c','d']

combined_list = itertools.chain(list1, list2)


On Tuesday, November 6, 2012 2:56:18 AM UTC-7, Neil Pritchard wrote:
>
> Hi,
>
> I have an application that needs to do a fairly big search across a large 
> number of records that goes something like...
>
> filterList = accounts.objects.filter(name="foo", company="bar", blah blah 
> blah..)
>
> itemsList = items.objects.filter(account__in=accountList, 
> status="delivered", andSo="on")
>
>
>
> The problem that I would like to overcome is that the 
> 'account__in=accountList' creates some very inefficient SQL and slow's this 
> query down a lot.
>
> What I thought of doing instead was:
>
> filterList = accounts.objects.filter(name="foo", company="bar", blah blah 
> blah..)
>
> for account in filterList:
>
> itemsList = items.objects.filter(account=account, status="delivered", 
> andSo="on")
>
> # I know it's not possible to extend a django queryset, I'm looking 
> for an equivalent
> wholeItemsList.extend(itemsList)
>
>
> Now I know the .extend method won't work on a django queryset, and I 
> realise that it's possible to convert the queryset to a list and than 
> extend them but that would use a horrible ammount of memory to duplicate 
> the queryset in this instance and wouldn't give me much of a time advantage.
>
> What I would like to do is to add each of the querysets, searching for 
> them without the '__in' filter saves a lot on sql, but then I don't want to 
> loose the efficiency that would gain by adding another latency.
>
> Any Ideas would be greatly appreciated
>
>
> Many thanks,
>
> Neil
>
>
>

-- 
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/-/-vBMH9yHQtYJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, 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: Iphone applications via django

2012-09-11 Thread Kelly Nicholes
If you go HTML/JS, a phonegap alternative for cross-device compatibility 
would be appcelerator.

On Tuesday, September 11, 2012 2:59:12 AM UTC-6, Sait Maraşlıoğlu wrote:
>
> How do you create iphone applications via django.
> Application logic will be django but what about user interface, do we do 
> that with django too?
>

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



Re: Can't Syncdb

2012-09-08 Thread Kelly Nicholes
Did you add the app name in settings.py under the INSTALLED_APPS list?

On Friday, September 7, 2012 10:23:31 PM UTC-6, Kollin wrote:
>
> I create a project. I create app by name "app" in the project. The app 
> that :
> app
> __init__.py
> models
> __init__.py
> a.py
> b.py
> but I can't syncdb the app. I use django 1.4.
> What error?
> THX
>

-- 
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/-/9JWe4hjtB0kJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, 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: Choosing a JS framework to go together with Django

2012-09-05 Thread Kelly Nicholes
It would be a travesty to not mention backbone.js.

On Tuesday, September 4, 2012 7:39:49 AM UTC-6, dotnetCarpenter wrote:
>
> Hi all.
>
> I'm new here and just took over a Django project for the first time. I'm 
> still getting to grip with Django but as a front end dev for the past 5 
> years, I'm also looking for a client-side library/framework to go together 
> with my project.
> My requirements for a JS framework is that it:
>
>1. is unobtrusive (Django rendered HTML will be shown to scraper bots 
>like google)
>2. provides some sort of structure (MVC, MVP, MVVM ect.)
>3. embraces standards
>4. doesn't conflict with Django templates or does so intentionally
>5. ideally uses the same template language as Django
>
> In the ideal world a request/response scenario would look like this:
>
>1. A client make a (HTTP) request to the (django powered) web site 
>with (HTTP) Accept header text/html
>2. Django response in the usual way by rendering the assign View 
>(django template)
>3. The view figure out if JS is supported (implemented in JS). If no, 
>this scenario stays in loop 1-3. If yes, then 4.
>4. The client (usually a browser) wire up the client-side app 
>structure, hook in to URI links, add transitions between views, 
>data-bindings ect.
>5. Subsequent request are now handle by the JS framework, either user 
>initiated (e.g. clicking a link) or app initiated (e.g. pulling extra 
>data), that will modify the request header to Accept header 
>application/json or application/django-template.
>6. If django receive a request with an application/django-template 
>header it will serve the view as plain text. E.g. Content-type: 
> text/plain. 
>On the other hand if django receive a request with application/json, it 
>will send the object model defined in the view as JSON.
>7. The client-side JS framework will receive a template to render in 
>the first request and the data to render in the template in the second 
>request. A promise object could be used to synchronize the two calls.
>
> This way django will work as intended for non JS clients and silently 
> convert to a RIA in clients that supports JS, with minimal double work for 
> the two execution contexts.
> A big pro in this is the fact that both django and the JS framework share 
> template and data (only has to defined once - in django) - we'll duck type 
> all the way. But does this JS framework exist? Does anyone have any 
> experience with working with django and JS frameworks? Is there any obvious 
> pitfalls in my ideal world scenario in regard to Django? And finally, is it 
> possible to serve templates as plain text with django?
>  
>
> Cheers, Jon and thanks in advance
>
> PS. I accidentally cross-posted this to the Django Developers group before 
> realizing it was the wrong forum. Sorry about that. 
>
>

-- 
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/-/PF4D-xIEovcJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, 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: Storing Sorl-thumbnail created images in separate folder

2012-04-29 Thread Kelly Nicholes
It always just caches the files for me in a completely different directory.

On Saturday, April 28, 2012 1:06:12 PM UTC-6, Swaroop Shankar wrote:
>
> Hello All,
> I am using sorl-thumbnail extensively in my project. It works perfectly 
> fine except for one issue which is regarding the storage. The default 
> behaviour of sorl-thumbnail is to create the images in the same folder 
> where the original image is stored. Is it possible to provide 
> a separate location for storage of generated file rather than the source 
> folder? I could find a setting called THUMBNAIL_STORAGE, is it the one to 
> be used? I am not able to figure it out from the documentation. If yes then 
> should i provide the absolute or relative path?
>
> Thanks and Regards,
>
> Swaroop Shankar V
>
>  

-- 
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/-/Tfl7B7Xir_gJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, 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: viewing generated SQL without running the query

2012-02-23 Thread Kelly Nicholes
Can't you get a queryset, like

print MyObject.objects.all().query
?

On Feb 21, 7:32 pm, diafygi  wrote:
> There's a previous thread about this[1], but it was closed back in
> 2006 without resolution. So I'd like to check back in and see if there
> is a way to get a complete query string without executing the query.
>
> At first, I thought I could just use the QuerySet.query.__str__(), but
> that does not put quotes around dates, so MySQL returns a warning when
> trying to execute it. I filed a bug report[2], but apparently
> QuerySet.query.__str__() isn't supposed to return a valid query
> string.
>
> So is there a way to get the compiled query string without executing
> the query (including when debug=False)?
>
> Thanks!
> Daniel
>
> [1] -http://groups.google.com/group/django-users/browse_thread/thread/37a6...
> [2] -https://code.djangoproject.com/ticket/17741

-- 
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: Associating Form Data with Users

2012-02-21 Thread Kelly Nicholes
And by "API" do you mean "ORM?"

On Feb 21, 10:45 pm, Kelly Nicholes <kelbolici...@gmail.com> wrote:
> errr--
>
> django.contrib.auth.models import User
>
> class YourModel(models.Model):
>     user = models.ForeignKey(User)
>
> On Feb 21, 10:42 pm, Kelly Nicholes <kelbolici...@gmail.com> wrote:
>
>
>
>
>
>
>
> > Your YourModelForm is a modelform of a model.  If you're setting a
> > property of that model, AND YOU WANT IT TO PERSIST IN THE DATABASE,
> > you set the property equal to the request.user and save that object.
> > If you don't have a foreignkeyfield to User, there's no way you're
> > going to associate that model with a user and have it persist.
> > Setting it in memory is going to be useless (unless you use it in the
> > view/template immediately after you associate the user with the
> > model).
>
> > class YourModel(inherit from whatever the model is that you should
> > inherit from):
> >     field = models.Charfield(...blahblahblah)
> >     user = models.ForeignKeywhatever()
>
> > Then do what Thorsten said.
>
> > On Feb 21, 2:28 pm, ds39 <sdavid...@gmail.com> wrote:
>
> > > I just have one final question. The method suggested by Thorsten
> > > appears to work. But, is the attached user object an accessible filter
> > > parameter in the API now ? For instance, I don't see it listed as a
> > > part of the actual model in the API. How would I go about accessing
> > > it ?
>
> > > On Feb 20, 5:25 pm, Thorsten Sanders <thorsten.sand...@gmx.net> wrote:
>
> > > > You could do for example:
>
> > > > exclude the user field from the form and in your view something like 
> > > > this:
>
> > > > form = YourModelForm(request.POST)  #fill the modelform with the data
> > > >          if form.is_valid(): # check if valid
> > > >              mynewobject = form.save(commit=False) #save it to create
> > > > the object but dont send to database
> > > >              mynewobject.user = request.user # attach the user to it
> > > >              mynewobject.save() # now do the real save and send it to
> > > > the database
>
> > > > Am 20.02.2012 22:59, schrieb ds39:
>
> > > > > I hate to keep bringing this issue up, but I'm still not entirely sure
> > > > > how to implement this. I've tried a number of different ways to
> > > > > connect some kind of user ID with form data without much success. Is
> > > > > the idea that after authenticating the user in the view, request.user
> > > > > be set to some variable that allows the user ID to be added to the
> > > > > model or ModelForm ? Would this make the user object associated with
> > > > > the form or model object accessible by filtering in the API ?
>
> > > > > Thanks again
>
> > > > > On Feb 19, 9:48 pm, Shawn Milochik<sh...@milochik.com>  wrote:
> > > > >> On 02/19/2012 09:29 PM, ds39 wrote:
>
> > > > >>> Thanks for your response. But, would you mind expanding on it a 
> > > > >>> little
> > > > >>> bit ?
> > > > >> How about you give it a try and see what you can figure out? In your
> > > > >> view, request.user will return the currently logged-in user (or an
> > > > >> AnonymousUser if they're not logged in). Since you said your view
> > > > >> requires login, you'll have a User object all ready to go.
>
> > > > >> Shawn

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



Re: Associating Form Data with Users

2012-02-21 Thread Kelly Nicholes
errr--

django.contrib.auth.models import User

class YourModel(models.Model):
user = models.ForeignKey(User)

On Feb 21, 10:42 pm, Kelly Nicholes <kelbolici...@gmail.com> wrote:
> Your YourModelForm is a modelform of a model.  If you're setting a
> property of that model, AND YOU WANT IT TO PERSIST IN THE DATABASE,
> you set the property equal to the request.user and save that object.
> If you don't have a foreignkeyfield to User, there's no way you're
> going to associate that model with a user and have it persist.
> Setting it in memory is going to be useless (unless you use it in the
> view/template immediately after you associate the user with the
> model).
>
> class YourModel(inherit from whatever the model is that you should
> inherit from):
>     field = models.Charfield(...blahblahblah)
>     user = models.ForeignKeywhatever()
>
> Then do what Thorsten said.
>
> On Feb 21, 2:28 pm, ds39 <sdavid...@gmail.com> wrote:
>
>
>
>
>
>
>
> > I just have one final question. The method suggested by Thorsten
> > appears to work. But, is the attached user object an accessible filter
> > parameter in the API now ? For instance, I don't see it listed as a
> > part of the actual model in the API. How would I go about accessing
> > it ?
>
> > On Feb 20, 5:25 pm, Thorsten Sanders <thorsten.sand...@gmx.net> wrote:
>
> > > You could do for example:
>
> > > exclude the user field from the form and in your view something like this:
>
> > > form = YourModelForm(request.POST)  #fill the modelform with the data
> > >          if form.is_valid(): # check if valid
> > >              mynewobject = form.save(commit=False) #save it to create
> > > the object but dont send to database
> > >              mynewobject.user = request.user # attach the user to it
> > >              mynewobject.save() # now do the real save and send it to
> > > the database
>
> > > Am 20.02.2012 22:59, schrieb ds39:
>
> > > > I hate to keep bringing this issue up, but I'm still not entirely sure
> > > > how to implement this. I've tried a number of different ways to
> > > > connect some kind of user ID with form data without much success. Is
> > > > the idea that after authenticating the user in the view, request.user
> > > > be set to some variable that allows the user ID to be added to the
> > > > model or ModelForm ? Would this make the user object associated with
> > > > the form or model object accessible by filtering in the API ?
>
> > > > Thanks again
>
> > > > On Feb 19, 9:48 pm, Shawn Milochik<sh...@milochik.com>  wrote:
> > > >> On 02/19/2012 09:29 PM, ds39 wrote:
>
> > > >>> Thanks for your response. But, would you mind expanding on it a little
> > > >>> bit ?
> > > >> How about you give it a try and see what you can figure out? In your
> > > >> view, request.user will return the currently logged-in user (or an
> > > >> AnonymousUser if they're not logged in). Since you said your view
> > > >> requires login, you'll have a User object all ready to go.
>
> > > >> Shawn

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



Re: Associating Form Data with Users

2012-02-21 Thread Kelly Nicholes
Your YourModelForm is a modelform of a model.  If you're setting a
property of that model, AND YOU WANT IT TO PERSIST IN THE DATABASE,
you set the property equal to the request.user and save that object.
If you don't have a foreignkeyfield to User, there's no way you're
going to associate that model with a user and have it persist.
Setting it in memory is going to be useless (unless you use it in the
view/template immediately after you associate the user with the
model).

class YourModel(inherit from whatever the model is that you should
inherit from):
field = models.Charfield(...blahblahblah)
user = models.ForeignKeywhatever()

Then do what Thorsten said.

On Feb 21, 2:28 pm, ds39  wrote:
> I just have one final question. The method suggested by Thorsten
> appears to work. But, is the attached user object an accessible filter
> parameter in the API now ? For instance, I don't see it listed as a
> part of the actual model in the API. How would I go about accessing
> it ?
>
> On Feb 20, 5:25 pm, Thorsten Sanders  wrote:
>
>
>
>
>
>
>
> > You could do for example:
>
> > exclude the user field from the form and in your view something like this:
>
> > form = YourModelForm(request.POST)  #fill the modelform with the data
> >          if form.is_valid(): # check if valid
> >              mynewobject = form.save(commit=False) #save it to create
> > the object but dont send to database
> >              mynewobject.user = request.user # attach the user to it
> >              mynewobject.save() # now do the real save and send it to
> > the database
>
> > Am 20.02.2012 22:59, schrieb ds39:
>
> > > I hate to keep bringing this issue up, but I'm still not entirely sure
> > > how to implement this. I've tried a number of different ways to
> > > connect some kind of user ID with form data without much success. Is
> > > the idea that after authenticating the user in the view, request.user
> > > be set to some variable that allows the user ID to be added to the
> > > model or ModelForm ? Would this make the user object associated with
> > > the form or model object accessible by filtering in the API ?
>
> > > Thanks again
>
> > > On Feb 19, 9:48 pm, Shawn Milochik  wrote:
> > >> On 02/19/2012 09:29 PM, ds39 wrote:
>
> > >>> Thanks for your response. But, would you mind expanding on it a little
> > >>> bit ?
> > >> How about you give it a try and see what you can figure out? In your
> > >> view, request.user will return the currently logged-in user (or an
> > >> AnonymousUser if they're not logged in). Since you said your view
> > >> requires login, you'll have a User object all ready to go.
>
> > >> Shawn

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



Re: Somebody please attend to me

2012-02-06 Thread Kelly Nicholes
This is link holds the PERFECT answer for you:
http://bit.ly/wc0psc

If you want to do it differently, try:

First you'll have to send an XMLHttpRequest (jQuery post() or get())
to your server to post a form (create a modelform with a "Comment"
model with all of the required fields.  You might want to look into
generic content types for django models).  Save the comment out
(associate it with the user from the request) in your view.  Then add
a link to do a comment (if you want you can do fancy html5 stuff with
the "editable" property on some div).  The click the link, dynamically
(use jquery) to show another form (or create it if you'd like).  When
they submit the friend comment, associate that friend comment with the
original comment (you could parse this out of the ID attribute that
you could set on the original comment) and save it just as you did the
first...  Or just look for premade things...

You could look into django's built-in comment system
https://docs.djangoproject.com/en/1.2/ref/contrib/comments/example/
Here's one called django-facebook-comments 
https://bitbucket.org/sirpengi/django-facebook-comments

On Jan 23, 4:38 am, coded kid  wrote:
>  Please how can I get user post update, make their friends comment and
> share the update in django? Just like the way FB update is. I hope you
> get my point?  Thanks so much

-- 
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: Need to examine and act on old vs. new at .save() time

2012-01-10 Thread Kelly Nicholes
Isn't there a form.changed_data ?

On Jan 9, 6:39 pm, Jeff  wrote:
> Hi all,
>
> I need to be able to determine, at .save() time (before I call the
> parent class' .save()), if a certain field on my model object was
> changed, and act on that via some custom code.  How can I do this,
> bearing in mind that we call .save() from non-web code, etc?  We use
> Django's ORM from various other non-web interfaces and code.  My point
> is that we can't just inspect a web form's result data.
>
> I'd appreciate any thoughts.

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



Re: how to use "{% url *** %}" in django template file?

2011-08-11 Thread Kelly Nicholes
You need to set the name parameter.  name="card_create_card".  Once
you do that, reference it in the {% url  %}.


On Aug 7, 6:34 pm, muhdazwa  wrote:
> You can add name to the url in the urlpatterns:
>
> urlpatterns = patterns('',
>    url(r'card/create$', 'card.views.create_card',
> name='card_create_card'),
> )
>
> and call it in the template:
>
> {% url card_create_card %}
>
> On Aug 7, 1:05 pm, Jimmy  wrote:> Hi,
>
> > I got the error "Caught ImportError while rendering: No module named
> > urls" when using:
>
> > {% url 'card.views.create_card' %} in the template file
>
> > in the urls.py the route to the url is:
>
> > urlpatterns = patterns('',
> >    url(r'card/create$', 'card.views.create_card'),
> > )
>
> > The Django version I use is 1.3
>
> > May I know what did I miss in setting?

-- 
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 Improper Configuration

2011-01-24 Thread Kelly Nicholes
I think I had this error too when I was cloning a repo from WebFaction
to use on my local dev machine.  I ended up having to replace
WebFaction's manage.py with the one from Django.  Let me know if it
works for you!  I wish I could explain why.  Can't.

On Jan 23, 8:55 pm, Graham Dumpleton 
wrote:
> Are you saying that those two print statements you were told to add are not
> causing anything additional to be displayed on the screen when you run both
> runserver and syncdb?
>
> This is why I asked you to provide the output again. You may not understand
> what we are looking for. Don't care about what the error is at the point but
> the information that those print statements should have output.
>
> Graham
>
>
>
>
>
>
>
> On Monday, January 24, 2011 2:48:50 PM UTC+11, Kimberly wrote:
>
> > I've provided the full errors in the post, it is there. ( same errors as
> > I've faced prior to adding the print __file__ and 'DATABASES', DATABASES) as
> > I'm encountering the same after I've copied and paste the print inside the
> > settings.py file at the end)
>
> > On Sun, Jan 23, 2011 at 9:40 PM, Graham Dumpleton 
> > wrote:
>
> >> That is two underscores, followed by 'file' followed by two underscores.
> >> Not just a single underscore.
>
> >> Please try and cut and paste out we give to use and vice versa. In other
> >> words, provide complete output showing full errors and tracebacks. Such
> >> information may be meaningful to use even if you think it isn't.
>
> >> Graham
>
> >> On Monday, January 24, 2011 2:35:06 PM UTC+11, Kimberly wrote:
>
> >>> it says that the _file_ is not defined.
>
> >>> On Sun, Jan 23, 2011 at 9:28 PM, Graham Dumpleton 
> >>> wrote:
>
>  On Monday, January 24, 2011 2:19:09 PM UTC+11, Steven Elliott Jr wrote:
>
> > Copy and Paste the following to replace your entire DATABASES tuple:
>
> > DATABASES = {
> >     'default': {
> >         'ENGINE': 'django.db.backends.sqlite3',
> >         'NAME': 'database.db',                    
> >         'USER': '',                      
> >         'PASSWORD': '',                  
> >         'HOST': '',                      
> >         'PORT': '',                      
> >     }
> > }
>
> > it looks like in your configuration you are also missing a comma after
> > the name of the database. Remember you must include that comma because 
> > this
> > is a tuple.
>
>  That was already pointed out to them.
>
>  The lack of a comma should have resulted in a syntax error, which makes
>  me believe, unless they modified the content before posting, that they 
>  may
>  be modifying a different file to what is being read.
>
>  I would like to see them, instead of changing DATABASES yet again, is to
>  add at the very end of their settings.py file, the lines:
>
>    print __file__
>    print 'DATABASES', DATABASES
>
>  This will prove two things. First that the file is being read as the
>  output from this should show on stdout when running runserver or syncdb.
>  Second, will show what Python is seeing DATABASES as being set to.
>
>  if it doesn't show, then wrong file. If shows, but is different to what
>  they believe they are setting it to, they could have multiple DATABASES
>  entries in file.
>
>  Graham
>
>   --
>  You received this message because you are subscribed to the Google
>  Groups "Django users" group.
>  To post to this group, send email to djan...@googlegroups.com.
>  To unsubscribe from this group, send email to
>  django-...@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...@googlegroups.com.
> >> To unsubscribe from this group, send email to
> >> django-users...@googlegroups.com.
> >> For more options, visit this group at
> >>http://groups.google.com/group/django-users?hl=en.

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



Re: DJANGO BOOTCAMP

2011-01-01 Thread Kelly Nicholes
I've found many books that demonstrate how Django can be used.
Django 1.0 Web Site Development
Practical Django Projects, Second Edition
and The Definitive Guide to Django: Web Development Done Right, Second
Edition are all pretty nice.  I'd recommend checking these out.


On Dec 31 2010, 6:17 am, delegb...@dudupay.com wrote:
> Hi all,
>
> I recently started working on a project which is based on django. I've had 
> reasons to work through the documentation several times to get things done.
> However, each time I check the documentation, I find out there is more to 
> learn hence, my thought.
>
> Is there any or can there be a django clinic for beginners or a bootcamp for 
> beginners where people can go through the process of learning django.
>
> With the little I have seen of the so many that is possible, can there not be 
> such arrangement for beginners like me to tap into. Reading the documentation 
> alone may not help as having a guide.
>
> Regards.
> Sent from my BlackBerry wireless device from MTN

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