where to put the username password data

2010-01-24 Thread harryos
hi I was going thru bennet's practical django book..In the weblog app it mentions that the DELICIOUS_USER ,DELICIOUS_PASSWORD values should be set in settings file.The book mentions an import like from django.conf import settings When I looked thru the directory in django/conf I could not find a s

Re:login failure

2010-01-24 Thread harryos
On Jan 24, 10:45 pm, Daniel Roseman wrote: > You put them in your project's settings.py (which, through some magic, > is imported via django.conf). You should not be editing any of the > code inside Django itself, unless you know what you're doing. Thanks for the reply..I added the login data to

viewsite button takes me to example.com

2010-01-29 Thread harryos
hi I was trying out the weblog app in bennet's book.I created some categories and entries and can list them properly using http://127.0.0.1:8000/myblog/ and http://127.0.0.1:8000/myblog/categories The admin interface also lists the categories properly when I try http://127.0.0.1:8000/admin/myblog

doubt about permalink and name in urlpatterns

2010-01-30 Thread harryos
In Bennet's book ,chapter4, decoupling the urls (page 74 in my ebook) ,the name 'coltrane_entry_detail' is added to the urlpattern for an entry and the get_absolute_url() method in class Entry makes use of that name ,and permalink causes the method to output correct url. But I can't understand why

Re: doubt about permalink and name in urlpatterns

2010-01-30 Thread harryos
> So you can use them with the {% url %} tag in templates, as shown later on. thanks a lot harry -- 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

logic of forloop.revcounter and revcounter0

2010-02-02 Thread harryos
hi While trying out lessons on templates.I tried using the variables in 'for' to print the names of 2 tags in a list called taglist.(template code is given at the bottom) I could n't understand why ifequal forloop.revcounter0 1 is used instead of revcounter.. I tried to follow the logic using re

Re: logic of forloop.revcounter and revcounter0

2010-02-02 Thread harryos
.revcounter0 0 %} or > {% ifequal forloop.revcounter 1 %}. > > To get a better handle on what has which value when, you could sprinkle > some {{ forloop.revcounter }} and {{ forloop.revcounter0 }} instances in your > loop. > > Bill > > On Tue, Feb 2, 2010 at 4:30 AM,

how to generate slug from datetime and another model's field

2010-02-03 Thread harryos
hi I have an Entry class that has no title but is to be represented uniquely by a combination of its category and a datetime value.The Category has a name field.I have modelled these like class MyCategory(models.Model): name=models.CharField(max_length=10) description=models.TextF

FieldError with get_object_or_404

2010-02-04 Thread harryos
hi I was trying out in django's python shell the get_object_or_404 method on a set of entries I created in the db.I created an entry with a DateTimeField called 'posted_time'.I used datetime.datetime.now as default value and it created Date:2010-02-01 Time:10:02:22 I also created many other such e

uniquely identifying an entry

2010-02-04 Thread harryos
hi (sorry about this newbie question..) I have designed an entry and a category as follows. The entry doesn't have a title.(The user is not expected to provide a title for it )It is uniquely identified by a combination of its published datetime and the name of the category it belongs to. class M

getting dictionary values on template

2010-02-05 Thread harryos
hi I have a dictionary object passed to the template , from which I need to retrieve values mydata={} mydict['chemistry']=120 mydict['physics']=164 mydict['maths']=110 In my render_to_response I passed this object like return render_to_response("myapp/mydatapage.html", {'mydata_dict':mydata}) I

Re: getting dictionary values on template

2010-02-05 Thread harryos
thanks Javier..will read the docs .. > why so harsh to a newbie? that link doesn't help the question, > {{mydata_dict.key}} won't help, since 'key' here is also a variable. > > the answer is: > > {% for key, value in mydata_dict.items %} > {{key}} = {{ value }} > {% endfor %} > > and is documen

notification in python

2010-09-27 Thread harryos
hi Is there an opensource notification utility in python/django?I mean, something I can use to know when a website updates a page? If someone knows about one,please let me know thanks harry -- You received this message because you are subscribed to the Google Groups "Django users" group. To post

Re: notification in python

2010-09-27 Thread harryos
thanks for the pointer I am trying to get something similar to changedetection but with hourly updates. I need to get updates from a number of sites..So I was wondering how to implement an updating utility harry On Sep 27, 9:16 pm, Shawn Milochik wrote: > If you're asking for functionality like

Re: notification in python

2010-09-28 Thread harryos
> You could also try looking at the HTTP headers for a request for e.g. > "index.htm" using urllib. Specifically the "Expires" and "Last-Modified". > Using headers values requires that you can trust the site on the header > content. Web servers and caching proxies can do all sorts of things with

Re: notification in python

2010-09-28 Thread harryos
hi Erik that was food for thought..content length may not work if substitutions leave length unchanged.. Will look into L distance ..thanks for the suggestion regards harry > Content length (which you could also get using the HTTP header "Content > Length") won't necessarily tell you if content h

treating different versions of website urls as one

2010-10-05 Thread harryos
hi I am trying out a web app where it needs to process user given website addresses .My problem is that ,I need to treat http://mysite.com , www.mysite.com, mysite.com, www.mysite.com/index.html, www.mysite.com/index.php ...etc as the same and not different urls.How can I do the validation in this

Re: treating different versions of website urls as one

2010-10-05 Thread harryos
The user can enter a website address which will be tracked by the program for certain info and then a message is sent to the user's mail.The user can enter many such addresses.The problem is that he may accidently enter different variations of the url..and if I don't validate it for duplicates ,th

how to prevent different instances with same state

2010-10-09 Thread harryos
I have a model called Tracker that has a User and a url .I need User- url combination to be unique.So I made classTracker(models.Model): url=models.URLField() owner=models.ForeignKey(User) class Meta: unique_together = (("owner", "url"),) Now,I need to create a TrackingUtili

Re: trouble creating first project

2010-10-11 Thread harryos
do you have django_settings_module set?if so you will get this error http://code.djangoproject.com/ticket/11980 otherwise it is a path problem HTH harry On Oct 11, 6:47 am, Phil wrote: > Hi, > > I am having trouble creating my first project. I am running the latest > version of Ubuntu and I inst

Re: how to add login info while opening url

2010-10-12 Thread harryos
mm..I tried that..it gives 403 error.. I don't think putting login info in request will help..that will work only for 401 I believe.. not sure how to handle 403 from server..Any comments guys? harry On Oct 12, 6:19 pm, jimgardener wrote: > hi > I was trying to get data from different web pages u

implementing login in application,gets ValueError

2010-02-09 Thread harryos
I was trying to create login in my application .As per what is given in djangobook I created the login view as follows def login_view(request): if request.method=='POST': print 'login_view()::POST' username=request.POST['username'] password=r

how to redirect to 'next'

2010-02-09 Thread harryos
hi In my login_view I am redirecting to an archive page as below def login_view(request): if request.method=='POST': username=request.POST['username'] password=request.POST['password'] user = authenticate(username=username, password=password)

slug is not autogenerated in edit page

2010-02-10 Thread harryos
I was trying out forms and created a class and its form class MyCategory(models.Model): name=models.CharField(max_length=10) description=models.TextField(help_text='a description about the category') slug=models.SlugField(unique=True,help_text='will be auto generated from n

error check for start,end datetimes in model and form

2010-02-11 Thread harryos
hi I have an entry model and its modelform .The entry model has a start,end datetimes.I want to prevent the user from mistakenly entering an end datetime value which is before the start datetime.(ie, end=11feb2010 and start=12feb2010 is wrong).I tried to do the error check in an add_entry() view. I

error check for start ,end datetime values in view

2010-02-11 Thread harryos
hi I have an entry model and its modelform .The entry model has a start,end datetimes.I want to prevent the user from mistakenly entering an end datetime value which is before the start datetime.(ie, end=11feb2010 and start=12feb2010 is wrong).I tried to do the error check in an add_entry() view. I

converting month string

2010-02-15 Thread harryos
hi In my view I am taking user input string for month( like 'jan','feb') and want to search the db for objects with those months as published time. def entry_archive_for_month(request,year,month): entryset=Entry.objects.filter(pub_time__year=year,pub_time__month=month) obviously this will caus

how to set default value as current time in TimeField

2010-02-15 Thread harryos
hi I am using a TimeField and want to set the default value as current time.I know the field normalizes to a datetime.time object.In a DateField ,I can put (default=datetime.date.today) and this will set the current day .Similarly I tried (default=datetime.now().time) for TimeField ..and can get a

Re: how to set default value as current time in TimeField

2010-02-15 Thread harryos
thanks ,that worked.. any idea about calculating the duration? I can do a - between two datetime.datetime objects to get a timedelta.. but that doesn't work with datetime.time objects harry On Feb 16, 12:37 pm, Masklinn wrote: > Just wrap the thing in a `lambda` and you should be good to go:

how to populate a forms.Form from existing values.

2010-02-17 Thread harryos
hi I am learning the use of Forms and tried populating a form from an instance.Here I encountered a problem. I have a class Lecture which can belong to diff subjects.So I created a field 'subjects' in Lecture to be a ManyToManyField. For example, Lecture1 -data structures,algorithms Lecture2 -data

how to capture the exception

2010-02-24 Thread harryos
hi In my models save() method I want to check if an Article with same name already exists. class Article(Model): name=models.CharField(max_length = 1024, unique = True) def save(self): self.name=self.name.strip() if Article.objects.filter(name__iexact=self.name).count()!=0:

Re: how to capture the exception

2010-02-24 Thread harryos
sorry, missed while copying def save(self): self.name=self.name.strip() if (not self.pk): if Article.objects.filter(name__iexact=self.name).count()! =0: raise Exception('article exists..') this causes 500 error,and causes the traceback displayed on browser..h

checking size of dict or list in template

2010-03-02 Thread harryos
hi I am passing a dictionary to the template say, objects_status={obj1:True, obj2:False, obj3:True } In the template I want to show something like {%if not len(objects.status ) %} # just to clarify the purpose..I know len will not work No objects to show {% else %} Objects are: .show th

how to check size of a dict or list in template

2010-03-02 Thread harryos
hi I am passing a dictionary to the template say, objects_status={obj1:True, obj2:False, obj3:True } In the template I want to show something like {%if not len(objects_tatus ) %} # just to clarify the purpose..I know len will not work No objects to show {% else %} Objects are: . {%endi

Re: how to check size of a dict or list in template

2010-03-03 Thread harryos
> I would try with > >  {%if not  object_status.0 %} > hi thanks.That was quite new to me..can you tell me how that works? I also tried {% if not objects_status.items|length_is:"0" %} thanks harry -- You received this message because you are subscribed to the Google Groups "Django users" gr