Re: hstore support in postgis backend

2012-11-28 Thread Reiner Marquez
Hi Matt,

firstly, I would like mention that https://github.com/jordanm/django-hstore 
is not the most updated version.
My suggestion is to use https://github.com/aino/django-hstore (referenced 
at pypi http://pypi.python.org/pypi/django-hstore/1.1.1)

Now, as well you said, if you use the backend provided by django-hstore 
(django_hstore.postgresql_psycopg2), this will prevent you from dropping in 
other django extensions (postgis), unless you fork it and combine (hstore + 
postgis).

Affortunately, there is a work around 
(https://github.com/aino/django-hstore/pull/5). which should allow you have 
both postgres extensions at the same time

cheers!!


El miércoles, 28 de noviembre de 2012 05:12:14 UTC-5, Matthew Cooper 
escribió:
>
> Hi all
>
> We are using geodjango and postgis for a projects and I'm becoming more 
> and more impressed with Postgres and is GIS features.
>
> Specifically I want to use hstore fields in my models with projects like 
> https://github.com/jordanm/django-hstore
>
> These require you to use a modified backend though and while this works 
> fine for a standard Postgres DB it doesn't help if you want to use the 
> standard postgis backend.
>
> So I'm wondering what other people have done in this situation and maybe 
> whether the django postgis backend is going to have support for hstore 
> built in.
>
> I could start to merge them but would be interested in what others have 
> done first.
>
> Matt
>

-- 
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/-/a5NUWs8Q7m0J.
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: PostGIS 2.0.0 problems

2012-08-13 Thread Reiner Marquez
hey guys, take a look at this, it saved my live on today.

https://github.com/django/django/pull/249 

El lunes, 6 de agosto de 2012 10:28:50 UTC-5, Oleg Korsak escribió:
>
> Have you tried to create new project, then new app, then new model with 
> PointField(geography=False) and then run manage.py syncdb? Here must be a 
> problem :)
>
>
> суббота, 4 августа 2012 г., 8:59:34 UTC+3 пользователь Will 
> Tuladhar-Douglas написал:
>>
>> Folks,
>>
>> I just checked and I'm running Postgres 9.1 and Postgis 2.0SVN with 
>> GeoDjango (on Mac OSX 10.7.4) . I'm not doing anything very exciting with 
>> GeoDjango so far, so perhaps there are problems I haven't encountered, but 
>> it does run, and it is possible to encode locations using the GeoDjango ORM 
>> features. I didn't do anything special for Django (1.4.1) or GeoDjango, but 
>> setting up PostGis does need to be done right, and the special version of 
>> psycopgsl is required - all of that is well documented, though.
>>
>> -WBTD.
>>
>>
>>
>> On 4 Aug 2012, at 04:24, Oleg Korsak wrote:
>>
>> looks like GeoDjango is dead, it is not solved for almost half of the year
>>
>> четверг, 19 июля 2012 г., 21:23:03 UTC+3 пользователь Dominique Guardiola 
>> Falco написал:
>>>
>>>
>>> Is there a tutorial describing how to do this somewhere please ?
>>> Because right now, geodjango is unusable with PostGreSQL 9 + PostGIS 2
>>>
>>
>> -- 
>> 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/-/mmBsv7nuDvoJ.
>> 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.
>>
>>
>>
>>
>> - - -- --- -  -
>> Will Tuladhar-Douglas 
>> Anthropology ∙ Environments ∙ Religions
>> Wellcome Trust  Research Fellow, Nepal, 
>> 2011-12.
>> Visiting Scientist, ICIMOD  SL/PR group.
>> tending.to/garden
>>  
>>

-- 
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/-/Xd_it9vgmQYJ.
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: Add message each page load

2010-04-02 Thread Reiner
Are you using the develoment server? Is your static media served by
django? If yes, I guess that your middleware might be called several
times each page load, for every image/js/css etc.

On Mar 31, 1:54 am, Wiiboy  wrote:
> >  - have you enabled the messages' context processor?
> Yes
> >  - are you consuming the 'messages' variable in your templates?
>
> UmmYes?  I'm displaying one message, but only 1, since I'm only
> setting 1 per request.
>
> That's probably the issue, but why is more than one message being set
> per request, or, if there is only one, why is it not being cleared?

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



Re: Caching template fragments without specifying expiration time

2009-08-03 Thread Reiner

Be aware that the way the cache key is constructed changed a bit. I'm
also invalidating template fragments when models used for rendering
changed, and found this while randomly reading changesets:

It used to be: fragment_name:additional:arguments:seperated:by:colons
Now it is: template.cache.fragment_name.args where args is md5
(additional:arguments:seperated:by:colons)

http://code.djangoproject.com/changeset?new=django%2Ftrunk%2Fdjango%2Ftemplatetags%2Fcache.py%4011068=django%2Ftrunk%2Fdjango%2Ftemplatetags%2Fcache.py%408533

On Aug 2, 10:25 am, Nick Fishman  wrote:
> I was wondering if it's possible to not specify the expiration time when
> using the {% cache %} tag to cache template fragments. With the low-level
> API, cache entries will expire after a timeout configured in CACHE_BACKEND.
> Is it possible to use the same default when caching template fragments?
>
> In particular, I'd like to use model signals to invalidate cache entries.
> That way, entries won't be invalidated after an arbitrary time period, but
> rather when they're actually invalid. Nathaniel Whiteinge wrote on
> 2008-12-03 that the {% cache %} tag creates entries with keys
> "fragment_name:additional:arguments:seperated:by:colons", so this seems
> possible.
>
> Any thoughts?
>
> Nick
--~--~-~--~~~---~--~~
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: Template tags as parameter to template tag

2009-07-21 Thread Reiner

Maybe I'm missing something here, but what is wrong with this?

{% tag_link tag.name %}

The string "tag.name" gets passed to your template tag, you resolve it
against the current context when rendering it, and then you have the
value and can do whatever you want with it. See [1] for reference.

[1] 
http://docs.djangoproject.com/en/dev/howto/custom-template-tags/#passing-template-variables-to-the-tag

On Jul 20, 7:33 pm, phoebebright  wrote:
> Is there a way to get this to work:
>
>             {% for tag in tags %}
>                 {% tag_link
> "{{tag.name}}" %}
>             {% endfor %}
>
> The outer loop is using the standard tagging application and the
> tag_link is my custom template tag which has a different url depending
> on the type of tag.
> I don't really want to amend the tagging app, so what is the correct
> way of doing this.  Extending the template tag class?
--~--~-~--~~~---~--~~
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-registration .missing templates?

2009-07-20 Thread Reiner

The documentation states that you need to write these templates
yourself, no examples are included with the package.

http://bitbucket.org/ubernostrum/django-registration/src/tip/docs/overview.txt#cl-161

On Jul 19, 7:26 pm, Asinox  wrote:
> ok,  ...there no exist's
>
> :(
--~--~-~--~~~---~--~~
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: Reusable Contact Form include error?

2009-07-02 Thread Reiner

That might be trivial, but you didn't show more views, so - do you add
a form instance to the template context in every view?

On Jul 2, 6:35 pm, 1angrycats 
wrote:
> Hi everyone, long time lurker, first time botherer.
>
> I hope someone here can help me out (& possibly a few other Django
> n00bs in the future too).
>
> I've dug around as best I can but can't find a - probably simple -
> solution to an issue I'm having. I've created a simple contact form as
> described here:http://www.djangobook.com/en/2.0/chapter07/but I've
> extended it slightly by using an include on the form to pull it in to
> multiple templates.
>
> & it works great for the /contact/ URL, but won't return the form
> fields on any other views. Here's the code:
>
> /contact/forms.py --
> from django import forms
>
> class ContactForm(forms.Form):
>         subject = forms.CharField(max_length=250)
>         email = forms.EmailField(required=False, label='Your e-mail address')
>         message = forms.CharField(widget=forms.Textarea)
>
> /contact/views.py --
> from django.shortcuts import render_to_response
> from website.contact.forms import ContactForm
> from django.core.mail import send_mail
> from django.http import HttpResponseRedirect
>
> def contact(request):
>         if request.method == 'POST':
>                 form = ContactForm(request.POST)
>                 if form.is_valid():
>                         cd = form.cleaned_data
>                         send_mail(
>                                 cd['subject'],
>                                 cd['message'],
>                                 cd.get('email', 'nore...@queryclick.com'),
>                                 ['cont...@queryclick.com'],
>                         )
>                         return HttpResponseRedirect('/contact/thanks/')
>         else:
>                 form = ContactForm(
>                         initial={'subject': 'Get in touch!'}
>                 )
>         return render_to_response('contact/contact.html', {'form': form})
>
> urls.py --
> from django.conf.urls.defaults import *
> from website.contact.views import contact
> from website.views import subdomain_homepage, qc_contact
>
> # Enables Django Admin.
> from django.contrib import admin
> admin.autodiscover()
>
> urlpatterns = patterns('',
>         (r'^admin/doc/', include('django.contrib.admindocs.urls')),
>         (r'^admin/(.*)', admin.site.root),
>         (r'^accounts/', include('registration.urls')),#Django Registration
> URLs
>         (r'^$', subdomain_homepage),#Subdomain Homepages
>         (r'^contact/$', contact),#Contact Form
> )
>
> & root views.py --
> from django.shortcuts import render_to_response
> from django.contrib.sites.models import Site
> from django.core.mail import send_mail
>
> ...
>
> def qc_contact(request):
>         return render_to_response('contact/contact.html', locals())
>
> I use an include: {% include "contact/contact_snippet.html" %} in
> contact.html and when I go to /contact/ it works perfectly, but
> whenever I use the include on other templates the form doesn't show.
>
> Any ideas on the blindingly obvious that I'm missing?
>
> 1angrycats
--~--~-~--~~~---~--~~
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: FileField can't re-display invalid form with File upload widget filled-in?

2009-06-24 Thread Reiner

I doubt that this is possible, looks like a security risk if you can
select files from the clients pc arbitrary to be uploaded. If that
would be possible, a malicious website could embed a  in its code, preselect a file from the clients pc, and
hide that element with CSS. Most users probably wouldn't notice.

Adding to this I doubt you can reconstruct the full path of the
uploaded file, all you get is the filename for what I know.

On Jun 24, 10:34 pm, Chris Shenton  wrote:
> I've got an app that wants a file upload and some other attributes.  
> If the user fills in the file but has problems with the other  
> attributes, it should re-present the form with the attributes filled  
> with his values, including the name of the file that he selects. In  
> use the example below doesn't re-populate the file upload widget.  Is  
> this possible?
>
>
>
> > class FileDemoForm(forms.Form):
> >     """Require another field so we can show populated file0 not  
> > being bound"""
> >     file0   = forms.FileField()
> >     another = forms.CharField()
>
> > def file_demo(request):
> >     """The bound form is *not* populated with request.FILES info for  
> > file0"""
> >     if request.method == "POST":
> >         form = FileDemoForm(request.POST, request.FILES)
> >         print >> stderr, "### file_demo incoming bound POST form=\n
> > %s" % (form,)
> >         if form.is_valid():
> >             return HttpResponseRedirect("/")
> >     else:
> >         form = FileDemoForm()
> >     print >> stderr, "### file_demo returning form=\n%s" % (form,)
> >     return render_to_response('filedrop/file_create.html', {'form':  
> > form})
>
> The incoming form bound with request.FILES and request.POST doesn't  
> show any filename in the widget:
>
> > ### file_demo incoming bound POST form=
> > File0: > type="file" name="file0" id="id_file0" />
> > Another: > class="errorlist">This field is required. > type="text" name="another" id="id_another" />
>
> The W3C spec suggests that  should be able to take  
> a "defaultValue" or "value" attributes but I can't make that work even  
> with hand-written HTML outside of Django.  It also suggests browsers  
> should allow multiple file selection in their input widgets but I've  
> not seen this implemented before.
>
> So is it possible to re-populate a 'file' input widget with the user's  
> selection on a failed form?
>
> Thanks.
--~--~-~--~~~---~--~~
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: include behavior

2009-06-21 Thread Reiner

For 2.:

I didn't try it, but if you're putting the path in quotes, include
tries to import it by itself, but there is no module named admin. It
is django.contrib.admin. admin.site.urls without quotes works, because
you probably allready imported it, e.g. to use admin.autodiscover().
That's the reason why play_django without quote doesn't work - that
module is not known to the code, putting it into quotes puts django
into the responsibility to load the appropriate module.

On Jun 21, 3:17 am, tekion  wrote:
> All,
> I noticed that putting single quote around include argument makes a
> different, for example:
>  (r'^admin/', include(admin.site.urls)),
>  (r'^polls/', include('play_django.polls.urls')),
> works.  Where as:
>  (r'^admin/', include(admin.site.urls)),
>  (r'^polls/', include(play_django.polls.urls)),
>
> yield this error:
> NameError at /polls/
>
> name 'play_django' is not defined
>
> Request Method:         GET
> Request URL:    http://127.0.0.1:8000/polls/
> Exception Type:         NameError
> Exception Value:
>
> name 'play_django' is not defined
>
> Two question:
> 1. why putting single quotes works, no NameError was thrown for
> play_django.
> 2. why admin.site.urls works without quote and putting quote around it
> doesn't, this is an inconsistency that really bothers me.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Accessing tables not created by django models using django APIs.

2009-05-26 Thread Reiner

I don't want to sound rude, I'm just curious, why do you need multiple
tables with the same schema, but different names, in the first place?

On May 26, 1:17 pm, ds99  wrote:
> No that table name will be different every time based on some id. If
> table name is same then there is no problem but the issue arises when
> table names are different but the schema is same.
>
> On May 26, 3:51 pm, Ankit  wrote:
>
> > ds99 wrote:
> > > Hi Ankit,
> > > I got what you are saying. I'll tell you what I want to do.
>
> > > For eg: For one request one process creates table called "books_111"
> > > and after its purpose is done, whole table will be dropped. It may
> > > also happen that while this table is being worked upon, another table
> > > with same schema is created for another request. Now to access this
> > > table using django APIs, i need to have latest snapshot of the
> > > database,i.e, updated model file. For that again we need to fire
> > > "python manage.py inspectdb" to create missing models. Is there any
> > > other way to do it on the fly?
>
> > > Thanks,
> > > ds99
>
> > > On May 26, 3:11 pm, Ankit  wrote:
>
> > >> ds99 wrote:
>
> > >>> Hi Alex,
> > >>> Thanks a lot or quick reply. A couple of queries below:
>
> > >>> 1) How can this be handled when the tables are created dynamically?
> > >>> Actually the tables will be created dynamically by some other process
> > >>> and will be deleted after its purpose is over. So is there any other
> > >>> way or we need to call python script with inspectdb everytime we get a
> > >>> new request?
>
> > >>> 2) This is possible for only one database as it would inspect database
> > >>> pointed by DATABASE_NAME setting and create models. Can this be done
> > >>> if we have one database per session?
>
> > >>> Thanks again,
> > >>> ds99
>
> > >>> On May 26, 8:13 am, Alex Gaynor  wrote:
>
> >  On Mon, May 25, 2009 at 10:07 PM, ds99  wrote:
>
> > > Hi,
> > > I am new to django.I have a requirement where in have to access tables
> > > which are not created using django models, using django APIs.
>
> > > For eg: I already have tables "book_111" and "book_222" created in
> > > sqlite db by some different process. Both having same schema.I want to
> > > access them to retrieve records using django database APIs. How can i
> > > do that?
> > > Do i need to add their schema in models.py? Can one model be used to
> > > refer to multiple tables in database?
>
> > > Please let me know.
>
> > > Thanks,
> > > ds99
>
> >  Yes, you can use those models with django, you'll need to create Model
> >  classes for them 
> >  though,http://docs.djangoproject.com/en/dev/ref/django-admin/#inspectdbcanas...
> >  with this task.  No one model can't be used to refer to multiple 
> >  tables.
>
> >  Alex
>
> >  --
> >  "I disapprove of what you say, but I will defend to the death your 
> >  right to
> >  say it." --Voltaire
> >  "The people's good is the highest law."--Cicero
>
> > >>> .
>
> > >> hi
>
> > >>     If there is table in the database you are connected to django will
> > >> not create a new one.If you are using django1.1 you can manually set
> > >> whether to create a table or not in the db(manged option in class
> > >> meta).Is complete table is being drop or only the data is being
> > >> deleted.what you to do with these tables.Explanation is required.
>
> > > .
>
> > See first of all table name will be same.Django displays latest data of
> > the table only.If the table content has been changed then it will the
> > latest one but the schema of the table should be same as
> > before.According to you a table is created on request by some thing for
> > that you can have a cron that will change the content of the table after
> > specific time so that your work is not intrupt.
>
>
--~--~-~--~~~---~--~~
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: reset button question

2009-05-24 Thread Reiner

I can't think of any reason why it shouldn't work, so I think their
might be a problem in your code. Could you some snippet of the
relevant html code?

On May 24, 3:38 pm, Bobby Roberts  wrote:
> i'm trying to put a simple reset button on a form but it's not
> working  Why wouldn't a standard html reset button be working?
--~--~-~--~~~---~--~~
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 load data?

2009-05-23 Thread Reiner

Fields seperated with \t sounds a bit like a CSV export right? I
needed to import CSV too, so I used the csv module to parse the file
and then django models to store it in the database, no custom sql
needed.

# set up django environment
[ ... ]
import csv
reader = csv.reader(open('file.csv', 'r'), delimiter=r'\t',
quotechar='"')
for row in reader:
   myapp.mymodel.objects.create(
  pk=row[0],
  title=row[1],
  ...
   )

On May 23, 4:04 am, Herta  wrote:
> The input file is a plain txt file with \t, I just want to know if
> there is a function to import data from the existing file, if i don't
> write a script with a sql='insert into table values(...) '
>
> On May 23, 8:43 am, George Song  wrote:
>
> > On 5/22/2009 5:07 PM, Herta wrote:
>
> > > I want to load data to database (sqlite3 ) from file. I have already
> > > connect django and my database, and build the tables but how can i
> > > load data from file?
>
> > What kind of files are these? If they are existing legacy data files,
> > you'll have to write some sort of de-serializer to translate them to fit
> > your model(s).
>
> > If the file happens to be one of the serialization formats that Django
> > already knows how to deal with, you might be able to use Django's
> > serialization somehow.
>
> > But some more specifics on your data format will allow us to help you more.
>
> > --
> > George
--~--~-~--~~~---~--~~
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: adding errors to forms

2009-05-23 Thread Reiner

I think the errors attribute needs to be a list (hence the name), so
try:

form._errors['name'].append('User name already in use')

I think errors is not only a list, but an instance of
django.forms.utils.ErrorList (or any subclass of it), which controls
the way errors are displayed in the form, as noted here:
http://docs.djangoproject.com/en/dev/ref/forms/api/#customizing-the-error-list-format
Now that I had a look at the source, there is an ErrorDict too, not
sure what gets used when, but it should be irrelevant to your problem.

Regards,
Reiner

On May 22, 10:42 pm, CrabbyPete <pete.do...@gmail.com> wrote:
> If I have a form and  if  form.is_valid is False
>
> The code code in the template {{ form.name.errors}} formats the error
> like this.
> This field is required.
>
> How do you add an error so it gets formatted with the surrounding
> html. If a user name already exists I want to add the error message
> 'User name already in use'
>
> I tried form._errors[name] = 'User name already in use' and
> {{form.name.errors}} just prints the string.
--~--~-~--~~~---~--~~
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: models unique_for_date

2009-05-19 Thread Reiner

Hey,

most of the options on a ModelAdmin control the display of your model,
and how you interact with it, in the admin site. What fields you want
to show in the table (list_display), how many objects per page
(list_per_page) and so on:

ModelAdmin options: 
http://docs.djangoproject.com/en/dev/ref/contrib/admin/#modeladmin-options

Whereas fields options in your Model let you further define your
model's specification. You already define what fields your model
consists of, and with unique_for_date you add another constraint to
your model field. It may be enforced on the admin form level, but I
think the only reason for this is, that enforcing it on the database
level is actually not possible, or not reasonable - and maybe it will
be enforced on the database level some day.

Field options on models: 
http://docs.djangoproject.com/en/dev/ref/models/fields/#field-options

So think of the ModelAdmin options as a mean to control (mostly)
display and interaction with the model, and field options as further
constraints to your model. You want your model specification to be in
only one place, and that would be in the model itself.

Regards,
Reiner

On May 19, 2:19 am, Mohan Parthasarathy <surut...@gmail.com> wrote:
> Hi,
>
> I can see that Models don't use the inner class to define the options, so I
> used
>
> class EntryAdmin(admin.ModelAdmin):
>         prepopulated_fields = {'slug' : ('title',)}
>
> How do I use unique_for_date here ? Is there a place where all the options
> are listed for this new style interface ?
>
> I can see that unique_for_date works when added to the field directly which
> confuses me as I thought anything to do with admin interfaces
> (unique_for_date is controlled at the admin level and not at database level
> ?) is specified separately. What am i missing ?
>
> -mohan
--~--~-~--~~~---~--~~
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: Display an URLField as a Link

2009-05-12 Thread Reiner

Initially I thought you were talking about the admin, because of the
column url you mentioned. If that's the case, have a look at this part
of the documentation. You can define a property on your model, or if
you just want the admin to display it as a link, use a module-level
function or define it on your modeladmin. There are multiple ways of
accomplishing this.

http://docs.djangoproject.com/en/dev/ref/contrib/admin/#django.contrib.admin.ModelAdmin.list_display

On May 8, 9:26 pm, Tom  wrote:
> My model :
>
> url = models.URLField(max_length=500,blank=True,verify_exists=False)
>
> and I want the column url display url as a link ()
>
> Any ideas ?
>
> Thanks for your help.
--~--~-~--~~~---~--~~
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: dev server vs. real server oddity

2009-04-04 Thread Reiner

This is intended behavior and documented in the generic view
documentation here: 
http://docs.djangoproject.com/en/dev/ref/generic-views/#django-views-generic-date-based-archive-year
It states that this view raises a 404, when the queryset is empty, so
the resulting page basically is considered empty and therefore a 404
error is appropriate.

You need to take the optional argument 'allow_empty' into
consideration, I quote from the docs:

"allow_empty: A boolean specifying whether to display the page if no
objects are available. If this is False and no objects are available,
the view will raise a 404 instead of displaying an empty page. By
default, this is False."

So you might want to use allow_empty=True in your view to prevent
raising 404s on empty querysets.

Regards,
Reiner

On Apr 4, 4:20 pm, dls <daniel.si...@gmail.com> wrote:
> Ok, it turns out that the "archive year" generic view throws a 404
> error if the querset commands result in an empty set. Through testing
> I discovered that my development server database works fine because
> the queryset returns values, but the live database throws a 404
> because it returns with an empty set. This is very strange because the
> live database is nothing more than the development db with more
> information in the fields - I don't see any reason why one should
> error out and not the other.
>
> For testing, I called these commands on both databases:
>
> key:
> 1 = development database (small, not many records)
> 2 = live database (larger, but still not huge - should be identical to
> the dev db)
>
> > python manage.py dbshell
> > select * from blog_post;
>
> results:
> db1: three blog entries are returned
> db2: seven blog entries are returned (as I have added four)
>
> > python manage.py shell
> > from blog.models import Post
> > temp = Post.objects.all()
> > temp #just to print
>
> results:
> db1: three blog entries are returned
> db2: an empty set [] is returned
>
> I understand that objects.all() is the same as "select * from
> blog_post", so the fact that one works while the other does not is
> further confusing.
>
> I would upload the databases, but google groups doesn't seem to
> provide that functionality. Any suggestions as to where I can upload
> files temporarily?
>
> Thanks!
>
> -dls
--~--~-~--~~~---~--~~
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: Cannot reverse inside urls.py

2009-04-03 Thread Reiner

I'm not sure if reversing inside the url patterns is possible (but I
kinda doubt it), but maybe I can help out with a different, and
probably better, solution. It seems you only want to use the URL to
your add_item_wizard function inside your message.html template. Then
you could use the builtin url template tag to do the same thing.

For example:
Link

Look here for more information on this tag:
http://docs.djangoproject.com/en/dev/ref/templates/builtins/#url

If you need the URL multiple times in your template, you can use this
(as mentioned in the docs):

{% url add_item_wizard as the_url %}
I'm linking to {{ the_url }}

This way you don't need to pass the URL in your extra_context.

Regards,
Reiner

On Apr 3, 10:24 am, robin <robinc...@gmail.com> wrote:
> It seems like you cannot use reverse within urls.py
>
>   url(r'^add/$','items.views.add_item_wizard',name='add_item_wizard'),
>
>   url(r'^add/complete/
> $','django.views.generic.simple.direct_to_template',{
>       'template':'message.html',
>       'extra_context':{
>           'title': 'Add Item Complete',
>           'url': reverse('add_item_wizard'),
>       }
>   }, name='add_item_complete'),
>
> Is there no way?
>
> Thanks in advance,
> Robin
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Using

2009-03-18 Thread Reiner

If the visitor should stay on the same page, you can leave out the url
and only specify the anchor in href.

 ... 

The "problem" you've been facing here, probably is caused by the
APPEND_SLASH setting, enforced by the CommonMiddleWare I think. It's
used to ensure that a page has one, and only one, URL. www.example.com/blog
and www.example.com/blog/ deliver the same content, but the URL is
different. Therefore, incoming requests without a slash at the end are
redirected by the middleware.

So you *always* end up with a url like http://example.com/myproj/mypage/,
and therefore http://example.com/myproj/mypage#top was redirected
first. You better only specify the anchor, that way you don't have to
care about the page's URL at all.

Regards,
Reiner

On Mar 18, 4:59 pm, NoviceSortOf <dljonsson2...@gmail.com> wrote:
> Thanks for the answer...
>
> Looking closer and testing direct on the URL Navigation bar using cut
> and paste figured out the following
>
> A slash "/" between mypage/#top makes all the difference.
>
> * this will reload the page, and go to the 
> anchor.http://127.0.0.1:8000/myproj/mypage#top
>
> *this will just jump to the  anchor...http://127.0.0.1:8000/myproj/mypage/#top
--~--~-~--~~~---~--~~
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 first app doubt

2009-03-18 Thread Reiner

I haven't read the tutorials in a while, but shouldn't it be
http://localhost:8000/admin/ instead of http://localhost:8000/*polls/*admin/
?

Regards,
Reiner

On Mar 17, 6:53 pm, Gustavo Senise <gustavosen...@gmail.com> wrote:
> Hello fellows,
>
> I am starting the django first app and I am having a little trouble trying
> to understand why the admin area is not working after I changed the views to
> the Generic Views. Well, I can't access the admin area anymore.
>
> It seems that the tutorial doesn't cover the url for admin after splitting
> the url file.
>
> I am trying to accesshttp://localhost:8000/polls/admin/and getting a error
> 'MediaDefiningClass' object is not iterable.
>
> Can anyone help!?
>
> Thanks,
> --
> Gustavo
--~--~-~--~~~---~--~~
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 and SEO activities

2009-03-09 Thread Reiner

Additionally django comes with a sitemap application in
contrib.sitemaps.
See http://docs.djangoproject.com/en/dev/ref/contrib/sitemaps/ for
more information.

This should make indexing your website a lot easier for bots, you can
even ask google for reindexing when your sitemap changes for example
(http://docs.djangoproject.com/en/dev/ref/contrib/sitemaps/#pinging-
google).


On Mar 9, 9:57 am, "adam.abbo...@gmail.com" 
wrote:
> Hi,
>
> I'm currently looking at developing a major project in Django. I'll be
> working with a team (2) developers on the project, however I wanted to
> get an idea for how search engine friendly Django is? I'm really not
> too sure about Django and hence I need advice.
>
> Thanks for your time.
--~--~-~--~~~---~--~~
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 create such a model?

2009-03-09 Thread Reiner

Hi,

have a look at the documentation of field options in models:
http://docs.djangoproject.com/en/dev/ref/models/fields/#blank

class Foo(models.Model):
this_is_required = models.CharField(...)
this_not = models.CharField(..., blank=True)

Regards,
Reiner

On Mar 9, 8:37 am, khsing <khsing...@gmail.com> wrote:
> I want create a model that contain two field and there is one of two
> field can not be blank.
>
> how to do it?
>
> thanks.
>
> --
> A man live in jail and want to break.http://blog.khsing.net
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---