Re: Somethings the connection to the Postgress get lost. Why?

2014-07-12 Thread Rajesh Dhawan
" blank string > (then restarting nginx and postgresql) fixed the intermittent connection > dropping for me! > > > On Thursday, March 13, 2008 10:11:00 AM UTC-4, Rajesh Dhawan wrote: >> >> Hi, >> >> On Mar 12, 12:31 pm, mamcxyz <mamc...@gmail.com> wrote

Re: Uploaded File Array

2009-06-29 Thread Rajesh Dhawan
BarakatX2 wrote: > When I do: > > print type(f) > > It outputs: > > > > Also when I try to get the filename using the name property of > UploadedFile, it says: > > 'str' object has no attribute 'name' > > When I just print f it shows: > > ëPNG Try something like this code: for fname, fvalue

Re: Is it possible to access foreign-keyed properties using values_list()?

2009-06-29 Thread Rajesh Dhawan
huu...@gmail.com wrote: > I stand corrected. However, I should've been more explicit. I > created a method that combines multiple fields on the Author model. > For example: > > def Author(models.Model): > first_name = models.CharField() > last_name = models.CharField() > > def

Re: Getting started with django

2009-06-29 Thread Rajesh Dhawan
> I have some basic of python(functional part and also very basic of oop > part), but don't have other knowledge. I would like to start with > django. So, what more is required to getting started with django so > that i can grasp all the concept and can be proficient with django. > Also is there

Re: Password-protecting PDF downloads?

2009-06-29 Thread Rajesh Dhawan
bax...@gretschpages.com wrote: > This is probably more of a python question, but here goes: Can anyone > point me to a method of dynamically attaching a password to a PDF and > protecting the file before it's downloaded? The pyPDF library supports PDF encryption. There are probably others like

Re: add other field for django admin user

2009-06-29 Thread Rajesh Dhawan
> Suppose I have UserPref with attribute phone and detail > Is it possible to add UserPref.phone and UserPref.detil in edit form > in django user admin? You can provide a custom form that has your additional fields and knows how to save them. See:

Re: Handling a reusable form in multiple views

2009-06-29 Thread Rajesh Dhawan
delino wrote: > Rajesh, > > Thanks for your response. If I post the form to a dedicated view that > works fine, but how do I handle validation properly in this approach. > Say the user enters invalid data, do I now need to redirect them back > to the original page and then display these errors?

Re: custom form in admin debugging confusion

2009-03-30 Thread Rajesh Dhawan
felix wrote: > class ContactAdmin(Admin): > > form = EditContactForm > > > EditContactForm has a save method that is never called by the Admin > > but its clean() function does get called > > 60 def clean(self): > 61 import pdb; pdb.set_trace() > > my confusion is

Re: Limiting choices to a field in the user profile

2009-03-25 Thread Rajesh Dhawan
> In my models, I'm trying to limit the choices of a field based on the > data stored in a field in the user profile table. You will want to define these limits in your forms rather than in the models. > However, I have not been successful. I'm trying to learn Django, so > I'm still a noob when

Re: static files protect access

2009-03-17 Thread Rajesh Dhawan
alain31 wrote: > Hello, > if I use pictures in a django project, that only some users can see > (based on django's authentification middleware and special > attributes), > I cannot use static files as anybody could browse http://mediaurl/(...).jpg > and access private photos. > I thought to

Re: Django will not match r^sip/conf string in urls.py on Apache2 / modpython

2009-03-04 Thread Rajesh Dhawan
Rajesh D wrote: > On Mar 4, 9:58 am, Dan wrote: > > Url pattern below r^sip/conf and sip/createfile work for development > > server but Apache comes up with a 404 error. Note that the error is > > shown as Apache error not Django parsing error. So, is it Apache not > > using

Re: You don't have permission to edit anything - new forms admin

2009-02-17 Thread Rajesh Dhawan
> >     # Admin: >     ('^hiveadmin/(.*)', admin.site.root), That's no longer the right way to hook the admin into your URL conf. See here: http://docs.djangoproject.com/en/dev//ref/contrib/admin/#hooking-adminsite-instances-into-your-urlconf -RD

Re: default value for foreign key and CharField

2009-02-05 Thread Rajesh Dhawan
> > > > I have the following classes in my models.py: > > > > class Default(models.Model): > > > name = models.CharField(max_length=50, choices = > > > (('rental_period', 'rental_period'), ('currency', 'currency')), > > > unique=True) > > > value = models.CharField(max_length=50) > > > >

Re: default value for foreign key and CharField

2009-02-05 Thread Rajesh Dhawan
On Feb 5, 10:59 am, knight wrote: > Hi, > > I have the following classes in my models.py: > > class Default(models.Model): > name = models.CharField(max_length=50, choices = > (('rental_period', 'rental_period'), ('currency', 'currency')), > unique=True) > value =

Re: Filtering the admin "add" page with manytomany foreign key attribute

2009-02-05 Thread Rajesh Dhawan
On Feb 5, 8:25 am, Grimmo wrote: > Hi, > I have these models for my application: > > class Movie (models.Model): > Title = models.CharField(max_length=100) > Director = models.CharField(max_length=100,blank=True) > Year =

Re: URLField verify_exists is ignored

2009-02-05 Thread Rajesh Dhawan
On Feb 5, 10:17 am, Adam Radestock wrote: > I'm trying to get a URLField to NOT check the URL is valid on form > submission, but the damn thing won't listen! > I have the following model defined in my models.py: > > class SubversionRepository(models.Model): >

Re: Chained managers - alternative?

2009-02-05 Thread Rajesh Dhawan
Hi, phillc wrote: > In reference to > http://simonwillison.net/2008/May/1/orm/ > and comments from here > http://thisweekindjango.com/screencasts/episode/11/django-ground-episode-3/ > > > so i got to thinking, these posts were made pre-QSRF merge i think? so > is the updated version of the

Re: Filter by ForeignKey reference??

2009-02-03 Thread Rajesh Dhawan
> I have two simple models: > > class Country(models.Model): > name = models.CharField(_("Name"), max_length=50, > unique=True) > > class Profile(models.Model): > name = models.CharField(_("Name"), max_length=50, > unique=True) > country = models.ForeignKey(Country)

Re: Querying intermediate model in ManyToMany

2009-01-23 Thread Rajesh Dhawan
> > class Tag(models.Model): > name = models.CharField(max_length=100) > related = models.ManyToManyField('self', symmetrical=False, > through='TagCorrelation', blank=True) > > class TagCorrelation(models.Model): > from_tag = models.ForeignKey(Tag, related_name='related_source') >

Re: TypeError when using direct-to_template

2009-01-02 Thread Rajesh Dhawan
On Jan 2, 10:16 am, SG_Muse wrote: > Thank you very much for your quick answers gentlemen! > > I removed the quotes, but that lead into another problem; > TemplateSyntaxError Could not parse the remainder: ' name' from > 'project name' > I copied the

Re: Performance of include tag

2009-01-02 Thread Rajesh Dhawan
> I'm wondering how fast is the include tag. Currently I have a Message > model, which takes role of site messaging system with two ways of > delivering - through a dashboard page and through Jabber. Via Jabber, > each type of message has dedicated template and that template is then > parsed by

Re: Outdated data in django page rendering w/ cacheing disabled

2009-01-02 Thread Rajesh Dhawan
> > I have created a set of functions and classes to connect to the db and > request the data and then display the data rendered as a page, however > what I'm finding is that when the data is being changed from the main > set of applications connecting to and using this db and then i refresh >

Re: Loosing GET parameters while redirecting with generic view

2009-01-02 Thread Rajesh Dhawan
Hi, > I'm using a generic view to redirect from one URL to another: > > urlpatterns += patterns('prj.app.views', >(r'^foo/(?P.*)$', redirect_to, {'url': '/foo/bar/%(tail)s'}), > ) > > However, the URLs I want to redirect actually look like this: > > http://localhost/foo/?param1=value1=value2

Re: Dynamic age count

2008-12-23 Thread Rajesh Dhawan
On Dec 23, 9:53 am, Alfonso wrote: > Hi, > > Trying to implement a very simple template tag that will output a > company's age. So idea being if company was established in 1860 then > it should output '148 years old' if my math is right ;-) > > this is what I've got:

Re: Customizing ModelForm fields appearance

2008-12-23 Thread Rajesh Dhawan
sagi s wrote: > I really like the concept of generating a form from a model using > ModelForm but would like to customize the apprearance slightly (e.g. > size of the TextInput etc.). > > Any suggestion as to how to do this? A standard way to do this is via CSS. When you render your form in your

Re: Serving Static Pages with Dev server.

2008-12-23 Thread Rajesh Dhawan
On Dec 23, 10:38 am, "tom.s.macken...@gmail.com" wrote: > Hello, > > I am having some trouble serving static files with the development > server. I have read the docs and various blogs out there and nothing > seems to work. I am going nuts over this :) I have tried

Re: Is this a bug in FormWizard?

2008-12-22 Thread Rajesh Dhawan
> > Your analysis is correct. It's the self.extra_context.update(*) call > in the FormWizard that simply updates the class level copy of that > variable. > > If you instead override "parse_params" as suggested by the comments in > FormWizard, you won't have this problem. To be clearer, in

Re: Is this a bug in FormWizard?

2008-12-22 Thread Rajesh Dhawan
On Dec 19, 2:27 pm, 朱穆穆 wrote: > self.extra_context is a reference of FormWizard.extra_context. > It was empty when the class define, but may not empty when > instantiate. > > class TestWizard(forms.FormWizard): > pass > > tw1 = TestWizard() > tw1(request,

Re: Is this a bug in FormWizard?

2008-12-18 Thread Rajesh Dhawan
�� wrote: > On Dec 17, 7:49 am, Rajesh Dhawan <rajesh.dha...@gmail.com> wrote: > > On Dec 16, 2:31 am, $B<kKTKT(B <zhum...@gmail.com> wrote: > > > > > Theextra_contextinFormWizardis a class attribute so the new > > > request may get the cont

Re: Is this a bug in FormWizard?

2008-12-18 Thread Rajesh Dhawan
朱穆穆 wrote: > On Dec 17, 7:49 am, Rajesh Dhawan <rajesh.dha...@gmail.com> wrote: > > On Dec 16, 2:31 am, $B wrote: > > > > > Theextra_contextinFormWizardis a class attribute so the new > > > request may get the context of the previous request. > > >

Re: accessing fixed data as Model

2008-12-17 Thread Rajesh Dhawan
On Dec 16, 5:09 pm, adrian wrote: > How could I have some fixed data that is in a Python variable treated > as a Model? > > My app has about 1 MB of data that I need random access to for almost > every request. I don't want to read it out of MySQL because it would > be

Re: Is this a bug in FormWizard?

2008-12-16 Thread Rajesh Dhawan
On Dec 16, 2:31 am, 朱穆穆 wrote: > The extra_context in FormWizard is a class attribute so the new > request may get the context of the previous request. > I can prepend below to __call__ method to solved it: > > self.extra_context = self.extra_context.copy() > > Is this

Re: filter_horizontal

2008-12-16 Thread Rajesh Dhawan
> I'd like to know everything there is to know about using the > filter_horizontal method when displaying admin backend choices. > > I want to re-engineer it. > > I was wondering if anyone has done anything like this and could give me a > couple of pointers to get started. > > Any assistance as

Re: setting language in a cron job

2008-12-12 Thread Rajesh Dhawan
On Dec 12, 8:33 am, pihentagy wrote: > Hi all! > > I started to write a cron job, which sends reminders to users, but run > into the following: > > I do not know how to set the current language in this situation. > Setting settings.LANGUAGE_CODE has no effect. > > Note,

Re: exclude on ModelForm doesn't work

2008-12-12 Thread Rajesh Dhawan
On Dec 12, 8:45 am, Dennis Schmidt wrote: > Hi, > > actually that is how I do it. I'm subclassing from admin.ModelAdmin > and then set the form-field to the custom form I made. But maybe this > really only works for forms in applications. No, it does work in the

Re: models.FileField and InMemoryUploadedFile

2008-12-11 Thread Rajesh Dhawan
On Dec 11, 1:35 pm, rtelep wrote: > I have a model Foo with an ImageField. I want to create new Foo > object from request.FILES and POST from inside a view function. > > Ordinarily I would bind a form to request.FILES and request.POST to > get that data: > > form =

Re: How to write to a FileField?

2008-12-10 Thread Rajesh Dhawan
On Dec 10, 10:47 am, Mikkel Høgh <[EMAIL PROTECTED]> wrote: > Ok, I've been looking all over the docs for a solution to this, but > there's a lot of documentation for the FileField, just not on how to > use it… > > I have a model that looks like this: > > class Import(models.Model): >

Re: Form stays invalid even after required field has been set

2008-12-10 Thread Rajesh Dhawan
On Dec 10, 12:51 pm, Berco Beute <[EMAIL PROTECTED]> wrote: > Thanks. There are no non-field errors though. Outputting the incoming > request object shows the error: > > orderLineForm is invalid: Product:This field > is required. id="id_Tickety tick-product"> > > The 'product' is required it

Re: Memory Footprint

2008-12-09 Thread Rajesh Dhawan
> First, I'm gonna say that I have DEBUG turned off, and it's not Django's > fault. > > My Django sites seem to eat lots of memory. This is fine, and it isn't a > huge deal except that I am using all of my VPS's memory plus swap. The > real solution is to upgrade memory on the VPS, but I'm a poor

Re: problems with 'formset.__name__' in save_formset()

2008-12-09 Thread Rajesh Dhawan
> im a bloody django and python beginner and right now playing arround > with the code provided > onhttp://code.djangoproject.com/wiki/CookBookNewformsAdminAndUser > > on storing the entry in the admin following error occur: > > AttributeError at /admin/news/post/add/ > > 'CommentFormFormSet'

Re: Non-displayed fields on admin form get overwritten

2008-12-08 Thread Rajesh Dhawan
> > The code I pasted (poorly) *is* the model code that causes the > problem, minus the last couple of field entries. The code you pasted earlier uses the attribute name 'fields' where it should use the name 'fieldsets'. The former is used when you are providing a simple list of field names

Re:

2008-12-05 Thread Rajesh Dhawan
On Dec 5, 2:41 pm, PFL <[EMAIL PROTECTED]> wrote: > Thanks for your replies --I am still stuck here. > > >Have a look in the output from the development server - I very much doubt > >that the click results in any request being sent. > > A request is definitely sent for each of these cases:

Re: Custom Middleware TypeError exception

2008-12-05 Thread Rajesh Dhawan
On Dec 5, 11:20 am, Chris Smith <[EMAIL PROTECTED]> wrote: > Found an oddity - possibly in my code. Can't seem to work around it. > > Code in question (current multi-tenant middleware implementation): > > middleware.py .. > > from projectname.models import Tenant, HostEntry

Re:

2008-12-05 Thread Rajesh Dhawan
> How can I get Django templates to generate links to anchors that are > *local* to the document? > In a static HTML page, I have a table of contents with links to > internal sections within the same page: > > Section1 > Section2 > > These link to sections that that look like this: > > 111 >

Re: replacing a contrib class

2008-12-03 Thread Rajesh Dhawan
On Dec 3, 11:37 am, Logan Chow <[EMAIL PROTECTED]> wrote: > Thanks a lot, Rajesh. > Excuse me, but one more question: > When I edit/add the inherited class (for example: Student), > everything goes well but the password field. It is not user friendly. > So I try the following: > > from

Re: Non-displayed fields on admin form get overwritten

2008-12-03 Thread Rajesh Dhawan
On Dec 2, 10:03 pm, borntonetwork <[EMAIL PROTECTED]> wrote: > Thank you for your reply, Rajesh. The two fields in question are > actually "pending_referrer_name" and "pending_referrer_email". In the > admin class code below, I include them in the fields attribute. > However, initially I did

Re: replacing a contrib class

2008-12-03 Thread Rajesh Dhawan
On Dec 3, 8:47 am, Logan Chow <[EMAIL PROTECTED]> wrote: > Hi Rajesh, >     That's the way I did. >     But I am wondering how I can hide the Users in admin site? You can unregister the default User model from the admin: from django.contrib import admin from django.contrib.admin.sites import

Re: replacing a contrib class

2008-12-02 Thread Rajesh Dhawan
> I did considered , but I could not see how to do it , the model I want > to inherit is from > contrib.Users and the model I want to replace is contrib.Users . > It looks to me like a circular reference ...?? > How can I use the inherited model in the model I inherited from ?? It's still not

Re: Non-displayed fields on admin form get overwritten

2008-12-02 Thread Rajesh Dhawan
> I am using Django v1.0. When I use the "fields" attribute in my model > to tell the admin interface what fields to display on the change form, > I find that any fields I leave out get truncated when I use the form > to update a record. > > For instance, say I have a model class called "Users"

Re: Question from django beginner

2008-12-02 Thread Rajesh Dhawan
> > 2. Is there any built-in opton in Django (0.97 version) to unzip > files. I would need to unzip the file to a folder once the upload has > been done. Python provides libraries to handle zip files. Here's the starting point: http://www.python.org/doc/2.5.2/lib/archiving.html -Rajesh D

Re: replacing a contrib class

2008-12-02 Thread Rajesh Dhawan
> > I want to define a class inherited from a contrib class namely users > and replace it with the new one . > Long ago there was a replace_module keyword in the meta class of the > model , any idea how to achieve > this ? First of all, why do you want to replace the contrib User model with your

Re: Is the initial value of a form field available in the template?

2008-11-26 Thread Rajesh Dhawan
On Nov 26, 2:14 pm, ChrisK <[EMAIL PROTECTED]> wrote: > I'm doing a custom template (probably stupid), and using initial > values. Here's a precis: > > template has > > > {{form.url.field.initial}} > {{form.auth_id}} {{form.media_id}} {{form.fence_id}} > Reminder String: >     p> > > form

Re: Compare Lists for Unique Items

2008-11-26 Thread Rajesh Dhawan
On Nov 26, 9:00 am, Jeff FW <[EMAIL PROTECTED]> wrote: > If you already have a unique key on the project's name field, then > you're good to go--no duplicates will ever get inserted.  No need to > do any filtering ahead of time--just put each save() in a try/except > block that catches the

Re: Compare Lists for Unique Items

2008-11-25 Thread Rajesh Dhawan
Hi Alex, > Here is the code that I use. Output_list is from CVS and current_projects > is from the database. Is there a faster way to do this, or a built in > method in Python? This code works fine now, but I can see it getting slow. > > for b in output_list: > found = False >

Re: inlineformset_factory: shows only 1 extra even extra=5

2008-11-24 Thread Rajesh Dhawan
> I'm trying to make use inlineformset_factory to add several data on an > object at the sime time. I want to show 5 extra forms but when I view > it in browser it only shows 1formsets instead of 5. > > Here's my view code: > formset = inlineformset_factory(PackagingReport, PeopleProblem,

Re: Access the HTTP request from a model

2008-11-24 Thread Rajesh Dhawan
> I am new to Django so please excuse if this has been asked before - I > could not find anything in my list searches. > > I am using the standard admin for a model called Member. I can > override the save method to perform a small database tweak when a > member is saved. This will involve

Re: Auto-notify outside/API services when instance Updated - Best Practices?

2008-11-21 Thread Rajesh Dhawan
On Nov 20, 3:40 pm, "John.R" <[EMAIL PROTECTED]> wrote: > I'm working with an Event Model that, when saved (and possibly when > updated) needs to run some custom Python code to notify some outside > APIs - Twitter, Pownce, Google Calendar for instance. > > I know enough to implement Signals so

Re: order_by function

2008-11-21 Thread Rajesh Dhawan
> Can I order_by a function within the model? I know you can list them > in the admin inteface, etc. But can you order_by a model function? Or > would you have to write a custom piece of code to do that? In addition to the two solutions that John mentioned, you can do the following in many

Re: Back references for inherited models in Django 1.0

2008-11-19 Thread Rajesh Dhawan
Martin Green wrote: > Thanks Rajesh, > > That should sort out my problem. > > As a side note, it seems 'base' and 'base__inherited' appear to do the > same thing: Yes, actually that should work too since inherited is an instance of base. So, it's probably better to use 'base' since it's more

Re: sending emails to multiple people

2008-11-19 Thread Rajesh Dhawan
Hi, > I am trying to send an email to three people as follows: > > if request.session['Email'] != '': > #initialize email variables > # render both html and text strings from the templates below > textmessage = render_to_string('email_text.html', >

Re: Many to One - Requriring 2 fields to be different

2008-11-19 Thread Rajesh Dhawan
kevinski wrote: > I'm currently going through the "Learning Website Dev with Django" > book, using Django 1.0.2/Python 2.5/SQLite. There is an issue stumping > me. The book includes a "friendship" model which includes 2 foreign > keys set to User model: > > class Friendship(models.Model): >

Re: Back references for inherited models in Django 1.0

2008-11-19 Thread Rajesh Dhawan
Hi Martin, > I have been trying to use inherited models and back references for > filter queries, using django 1.0, 'final'. Whilst I am able to use > back references for the base class, I can not do so for the inherited > class (see example below). Is there any reasons why I should not be >

Re: building components

2008-11-19 Thread Rajesh Dhawan
> I'd like to build one component "Login" or "Navigation" which can be > places on different templates at different palces. e.g.i'd like to > have the the login component on the right side by default, but > sometimes it should be in the content area. > > Till now i learend that i can repalce {%

Re: Can I perform calculations directly in django tags/filters?

2008-11-18 Thread Rajesh Dhawan
> I am thinking about something like {{  (width - 5) *12  }}  ? No. That syntax is not supported in Django templates. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send

Re: forms.FileField | required=True fails

2008-11-18 Thread Rajesh Dhawan
> The mulipart/dorm-data encoding type is set, so that shouldnt be it. > Here's the code I'm using Your form and template look OK. Can you show your view code too? Perhaps you are not passing request.FILES to the posted form instance. -RD --~--~-~--~~~---~--~~

Re: File field problem

2008-11-18 Thread Rajesh Dhawan
laspal wrote: > Hi, > I am trying to save file using file field but ran into problem. > Here is my code: > > ***model > > class CronEmail(models.Model): > subject = models.CharField( max_length = 200) > message = models.CharField( max_length = 200) > sender =

Re: Getting at an instance's primary key in an inlineformset

2008-11-18 Thread Rajesh Dhawan
> I'm using inlineformset_factory to generate a tabular formset for > object instances from my database. I would like to add a link to each > table row to point to another form for each individual instance (the > instances are mailboxes and I want a password change form for an > individual

Re: forms.FileField | required=True fails

2008-11-18 Thread Rajesh Dhawan
Hi, > I'm using django 1.0, and am experiencing the following issue with a > forms.FileField. > When I use required=False, I'm able to validate the form, while when > using the same form with required=True in the forms.FileField, the > forms does not validate, and returns a *this field is

Re: Passing values to template

2008-11-17 Thread Rajesh Dhawan
Hi Alex, > I have a news application that I would like some help with. > > My view generates a list with objects mixed with dictionaries with two > objects. Then in my template, I want to loop through this list and > output each value. However, when it encounters a dictionary in the > list I

Re: Serializing models to JSON

2008-11-17 Thread Rajesh Dhawan
Hi, > In my application I'm trying to serialize the following model to json: > > class Node(models.Model): > name = models.CharField(db_column="NAME", > max_length=30, > db_index=True) > description =

Re: 'NoneType' object is not iterable

2008-11-11 Thread Rajesh Dhawan
Hi Javi, > I've tried putting FORCE_SCRIPT_NAME="" but everything continues at > the same state. I'm running the app in Apache2/mod_python. I've pasted > the htttp.conf file athttp://rafb.net/p/Ya1VKT55.html I can't see your conf file there. Perhaps you want to paste again at http://dpaste.com/

Re: Best practice

2008-11-06 Thread Rajesh Dhawan
meppum wrote: > I've run into a funny case and I'm not sure how to best deal with it. > Basically, I have the following classes. > > class Profile(models.Model): > name = models.CharField() > foo = models.PositiveIntegerField(blank=True, default=0) > > class RegistrationForm(forms.Form):

Re: Filtering the modelform in Admin on request.user

2008-11-06 Thread Rajesh Dhawan
Hi, > I have an Admin site which I want to filter based on request.user. > > My ModelAdmin class is something like this, > > class FilterOnUser(admin.ModelAdmin): > def queryset(self, request): > return self.model._default_manager.filter(user = request.user) > > def

Re: 'NoneType' object is not iterable

2008-11-05 Thread Rajesh Dhawan
Hi Javi, > Thanks but I'd already tried it. I don't understand why in the > production server is not added the preceeding slash to the url. My > urls.py is as follows: > urlpatterns = patterns('candidateTool.assessmentSystem.views', > (r'^$', 'index'), > (r'^enter/$', 'enter'), >

Re: custom query as the choices for dropdown

2008-11-05 Thread Rajesh Dhawan
Hi, > In the quest to build my web sales inventory system, I want to specify > that only stock that are available be listed in the dropdown. > > So my question is can I use a custom query to feed the choices for my field? Yes. See ModelChoiceField.queryset here:

Re: How to get project's root path in template?

2008-11-05 Thread Rajesh Dhawan
On Nov 5, 10:08 am, "yuanyun.ken" <[EMAIL PROTECTED]> wrote: > I see in django.contrib.admin, there are {{ root_path }} and > {{ app_path }} in its base.html. > But if I use them in my template, they are always empty. > What I should do to enable these variables. Those template variables are

Re: Why is my string not auto escaped?

2008-10-31 Thread Rajesh Dhawan
> > > > So if these built in filters are marking my strings safe, inspite of > > > unsafe data being passed in, should they not handle escaping as well? > > > The problem seems to be that your filter function doesn't mark itself > > with an is_safe attribute (defaulting it to False). So try

Re: Why is my string not auto escaped?

2008-10-30 Thread Rajesh Dhawan
On Oct 30, 1:30 am, shabda <[EMAIL PROTECTED]> wrote: > So if these built in filters are marking my strings safe, inspite of > unsafe data being passed in, should they not handle escaping as well? The problem seems to be that your filter function doesn't mark itself with an is_safe attribute

Re: Why is my string not auto escaped?

2008-10-29 Thread Rajesh Dhawan
On Oct 29, 8:35 am, shabda <[EMAIL PROTECTED]> wrote: > I need to create a custom filter which displays some data from db > depending on its data type. > > My code is something like, > > from django.template.defaultfilters import linebreaks, urlize > > def filterxx(data) > return

Re: Form with 2 models

2008-10-29 Thread Rajesh Dhawan
Hi Paddy, > I have an Account model: > > class Account(models.Model): > > accountname = models.CharField(max_length=50, unique=True) > owner = models.ForeignKey(User) > admins = models.ManyToManyField(User, related_name='admins', > blank=True) > accounts =

Re: Custom change list and list_display

2008-10-29 Thread Rajesh Dhawan
Hi Fabio, > I have to create a summary page for one of my models. With "summary > page" I mean a table where each item of my model is listed along with > its properties/values. > > Some of those properties/values are fields of the db itself, while > other values are calculated on the fly (maybe

Re: Django log for admin

2008-10-02 Thread Rajesh Dhawan
> I have an application based around the admin. Is there a way to find > out which users have logged on to the application? You could look at the last_login field in the User objects. -RD --~--~-~--~~~---~--~~ You received this message because you are subscribed

Re: post_save signal and multi-table inheritance

2008-10-02 Thread Rajesh Dhawan
On Oct 2, 10:46 am, Ant <[EMAIL PROTECTED]> wrote: > Going with the multi-table inheritance example from the docs: > > class Place(models.Model): > name = models.CharField(max_length=50) > address = models.CharField(max_length=80) > > class Restaurant(Place): > serves_hot_dogs =

Re: FileField in ModelForm gets required field error with valid entry

2008-10-02 Thread Rajesh Dhawan
On Oct 2, 3:36 pm, bobhaugen <[EMAIL PROTECTED]> wrote: > Seehttp://dpaste.com/81988/ > > Ran some tests, FileFields work fine in admin. > > In a ModelForm, when I select a file with the Browse button, then > click the submit button, the FileField value disappears and I get a > required field

Re: Paginator - JSON - Serializing related issue

2008-10-02 Thread Rajesh Dhawan
Hi, > I have the following: > [snip] > def people_json(request): > userobjects = User.objects.filter(is_superuser=False).extra(order_by > = ['auth_user.username+0']) > p = Paginator(userobjects, 10) > pagenumber = request.POST.get('pagenumber', 1) > try: >

Re: Can QuerySet return array of raw data not in Dict?

2008-10-02 Thread Rajesh Dhawan
On Oct 2, 11:17 am, Adam <[EMAIL PROTECTED]> wrote: > Is there anyway to get QuerySet to return only the raw data from the > field not wrapped in a dictionary object? QuerySets support a values_list() call. http://docs.djangoproject.com/en/dev//ref/models/querysets/#values-list-fields Is

Re: cannot import name execute_manager

2008-09-30 Thread Rajesh Dhawan
KillaBee wrote: > I am use the svn and I just installed it last night, but it is giveing > me this error: > > [EMAIL PROTECTED]:/home/bryant/Django-1.0/intranet# python manage.py runserver > 8080 > Traceback (most recent call last): > File "manage.py", line 2, in > from

Re: HTTPS Question...

2008-09-30 Thread Rajesh Dhawan
On Sep 30, 9:28 am, [EMAIL PROTECTED] wrote: > We have an online application for school, where we request the > individuals SSN and PharmCAS information. The application will be at > saywww.oursite.com/application/. Since we're gathering sensitive > data, I want to obviously make this secure

Re: Django JSON deserialization and caching

2008-09-30 Thread Rajesh Dhawan
> Thanks for your help so far - that definitely improved things > somewhat! Great. > > However, I'm still having a slight problem. When I pass > Item.objects.get(id=id) into the serializers.serialize( ... ) > function, it tells me that the Item is not iterable (this is why I was > originally

Re: cannot save model to db

2008-09-30 Thread Rajesh Dhawan
> I have a model for Thumbnail, but I cannot save it. It says: > AttributeError: 'Thumbnail' object has no attribute 'id'. > What is wrong? > > I use django 1.0-final-SVN-unknown > > thanks, Manuel > > Here is an example: > > >>> from portfolio.models import Photo, Thumbnail > >>> p =

Re: Many to Many where two fields in one model are related

2008-09-30 Thread Rajesh Dhawan
> I'm working on an app for planning balanced daily diets. And I'm > having trouble figuring out how to set up my models. I have: > > Ingredient(models.Model): > ingredient_name = CharField(max_length=50) > unit = CharField(max_length=15) > calories = DecimalField(max_digits=6,

Re: Django JSON deserialization and caching

2008-09-30 Thread Rajesh Dhawan
On Sep 30, 12:46 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > Hi guys, > > I was wondering if somebody could help me with deserialization. > > I'm currently trying to cache the result of a database query using a > JSON serializer in (what I assume to be) the standard fashion: > >

Re: relating auth user to company model

2008-09-29 Thread Rajesh Dhawan
On Sep 29, 12:58 am, MilesTogoe <[EMAIL PROTECTED]> wrote: > I've seen the docs on how to relate the user with a 1-1 relationship (ie > profile) but is there a way to have another model relate in a 1:many   > (ie one company with many users) - this would require user to have a > company field.

Re: Problem with database layer on solaris

2008-09-29 Thread Rajesh Dhawan
Ahoj Tomáš, > I have problem with django v1.0 installed on Solaris 9 sparc. I installed > packages cx_Oracle-4.3.1, sqlite3 v3.5.7 and pysqlite-2.4.0 there and tried > to start './manage.py syncdb' in my project. BUT: > > When I define connection to "DATABASE_ENGINE='sqlite3' in settings.py, I

Re: is this a valid email address?

2008-09-29 Thread Rajesh Dhawan
On Sep 29, 8:01 am, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > Is this a valid email address? > An asterisk is allowed in the local part of an email address. So that makes mr_biggles*_worth a valid address. -Rajesh --~--~-~--~~~---~--~~ You received this

Re: how to reject save of a model with many to many relation

2008-09-25 Thread Rajesh Dhawan
> I have two models, one of them has a many to many relation to the > other one. > > I want to add some checks to the first model, so I overwrote the save > method. If my checks are not ok, I plan not to call super().save(), > but this gives me the error "'FirstModel' instance needs to have a >

Re: FormPreview, context, and the state dictionary

2008-09-24 Thread Rajesh Dhawan
On Sep 24, 2:01 pm, Beals <[EMAIL PROTECTED]> wrote: > Thanks, Rajesh, that makes sense. You're welcome. Please consider bottom/in-line posting in future. It makes it easier for others to follow along what you are replying to. > I'm still having an issue, though. > One value I'm trying to put

Re: FormPreview, context, and the state dictionary

2008-09-24 Thread Rajesh Dhawan
On Sep 24, 11:41 am, Beals <[EMAIL PROTECTED]> wrote: > I've started to use the FormPreview app in contrib, which has mostly > worked out well (though it's a little strange to me to move all my > logic into the form, rather than the view). My only issue now is with > the context. > > Some

Re: Percentages in templates

2008-09-24 Thread Rajesh Dhawan
> I have an app that tracks football stats, I'd like to use bar graphs > similar to what's on Everyblock. This is their code: > > http://dpaste.com/80211/ > > I was curious, how, if possible at all, in the template I could get > the percentage for the height. > > So, for my first graph, so far

Re: Updates not working

2008-09-23 Thread Rajesh Dhawan
Hi Adam, On Sep 22, 6:05 pm, "Adam Findley" <[EMAIL PROTECTED]> wrote: > So I have a pretty simple case here in a view: > > event = Event.Objects.get(id='23') > event.end_date = datetime.now() > event.save() > > It should just work right? Yes. > > When looking at the queries, the UPDATE

  1   2   3   4   >