Re: comparisons with java framework

2009-02-13 Thread denis

Part of Igor's problem is the Avalanche effect:
"... I need to install one more tool ... requires some
dependencies ..."

Avalanches can of course rumble rumble ... in installing or learning
anything at all,
not just Django.  Two kinds of Avalanches:

a) what do I need to install ?
b) what do I need to know, e.g. basics of make ... ?

a) is helped by a project's doc and friendly attitude (Django ++),
plus the package installer: can it list dependencies, their
dependencies ...
before I start ?  Too few packages have Avalanche alerts or even
reliable metadata --
fwiw only 230 of 5372 PyPI packages have "requires" in release_data.

b) is harder  :~

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



Inheriting attributes from a model

2009-04-01 Thread Denis

I am developing a store using Satchmo, and I want the ability to save
quotes; that's snapshots of the current cart, and I want to store the
history of all the quotes in the database. My current models look like
this:

class QuoteItem(models.Model, Product):
quantity = models.PositiveIntegerField(_('Quantity'))
price_incl_vat = models.DecimalField(_("Price incl. VAT"),
max_digits=10, decimal_places=2)

class Quote(models.Model):
items = models.ManyToManyField('QuoteItem')

In Django my inherited Product class is represented as a foreign key
in the QuoteItem table. The problem is that the product price is
subject to change in the future, but the Quote shouldn't change.
I want a copy of the product attributes in QuoteItem, instead of a
foreign key.
Is there a clean way to do, or do I have to copy all the attributes
here manually?

--~--~-~--~~~---~--~~
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: Inheriting attributes from a model

2009-04-01 Thread Denis

Now I've got serialization to json working thanks to your advice.
I still have problems with converting the data back into an object,
but I don't have time to look into that now. It'll have to wait
tomorrow.

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: Inheriting attributes from a model

2009-04-02 Thread Denis

Thanks! Problem solved, here's how to do it:

class QuoteItemManager(models.Manager):
def from_product(self, product):
i = QuoteItem(current_product=product)
i.product_serialized = serializers.serialize('json',
Product.objects.filter(id=product.id))
try:
i.productinfo_serialized = serializers.serialize('json',
product.productinfo_set.all())
except ProductInfo.DoesNotExist:
i.productinfo_serialized = ''
return i

def to_product(self, quoteitem):
p = serializers.deserialize('json',
quoteitem.product_serialized).next().object
if quoteitem.productinfo_serialized != '':
p.productinfo_set.add(serializers.deserialize('json',
quoteitem.productinfo_serialized).next().object)
return p
QuoteItem.objects = QuoteItemManager()
--~--~-~--~~~---~--~~
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: Postgresql duplicate keys and django problem

2006-10-18 Thread Denis

This can be done using following command sequence:

manage.py sqlsequencereset  | psql 

It sets counters to the max value of serial field of every model in
your app.


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~--~~~~--~~--~--~---



Error in db/models/related.py

2006-09-04 Thread Denis

Hello all,

Sorry to come with a problem for you...

I get an error in the admin views (show and add object, at least),
saying :

  AttributeError at /admin/addressbook/city/1/
  'bool' object has no attribute 'get'
  Request Method:   GET
  Request URL:  http://localhost:8000/admin/addressbook/city/1/
  Exception Type:   AttributeError
  Exception Value:  'bool' object has no attribute 'get'
  Exception Location:
/usr/local/lib/python2.4/site-packages/django/db/models/related.py in
get_manipulator_fields, line 116

and in the traceback :

  django/db/models/related.py in get_manipulator_fields
   109. count = self.field.rel.num_in_admin
   110. else:
   111. count = 1
   112.
   113. fields = []
   114. for i in range(count):
   115. for f in self.opts.fields + self.opts.many_to_many:
   116. if follow.get(f.name, False): ...
   117. etc

Looking at the local vars :
attr : 
change : True
count : 1
f : 
fields : []
follow : True
i : 0
manipulator : 
opts : 
self : 

So, it seems that I have a var named "follow" that's set to True and
the code tries to call a get method on it...

Is it an error due to my model's class Admin or (do I dare to say so ?)
a bug somewhere ? (The code is a brand new check out from the svn)
Can an expert help me in debugging it ?
Which other info would you need ?

Thanks in advance for your help.

Regards,

Denis


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~--~~~~--~~--~--~---



ImageField/FileField in M/R

2006-04-20 Thread Denis

Hi

It looks like old files aren't being removed after object change.
That is, if i change the object like the 1 below and upload new file
via admin interface, old file remains in the directory, though nothing
refers to it :-/

class Picture(models.Model):
fullsize = models.ImageField(upload_to='%Y/%m/%d')
...


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~--~~~~--~~--~--~---



Re: ImageField/FileField in M/R

2006-04-20 Thread Denis

If so, then it (the file) shouldn't be deleted when you delete()
the object? Also, M/R branch seems has no methods like
_pre_save/_post_save,
instead you can subclass save/delete methods. There are some references
in db.models.signals, dont know how to use them though

Clint Ecker написав:
> This is correct.  I believe the general consensus is that the developer
> should take care of file destruction on their own.  Perhaps in a _pre_save
> method?
>
> Clint
>
> On 4/20/06, Denis <[EMAIL PROTECTED]> wrote:
> >
> >
> > Hi
> >
> > It looks like old files aren't being removed after object change.
> > That is, if i change the object like the 1 below and upload new file
> > via admin interface, old file remains in the directory, though nothing
> > refers to it :-/
> >
> > class Picture(models.Model):
> > fullsize = models.ImageField(upload_to='%Y/%m/%d')
> > ...
> >
> >
> > >
> >
>
>
> --
> ---
> Clint Ecker
> [EMAIL PROTECTED]
> http://phaedo.cx
>
> --=_Part_23578_25260128.1145537234619
> Content-Type: text/html; charset=ISO-8859-1
> Content-Transfer-Encoding: quoted-printable
> X-Google-AttachSize: 1359
>
> This is correct.  I believe the general consensus is that the developer 
> should take care of file destruction on their own.  Perhaps in a 
> _pre_save method?Clint On 
> 4/20/06, 
>
> Denis <mailto:[EMAIL PROTECTED]" target="_blank" 
> onclick="return top.js.OpenExtLink(window,event,this)">[EMAIL 
> PROTECTED]> wrote: style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; 
> padding-left: 1ex;">
>
> HiIt looks like old files aren't being removed after object 
> change.That is, if i change the object like the 1 below and upload new 
> filevia admin interface, old file remains in the directory, though nothing
> refers to it :-/class 
> Picture(models.Model):fullsize = 
> models.ImageField(upload_to='%Y/%m/%d')...  clear="all">-- ---Clint Eckermailto:[EMAIL 
> PROTECTED]" target="_blank" onclick="return 
> top.js.OpenExtLink(window,event,this)">[EMAIL PROTECTED] href="http://phaedo.cx"; target="_blank" onclick="return 
> top.js.OpenExtLink(window,event,this)">
> http://phaedo.cx
> 
> 
> --=_Part_23578_25260128.1145537234619--


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~--~~~~--~~--~--~---



Custom manipulator and file upload/saving

2006-05-03 Thread Denis

Hi

I wonder what would it be the best way to save the file while im using
custom manipulator.
It contains objects from several models and im saving everingthing in
manipulator.save().
Everything works great untill i have to save uploaded file. I wonder if
there is a way to save it
using django code? Ie, is there a way to reuse django code, which
stores file in MEDIA_ROOT
dir, uses 'upload_to' variable specified in model and makes file name
unique if needed.

thanks

--
Best regards


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~--~~~~--~~--~--~---



Re: Custom manipulator and file upload/saving

2006-05-03 Thread Denis

Thanks, that works!


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~--~~~~--~~--~--~---



[no subject]

2016-02-03 Thread Denis
Hi,

I'm looking at upgrading my application from 1.6 to 1.9.2... An issue I'm
encountering now is that on Heroku, running collectstatic doesn't work on
1.9.2. The odd  things is that if I try 1.8.7 instead, it work great...


Running:
remote: python manage.py collectstatic -i docs -i tests --noinput -v 3
remote: Copying '/app/accounts/static/...js'
remote: Copying '/app/accounts/static/js'
remote: Copying '/app/accounts/static/js'
... [ Thousands of lines... ]
remote: Found another file with the destination path
'app/controllers/...js'. It will be ignored since only the first
encountered file is collected. If this is not what you want, make sure
every static file has a unique path.
remote: Found another file with the destination path
'app/controllers/js'. It will be ignored since only the first
encountered file is collected. If this is not what you want, make sure
every static file has a unique path.
remote: Traceback (most recent call last):
remote: output = self.handle(*args, **options)
remote:   File
"/app/.heroku/python/lib/python2.7/site-packages/django/contrib/staticfiles/management/commands/collectstatic.py",
line 176, in handle
remote: collected = self.collect()
remote:   File
"/app/.heroku/python/lib/python2.7/site-packages/django/contrib/staticfiles/management/commands/collectstatic.py",
line 114, in collect
remote: level=1,
remote:   File
"/app/.heroku/python/lib/python2.7/site-packages/django/contrib/staticfiles/management/commands/collectstatic.py",
line 201, in log
remote: self.stdout.write(msg)
remote:   File
"/app/.heroku/python/lib/python2.7/site-packages/django/core/management/base.py",
line 111, in write
remote: self._out.write(force_str(style_func(msg)))
remote: IOError: [Errno 11] Resource temporarily unavailable


I do have a lot of static file... Unsure that matter.

An other things is that it doesn't seem to fail at the same point in the
collectstatic command every time I run it. So look like it's failing on
different file every time I run it...


I did find this: https://github.com/etianen/django-require/issues/20
But I actually don't use django-require... (It's not in my requirement.txt
of what I install on Heroku)


I also see it fail (sometime but much less often as the "Resource
temporarily unavaible" error this way:
remote: Found another file with the destination path 'accounts/..html'. It
will be ignored since only the first encountered file is collected. If this
is not what you want, make sure every static file has a unique path.
remote: Found another file with the destination path 'accounts/...js'. It
will be ignored since only the first encountered file is collected. If this
is not what you want, make sure every static file has a unique path.
remote: Traceback (most recent call last):
remote:   File "manage.py", line 10, in 
remote: execute_from_command_line(sys.argv)
remote: utility.execute()
remote: self.execute(*args, **cmd_options)

Which is even less helpful in figuring out what's going on...


So I'm looking for some though on what this error mean and how to debug it
further. We never encountered that error when on 1.6. Testing on 1.8.7
works fine but then if I only change the Django version (nothing else) to
1.9.2, I start getting that error...


Thanks everyone!

Denis Bellavance
Peach
Seattle

-- 
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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAOdjZ6K7j9Xv70%2BRYSBEdFom-VWRLMMy_e2CRZzfqmngA1ZBrw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Trivial question about instances forms

2008-09-03 Thread Denis Frère

On Sep 3, 12:52 pm, "Denis Frère" <[EMAIL PROTECTED]> wrote:
> Hello,
>
> It should be trivial to most of you...
>
> When I create an instance form, do I need to explicitely transfer the
> values of the fields that are not used in the form ?

Up ...

What's the good practice for this kind of thing ?

Is my question unclear ?

Is it difficult to answer to it ?

Could someone give me some clues to search for an answer ?

Thanks for your attention.

Denis
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Trivial question about instances forms

2008-09-03 Thread Denis Frère

Hello,

It should be trivial to most of you...

When I create an instance form, do I need to explicitely transfer the
values of the fields that are not used in the form ?
(I mean with "transfer" : copy the values from the instance before
editing to the instance after editing).


Here is an example :
I have a model named Person which owns a boolean field (named "active"
such as to deactivate a person without suppressing the record in the
db).

I use that view (partim) :

 def person_edit(request, person_name):
   person = Person.objects.get(name__iexact=person_name)
   personForm = forms.models.form_for_instance(person)
   if request.method == 'POST':
   form = personForm(request.POST)
   if form.is_valid():
   p = form.save()
   ...

I don't use the "active" field in my form template. When I edit a
record, the "active" field becomes false.

I would have expected that the values of non-used fields would have
been kept unchanged.

I read the docs but I see no mention of this (or I missed it). Where
would I find exhaustive docs about this behaviour ? (I know an answer
: in the code ..., but something for simple humans).

Thanks,

Denis

-- 
[EMAIL PROTECTED]

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Trivial question about instances forms

2008-09-03 Thread Denis Frère

On Sep 3, 4:21 pm, patrickk <[EMAIL PROTECTED]> wrote:
> you´re obviously using an older django-version. is there a (good)
> reason for not upgrading?

Yes there was ... I just svn updated my src directory and now :
- my website is all broken,
- my book (Sams Django in 24h) is full of obsolete things.

OK, I will have to correct all the bugs and buy a new book before
coming back on the list. ;-)

Anyway, thanks for your help.

Denis


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Problem installing django

2008-09-04 Thread Denis BUCHER

Hello !

I have a problem installing django. I followed the instructions but then :

# ./django-admin.py
Traceback (most recent call last):
   File "./django-admin.py", line 2, in ?
 from django.core import management
ImportError: No module named django.core


I am running SUSE Linux Enterprise 10

Thanks a lot in advance for your help !

Denis

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Apache httpd conf with mod_python

2008-09-09 Thread Denis Frère

On Sep 9, 8:33 pm, [EMAIL PROTECTED] wrote:
> guys, fixed it. apparently the issue was having it in /home/chris/
> I moved it to var/www/ and now it's working :) i knew it'd be
> something as simple as that.

I'm glad for you if everything works as you intended, but the problem
was certainly not having your project in your home directory.
I think it was a permission problem somewhere (e.g. www-data not being
able to read your home directory or something like that).

Anyway, have fun with Django.

Denis

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Stupid noob question - admin link

2008-09-09 Thread Denis Frère

On Sep 9, 8:16 pm, Peter Bailey <[EMAIL PROTECTED]> wrote:
> Can anyone tell me a easy way to add a hyperlink from the
> main admin page to somewhere else outside the admin app.

You should probably read :
http://docs.djangoproject.com/en/dev/ref/contrib/admin/#overriding-admin-templates

Summary : You could simply copy the file base_site.html from admin
templates to a directory called "admin" in your own template directory
and add a link to your own pages in {% block branding %} so you would
have access to the link on every admin page.

Have fun with Django.

Denis
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: UserProfile problem

2008-09-24 Thread Denis Morozov

Look at this post, it seems to be what you need:
http://pyxx.org/2008/08/18/how-to-extend-user-model-in-django-and-enable-new-fields-in-newforms-admin/

And you have to read comments to that page, where is some fix to the
code in the comments.

On Sep 24, 7:03 pm, Lars Stavholm <[EMAIL PROTECTED]> wrote:
> Running django-1.0 out of svn trunk, just updated today (9084).
>
> I've defined my UserProfile according to the latest documentation:
>
> class UserProfile(models.Model):
>      user  = models.ForeignKey(User, unique=True)
>      dep   = models.CharField("Department", max_length=20, blank=True)
>      phone = models.CharField(max_length=20, blank=True)
>      notes = models.TextField(blank=True)
>
> I've added the following to my settings.py:
>
> AUTH_PROFILE_MODULE = 'app.userprofile'
>
> But I still don't get any extra fields in the admin.
>
> What am I missing?
>
> Any input appreciated
> /Lars
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Problems with django.contrib.auth.views.login

2008-10-01 Thread Denis Morozov

Try
 {% if form.errors %}
 Your username and password didn't match.
 Please try again.
{% endif %}

On Oct 1, 10:53 pm, F Pighi <[EMAIL PROTECTED]> wrote:
> Hello folks, in these days I'm trying to learn a little bit of Django
> for an imminent project.
> I'm following the book titled "Learning website development with
> Django" by Packt, but I've got some problems at chapter 4 with the
> login process.
> The following is the url.py file:
>
> from django.conf.urls.defaults import *
> from bookmarks.views import *
>
> urlpatterns = patterns('',
>     (r'^$', main_page),
>     (r'^user/(\w+)/$', user_page),
>     (r'^login/$', 'django.contrib.auth.views.login'),
> )
>
> and this is the template registration/login.html:
> 
>         
>                 Django Bookmarks - User Login
>         
>         
>                 User Login
>                 {% if form.has_errors %}
>                         Your username and password didn't match.
>                         Please try again.
>                 {% endif %}
>                 
>                 Username:
>                         {{ form.username }}
>                 Password:
>                         {{ form.password }}
>                 
>                 
>                 
>         
> 
>
> The problem is that whenever i click on the Login submit button the
> browser makes a POST (Firefox want to save the username and password)
> but it then returns on the same page with the fields populated. It's
> like nothing happened.
>
> Anybody can help a n00b? :)
>
> Thank you in advance!
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Django documentation site is SLOW

2009-08-09 Thread Denis Cheremisov

I thinkg it's firefox issue - with google chromium, midori or opera
it's felt much faster.

On Aug 7, 3:46 pm, Jo  wrote:
> Surely can't only be me that finds the main Django site painfully
> slow? There is some javascript in there or something that just kills
> my browser.
>
> I'm using Firefox on Linux, on 1.5gig P4, OK not state of the art but
> it's fine for pretty much any other website, but when I try to look
> something up on the Django website, firefox jumps to 80% CPU and takes
> 10s of seconds to render each page, and even when the page is rendered
> the browser is so sluggish as to be almost unusable.
>
> Django might speed up development, but what it gives it takes away in
> time sitting waiting for the damn docs to load!
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Place two or more inputs per line in django admin.

2009-06-05 Thread Denis Cheremisov

I saw the method using fieldsets, by grouping several fields in a
tuple. But this method didn't suit my needs, because I use slightly
modified add_view,change_view,get_form, etc, where the base model/form
can be substituted by it's derivative. So, I don't know what fields to
show exactly, but know which fields I want to show in one line.
Thanks in advance.

--~--~-~--~~~---~--~~
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: Place two or more inputs per line in django admin.

2009-06-08 Thread Denis Cheremisov

Solved it, replace get_fieldsets with my custom function, returning:

[(None,
  {'fields': [('field1','field2),]})]

On Jun 5, 5:23 pm, Denis Cheremisov 
wrote:
> I saw the method using fieldsets, by grouping several fields in a
> tuple. But this method didn't suit my needs, because I use slightly
> modified add_view,change_view,get_form, etc, where the base model/form
> can be substituted by it's derivative. So, I don't know what fields to
> show exactly, but know which fields I want to show in one line.
> Thanks in advance.
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Problem with cookies and template

2009-10-10 Thread Denis Bahati
Hi all,
Am new to python and django but am facing aproblem with templates and login
the admin page.
1) I cannot login to admin page page because django keeps giving me a
message Look for your browser cofiguration to allow cookies but am sure my
browser allows all cookies.
2) Am using xampp 1.7.1 as webserver, django doesn't display its template.
Any idea for this.

--~--~-~--~~~---~--~~
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: Xampp and django

2009-10-11 Thread Denis Bahati
Thanx a lot for the information, but i managed to get it working before this
information.
I have another problem that the __unicode()__ is not working. It just gives
me Poll object instead of the name of data from the database, i put the
function at the beginning of the line, but if i put a tab to indent so that
it is read as the function of the poll, it gives me error. any idea?

On Sat, Oct 10, 2009 at 8:59 AM, Daniel Roseman wrote:

>
> On Oct 10, 3:43 pm, djbahati  wrote:
> > Hi All,
> > Am new to django,
> > am developing application but i face a problem in displaying template.
> > The browser does not display any template it just display plain text.
> > am using django 1.1 and xampp 1.7.1. Any idea?
>
> http://docs.djangoproject.com/en/dev/howto/static-files/
> --
> DR.
> >
>

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



__unicode__(self) doesn't work

2009-10-11 Thread Denis Bahati
Hi there i have the problem with unicode function it doesn't give me any
changes. the poll list is displayed as Poll object and does doesn't give me
error if i write the models.py like this:from django.db import models
import datetime

class Poll(models.Model):
question = models.CharField(max_length=200)
pub_date = models.DateTimeField('date published')
def __unicode__(self):
return self.question
def was_published_today(self):
return self.pub_date.date() == datetime.date.today()
def was_published_today(self):
return self.pub_date.date() == datetime.date.today()
was_published_today.short_description = 'Published today?'


class Choice(models.Model):
poll = models.ForeignKey(Poll)
choice = models.CharField(max_length=200)
votes = models.IntegerField()
def __unicode__(self):
return self.choice

If i change to the way below it give me the below below:

Environment: Request Method: GET Request URL:
http://localhost/testproject/admin/polls/poll/5/ Django Version: 1.1 Python
Version: 2.5.4 Installed Applications: ['django.contrib.auth',
'django.contrib.contenttypes', 'django.contrib.sessions',
'django.contrib.sites', 'django.contrib.admin', 'testproject.polls']
Installed Middleware: ('django.middleware.common.CommonMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware') Traceback: File
"C:\Python25\lib\site-packages\django\core\handlers\base.py" in get_response
83. request.path_info) File
"C:\Python25\lib\site-packages\django\core\urlresolvers.py" in resolve 216.
for pattern in self.url_patterns: File
"C:\Python25\lib\site-packages\django\core\urlresolvers.py" in
_get_url_patterns 245. patterns = getattr(self.urlconf_module,
"urlpatterns", self.urlconf_module) File
"C:\Python25\lib\site-packages\django\core\urlresolvers.py" in
_get_urlconf_module 240. self._urlconf_module =
import_module(self.urlconf_name) File
"C:\Python25\lib\site-packages\django\utils\importlib.py" in import_module
35. __import__(name) File "C:/xampp/htdocs\testproject\urls.py" in 
5. admin.autodiscover() File
"C:\Python25\lib\site-packages\django\contrib\admin\__init__.py" in
autodiscover 56. import_module("%s.admin" % app) File
"C:\Python25\lib\site-packages\django\utils\importlib.py" in import_module
35. __import__(name) File
"C:\Python25\lib\site-packages\django\contrib\auth\admin.py" in 
128. admin.site.register(Group, GroupAdmin) File
"C:\Python25\lib\site-packages\django\contrib\admin\sites.py" in register
90. validate(admin_class, model) File
"C:\Python25\lib\site-packages\django\contrib\admin\validation.py" in
validate 22. models.get_apps() File
"C:\Python25\lib\site-packages\django\db\models\loading.py" in get_apps 100.
self._populate() File
"C:\Python25\lib\site-packages\django\db\models\loading.py" in _populate 58.
self.load_app(app_name, True) File
"C:\Python25\lib\site-packages\django\db\models\loading.py" in load_app 74.
models = import_module('.models', app_name) File
"C:\Python25\lib\site-packages\django\utils\importlib.py" in import_module
35. __import__(name) Exception Type: IndentationError at
/admin/polls/poll/5/ Exception Value: unexpected indent (models.py, line 10)


Thanks in advance.

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



__unicode__(self) doesn't work

2009-10-11 Thread Denis Bahati
Hi all,
I have a problem with __unicode__(self) function it doesn't give any changes
to the display of poll list it just display the Poll object when i code like
below:


from django.db import models
import datetime

class Poll(models.Model):
question = models.CharField(max_length=200)
pub_date = models.DateTimeField('date published')
def __unicode__(self):
return self.question
def was_published_today(self):
return self.pub_date.date() == datetime.date.today()
def was_published_today(self):
return self.pub_date.date() == datetime.date.today()
was_published_today.short_description = 'Published today?'


class Choice(models.Model):
poll = models.ForeignKey(Poll)
choice = models.CharField(max_length=200)
votes = models.IntegerField()
def __unicode__(self):
return self.choice

*if i change the code like the one shown below it gives me the traceback
about indents, i also included below.*

from django.db import models
import datetime

class Poll(models.Model):
question = models.CharField(max_length=200)
pub_date = models.DateTimeField('date published')
def __unicode__(self):
return self.question
def was_published_today(self):
return self.pub_date.date() == datetime.date.today()
def was_published_today(self):
return self.pub_date.date() == datetime.date.today()
was_published_today.short_description = 'Published today?'


class Choice(models.Model):
poll = models.ForeignKey(Poll)
choice = models.CharField(max_length=200)
votes = models.IntegerField()
def __unicode__(self):
return self.choice

Environment: Request Method: GET Request URL:
http://localhost/testproject/admin/polls/poll/5/ Django Version: 1.1 Python
Version: 2.5.4 Installed Applications: ['django.contrib.auth',
'django.contrib.contenttypes', 'django.contrib.sessions',
'django.contrib.sites', 'django.contrib.admin', 'testproject.polls']
Installed Middleware: ('django.middleware.common.CommonMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware') Traceback: File
"C:\Python25\lib\site-packages\django\core\handlers\base.py" in get_response
83. request.path_info) File
"C:\Python25\lib\site-packages\django\core\urlresolvers.py" in resolve 216.
for pattern in self.url_patterns: File
"C:\Python25\lib\site-packages\django\core\urlresolvers.py" in
_get_url_patterns 245. patterns = getattr(self.urlconf_module,
"urlpatterns", self.urlconf_module) File
"C:\Python25\lib\site-packages\django\core\urlresolvers.py" in
_get_urlconf_module 240. self._urlconf_module =
import_module(self.urlconf_name) File
"C:\Python25\lib\site-packages\django\utils\importlib.py" in import_module
35. __import__(name) File "C:/xampp/htdocs\testproject\urls.py" in 
5. admin.autodiscover() File
"C:\Python25\lib\site-packages\django\contrib\admin\__init__.py" in
autodiscover 56. import_module("%s.admin" % app) File
"C:\Python25\lib\site-packages\django\utils\importlib.py" in import_module
35. __import__(name) File
"C:\Python25\lib\site-packages\django\contrib\auth\admin.py" in 
128. admin.site.register(Group, GroupAdmin) File
"C:\Python25\lib\site-packages\django\contrib\admin\sites.py" in register
90. validate(admin_class, model) File
"C:\Python25\lib\site-packages\django\contrib\admin\validation.py" in
validate 22. models.get_apps() File
"C:\Python25\lib\site-packages\django\db\models\loading.py" in get_apps 100.
self._populate() File
"C:\Python25\lib\site-packages\django\db\models\loading.py" in _populate 58.
self.load_app(app_name, True) File
"C:\Python25\lib\site-packages\django\db\models\loading.py" in load_app 74.
models = import_module('.models', app_name) File
"C:\Python25\lib\site-packages\django\utils\importlib.py" in import_module
35. __import__(name) Exception Type: IndentationError at
/admin/polls/poll/5/ Exception Value: unexpected indent (models.py, line 10)

*
*


Please any 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: __unicode__(self) doesn't work

2009-10-11 Thread Denis Bahati
Did you see my second post? I changed it still a problem

On Mon, Oct 12, 2009 at 8:19 AM, Denis Bahati  wrote:

> Hi all,
> I have a problem with __unicode__(self) function it doesn't give any
> changes to the display of poll list it just display the Poll object when i
> code like below:
>
>
> from django.db import models
> import datetime
>
> class Poll(models.Model):
> question = models.CharField(max_length=200)
> pub_date = models.DateTimeField('date published')
> def __unicode__(self):
> return self.question
> def was_published_today(self):
> return self.pub_date.date() == datetime.date.today()
> def was_published_today(self):
> return self.pub_date.date() == datetime.date.today()
> was_published_today.short_description = 'Published today?'
>
>
> class Choice(models.Model):
> poll = models.ForeignKey(Poll)
> choice = models.CharField(max_length=200)
> votes = models.IntegerField()
> def __unicode__(self):
> return self.choice
>
> *if i change the code like the one shown below it gives me the traceback
> about indents, i also included below.*
>
> from django.db import models
> import datetime
>
> class Poll(models.Model):
> question = models.CharField(max_length=200)
> pub_date = models.DateTimeField('date published')
> def __unicode__(self):
>  return self.question
> def was_published_today(self):
> return self.pub_date.date() == datetime.date.today()
>  def was_published_today(self):
> return self.pub_date.date() == datetime.date.today()
>  was_published_today.short_description = 'Published today?'
>
>
> class Choice(models.Model):
> poll = models.ForeignKey(Poll)
> choice = models.CharField(max_length=200)
> votes = models.IntegerField()
> def __unicode__(self):
> return self.choice
>
> Environment: Request Method: GET Request URL:
> http://localhost/testproject/admin/polls/poll/5/ Django Version: 1.1
> Python Version: 2.5.4 Installed Applications: ['django.contrib.auth',
> 'django.contrib.contenttypes', 'django.contrib.sessions',
> 'django.contrib.sites', 'django.contrib.admin', 'testproject.polls']
> Installed Middleware: ('django.middleware.common.CommonMiddleware',
> 'django.contrib.sessions.middleware.SessionMiddleware',
> 'django.contrib.auth.middleware.AuthenticationMiddleware') Traceback: File
> "C:\Python25\lib\site-packages\django\core\handlers\base.py" in get_response
> 83. request.path_info) File
> "C:\Python25\lib\site-packages\django\core\urlresolvers.py" in resolve 216.
> for pattern in self.url_patterns: File
> "C:\Python25\lib\site-packages\django\core\urlresolvers.py" in
> _get_url_patterns 245. patterns = getattr(self.urlconf_module,
> "urlpatterns", self.urlconf_module) File
> "C:\Python25\lib\site-packages\django\core\urlresolvers.py" in
> _get_urlconf_module 240. self._urlconf_module =
> import_module(self.urlconf_name) File
> "C:\Python25\lib\site-packages\django\utils\importlib.py" in import_module
> 35. __import__(name) File "C:/xampp/htdocs\testproject\urls.py" in 
> 5. admin.autodiscover() File
> "C:\Python25\lib\site-packages\django\contrib\admin\__init__.py" in
> autodiscover 56. import_module("%s.admin" % app) File
> "C:\Python25\lib\site-packages\django\utils\importlib.py" in import_module
> 35. __import__(name) File
> "C:\Python25\lib\site-packages\django\contrib\auth\admin.py" in 
> 128. admin.site.register(Group, GroupAdmin) File
> "C:\Python25\lib\site-packages\django\contrib\admin\sites.py" in register
> 90. validate(admin_class, model) File
> "C:\Python25\lib\site-packages\django\contrib\admin\validation.py" in
> validate 22. models.get_apps() File
> "C:\Python25\lib\site-packages\django\db\models\loading.py" in get_apps 100.
> self._populate() File
> "C:\Python25\lib\site-packages\django\db\models\loading.py" in _populate 58.
> self.load_app(app_name, True) File
> "C:\Python25\lib\site-packages\django\db\models\loading.py" in load_app 74.
> models = import_module('.models', app_name) File
> "C:\Python25\lib\site-packages\django\utils\importlib.py" in import_module
> 35. __import__(name) Exception Type: IndentationError at
> /admin/polls/poll/5/ Exception Value: unexpected indent (models.py, line 10)
>
> *
> *
>
>
> Please any 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
-~--~~~~--~~--~--~---



Hi All: __unicode__(self)

2009-10-11 Thread Denis Bahati
Hi all,

I have a problem with __unicode__(self) function it doesn't give any changes
to the display of poll list it just display the Poll object when i code like
below:


from django.db import models
import datetime

class Poll(models.Model):
question = models.CharField(max_length=200)
pub_date = models.DateTimeField('date published')
def __unicode__(self):
return self.question
def was_published_today(self):
return self.pub_date.date() == datetime.date.today()
def was_published_today(self):
return self.pub_date.date() == datetime.date.today()
was_published_today.short_description = 'Published today?'


class Choice(models.Model):
poll = models.ForeignKey(Poll)
choice = models.CharField(max_length=200)
votes = models.IntegerField()
def __unicode__(self):
return self.choice

if i change the code like the one shown below it gives me the traceback
about indents, i also included below.

from django.db import models
import datetime

class Poll(models.Model):
question = models.CharField(max_length=200)
pub_date = models.DateTimeField('date published')
def __unicode__(self):
return self.question
def was_published_today(self):
return self.pub_date.date() == datetime.date.today()
def was_published_today(self):
return self.pub_date.date() == datetime.date.today()
was_published_today.short_description = 'Published today?'


class Choice(models.Model):
poll = models.ForeignKey(Poll)
choice = models.CharField(max_length=200)
votes = models.IntegerField()
def __unicode__(self):
eturn self.choice

Environment:

Request Method: GET
Request URL: http://localhost/testproject/admin/polls/poll/5/
Django Version: 1.1
Python Version: 2.5.4
Installed Applications:
['django.contrib.auth',
 'django.contrib.contenttypes',
 'django.contrib.sessions',
 'django.contrib.sites',
 'django.contrib.admin',
 'testproject.polls']
Installed Middleware:
('django.middleware.common.CommonMiddleware',
 'django.contrib.sessions.middleware.SessionMiddleware',
 'django.contrib.auth.middleware.AuthenticationMiddleware')


Traceback:
File "C:\Python25\lib\site-packages\django\core\handlers\base.py" in
get_response
  83. request.path_info)
File "C:\Python25\lib\site-packages\django\core\urlresolvers.py" in resolve
  216. for pattern in self.url_patterns:
File "C:\Python25\lib\site-packages\django\core\urlresolvers.py" in
_get_url_patterns
  245. patterns = getattr(self.urlconf_module, "urlpatterns",
self.urlconf_module)
File "C:\Python25\lib\site-packages\django\core\urlresolvers.py" in
_get_urlconf_module
  240. self._urlconf_module = import_module(self.urlconf_name)
File "C:\Python25\lib\site-packages\django\utils\importlib.py" in
import_module
  35. __import__(name)
File "C:/xampp/htdocs\testproject\urls.py" in 
  5. admin.autodiscover()
File "C:\Python25\lib\site-packages\django\contrib\admin\__init__.py" in
autodiscover
  56. import_module("%s.admin" % app)
File "C:\Python25\lib\site-packages\django\utils\importlib.py" in
import_module
  35. __import__(name)
File "C:\Python25\lib\site-packages\django\contrib\auth\admin.py" in

  128. admin.site.register(Group, GroupAdmin)
File "C:\Python25\lib\site-packages\django\contrib\admin\sites.py" in
register
  90. validate(admin_class, model)
File "C:\Python25\lib\site-packages\django\contrib\admin\validation.py" in
validate
  22. models.get_apps()
File "C:\Python25\lib\site-packages\django\db\models\loading.py" in get_apps
  100. self._populate()
File "C:\Python25\lib\site-packages\django\db\models\loading.py" in
_populate
  58. self.load_app(app_name, True)
File "C:\Python25\lib\site-packages\django\db\models\loading.py" in load_app
  74. models = import_module('.models', app_name)
File "C:\Python25\lib\site-packages\django\utils\importlib.py" in
import_module
  35. __import__(name)

Exception Type: IndentationError at /admin/polls/poll/5/
Exception Value: unexpected indent (models.py, line 10)




Please any 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: Hi All: __unicode__(self)

2009-10-12 Thread Denis Bahati
Thank in advance for the advices.

On Mon, Oct 12, 2009 at 8:55 AM, Russell Keith-Magee  wrote:

>
> On Mon, Oct 12, 2009 at 1:44 PM, Kenneth Gonsalves
>  wrote:
> >
> > On Monday 12 Oct 2009 11:05:38 am Denis Bahati wrote:
> >> class Poll(models.Model):
> >> question = models.CharField(max_length=200)
> >> pub_date = models.DateTimeField('date published')
> >> def __unicode__(self):
> >> return self.questiona
> >> def was_published_today(self):
> >> return self.pub_date.date() == datetime.date.today()
> >> def was_published_today(self):
> >> return self.pub_date.date() == datetime.date.today()
> >> was_published_today.short_description = 'Published today?'
> >
> > please learn some python!
>
> Kenneth - please learn some manners. You have repeatedly demonstrated
> on this list that you have a deep yearning for brevity. However, let
> me assure you that it really doesn't take that much effort to write in
> whole sentences (with capitalization and everything). If you throw in
> some politeness while you are at it, all the better.
>
> Yours,
> Russ Magee %-)
>
> >
>

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



Using django form

2009-10-28 Thread Denis Bahati
Hi all,
I've gone through and successfully made the poll application and I've
begun to play around and tried to change a few things. The first thing
I would like to do is have the user vote without login to django admin. ie
creating my own form where users can vote and update the database without
using the django admin. I'm thinking of using html files or using the django
form library but i dont no the exactly solution to go through this. Can any
one show me how to do the staff using django form or using the html forms? I
have followed the tutorial like in the Django Book Chapter 7: Forms but i
dont see where i can insert data into the table in the database.
Thanks in advance.
Regards
Denis.

--~--~-~--~~~---~--~~
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 django form

2009-10-29 Thread Denis Bahati
Hi Daniel,
Thanks  for the document. I real appreciate.
I have another question:
  How can I use my model and ModelForm to create a login screen?

On Thu, Oct 29, 2009 at 10:14 AM, Daniel Roseman wrote:

>
> On Oct 29, 6:38 am, Denis Bahati  wrote:
> > Hi all,
> > I've gone through and successfully made the poll application and I've
> > begun to play around and tried to change a few things. The first thing
> > I would like to do is have the user vote without login to django admin.
> ie
> > creating my own form where users can vote and update the database without
> > using the django admin. I'm thinking of using html files or using the
> django
> > form library but i dont no the exactly solution to go through this. Can
> any
> > one show me how to do the staff using django form or using the html
> forms? I
> > have followed the tutorial like in the Django Book Chapter 7: Forms but i
> > dont see where i can insert data into the table in the database.
> > Thanks in advance.
> > Regards
> > Denis.
>
> http://docs.djangoproject.com/en/dev/topics/forms/modelforms/
> --
> DR.
> >
>

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



Login users

2009-10-29 Thread Denis Bahati
Hi All,

Am creating application using django/python, i want to create a login form
where by normal users can login through the web and access the system, i
have a background with PHP but new to python/django. How can I implement
this login? Currently am using the Django Admin page for login the system.
Thanks in advance.
Regards
Denis.

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



Display a value from another table

2009-11-01 Thread Denis Bahati
Hi All,
Am developing an application where by it links two tables author and book,
the id of author is a foreign key to book table. How can i display the name
of the author when am displaying the book list.

--~--~-~--~~~---~--~~
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 a value from another table

2009-11-02 Thread Denis Bahati
Here is my model.

TITLE_CHOICES = (
('MR', 'Mr.'),
('MRS', 'Mrs.'),
('MS', 'Ms.'),
)

class Author(models.Model):
name = models.CharField(max_length=100)
title = models.CharField(max_length=3, choices=TITLE_CHOICES)
birth_date = models.DateField(blank=True, null=True)

def __unicode__(self):
return self.name

class Book(models.Model):
name = models.CharField(max_length=100)
authors = models.ManyToManyField(Author)

class AuthorForm(ModelForm):
class Meta:
model = Author

class BookForm(ModelForm):
class Meta:
model = Book

What i want is that, if i need to display the book detail it should give me
who is the other for a particular book.

On Mon, Nov 2, 2009 at 9:25 AM, Rishabh Manocha  wrote:

> On Mon, Nov 2, 2009 at 1:43 PM, Denis Bahati  wrote:
>
>> Hi All,
>> Am developing an application where by it links two tables author and book,
>> the id of author is a foreign key to book table. How can i display the name
>> of the author when am displaying the book list.
>>
>>
>>
> I'm not sure how you the id of an author can be a ForeignKey to a Book. Can
> you paste your models so that we can get a clearer picture. Assuming your
> Book model looks something like the below:
>
> class Book(models.Model):
> ...
> author = models.ForeignKey(Author)
>
> You would do:
>
> >>> my_author = Author.objects.create('James Joyce')
> >>> my_book = Book.objects.create(..., author = my_author)
> >>> my_book.author
> 
>
> --
>
> Best,
>
> R
>
> >
>

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



User Login in django

2009-11-03 Thread Denis Bahati
Hi there,
Am creating a login screen using django form but failing to get the concept
on how can i query from the database to get the user verified as a
registered user. I want that a user is validated and displayed with his/her
profile as well update  his/her profile. The user can view only the allowed
pages not viewing other pages.
Here is my model for registering users and the form.
class User(models.Model):
title = models.ForeignKey(Title)
first_name = models.CharField(max_length=100)
last_name = models.CharField(max_length=100)
address = models.TextField()
roles = models.ManyToManyField(Role)
username = models.CharField(max_length=30)
password = models.CharField(max_length=30)
date_added = models.DateTimeField()
 def __unicode__(self):
return '%s %s %s' %(self.title, self.first_name, self.last_name)

class UserForm(ModelForm):
date_added=forms.DateField()
class Meta:
model = User

class User(forms.Form):
username = models.CharField(max_length=30)
password = models.CharField(max_length=30)

--~--~-~--~~~---~--~~
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: User Login in django

2009-11-03 Thread Denis Bahati
Am real need to reinvent the wheel because i have a project which needs to
define some user roles, and enable users to update the status of their own
properties and not the other property. Thanks in advance for any help you
give me.

On Tue, Nov 3, 2009 at 4:32 PM, bruno desthuilliers <
bruno.desthuilli...@gmail.com> wrote:

>
> On 3 nov, 13:37, Denis Bahati  wrote:
> > Hi there,
> > Am creating a login screen using django form but failing to get the
> concept
> > on how can i query from the database to get the user verified as a
> > registered user.
>
> Do you have a real need for reinventing the wheel ?
>
> http://docs.djangoproject.com/en/dev/topics/auth/
> >
>

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



Adding a password confirm on modelForm

2009-11-03 Thread Denis Bahati
Hi All,
I have my model which registers users of my system and i created a modelForm
to make all fields of the model appear as html form which has no confirm
password. How can i add a field to let users confirm their password?
Here is my model and modelForm

class User(models.Model):
title = models.ForeignKey(Title)
first_name = models.CharField(max_length=100)
last_name = models.CharField(max_length=100)
address = models.TextField()
roles = models.ManyToManyField(Role)
username = models.CharField(max_length=30)
password = models.CharField(max_length=30)
date_added = models.DateTimeField()

class UserForm(ModelForm):
date_added=forms.DateTimeField()
password=forms.CharField(label=("Password"), widget=forms.PasswordInput)
class Meta:
model = User

Thanks in advance.
Regards
Denis.

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



Template not displaying

2009-11-10 Thread Denis Bahati

Hi all, am using xampp as webserver with django 1.1,when i access the
browser the template does not work. The media is in
c:/xampp/htdocs/adc/media/ where i put the css,img and js folders. I
set admin_media_prefix='http:/127.0.0.1/adc/media/' the same to
media_url. The template is at c:/xampp/htdocs/adc/templates/. Please
any idea on how to make the templates working?

-- 
Sent from my mobile device

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



Increment a value in a database table field

2009-11-12 Thread Denis Bahati
Hi All,

I have a field with an integer value which needs to be incremented
every time any user updates its status within a week. If that week has
passed it should insert a new row. Now i was trying to figure out but
didn't get any concept on how to go through. Please any idea?

--

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




Re: Increment a value in a database table field

2009-11-14 Thread Denis Bahati
Hi,
Here is my model am using to update items status.

class User(models.Model)
users = models.ForeignKey(User)
resources = models.ForeignKey(Resource)
   date_tracked = models.DateTimeField('Date Tracked')
   description = models.TextField()
   status_count_per_week = models.IntegerField()
status = models.ForeignKey(Status)

class Meta:
verbose_name_plural = 'Track Resources'

What i want to achieve is that:
  When i update the status the item first i should get the date last tracked
and compare with tje current date, if the date tracked and the current date
are not in the same week it should insert into a new row of
status_count_per_week. If the date tracked and the current date are in the
same week it should increment the value of status_count_per_week .
Regards.
Denis.

On Thu, Nov 12, 2009 at 11:58 AM, scot.hac...@gmail.com <
scot.hac...@gmail.com> wrote:

>
> On Nov 12, 7:51 am, Denis Bahati  wrote:
> > Hi All,
> >
> > I have a field with an integer value which needs to be incremented
> > every time any user updates its status within a week. If that week has
> > passed it should insert a new row. Now i was trying to figure out but
> > didn't get any concept on how to go through. Please any idea?
>
> You don't mention how you're tracking dates or weeks (is that a
> related model, or... ?) but this would be the general idea:
>
> - get the timestamp of the last update to that field and compare it to
> the current timestamp
>
> if ... : #  interval is less than a week:
>foo = MyModel.objects.get(...)
>foo.counter = foo.counter + 1
> else : interval is more than a week
>foo = MyModel()
>foo.counter = 1
>
> foo.save()
>
> --
>
> 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=.
>
>
>

--

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




Re: Increment a value in a database table field

2009-11-15 Thread Denis Bahati
Exactly Karen the model is confusing. Here is the exactly model.

class Resource_Track(models.Model)
users = models.ForeignKey(User)
resources = models.ForeignKey(Resource)
date_tracked = models.DateTimeField('Date Tracked')
description = models.TextField()
status_count_per_week = models.IntegerField()
status = models.ForeignKey(Status)

class Meta:
   verbose_name_plural = 'Track Resources'

Sorry for confusing you.
Regards
Denis.

On Sat, Nov 14, 2009 at 7:43 AM, Karen Tracey  wrote:

> On Sat, Nov 14, 2009 at 10:25 AM, Denis Bahati  wrote:
>
>> Hi,
>> Here is my model am using to update items status.
>>
>> class User(models.Model)
>> users = models.ForeignKey(User)
>> resources = models.ForeignKey(Resource)
>>date_tracked = models.DateTimeField('Date Tracked')
>>description = models.TextField()
>>status_count_per_week = models.IntegerField()
>> status = models.ForeignKey(Status)
>>
>> class Meta:
>> verbose_name_plural = 'Track Resources'
>>
>> What i want to achieve is that:
>>   When i update the status the item first i should get the date last
>> tracked and compare with tje current date, if the date tracked and
>> the current date are not in the same week it should insert into a new row of
>> status_count_per_week. If the date tracked and the current date are in the
>> same week it should increment the value of status_count_per_week .
>>
>>
> I find your model and description confusing -- I am not sure the model you
> have defined is correct for what you want to achieve -- so I am not going to
> attempt to craft a solution exactly. Instead I'll point you to the two
> building blocks I think you need to achieve what you are looking for.
> First, get_or_create:
>
>
> http://docs.djangoproject.com/en/dev/ref/models/querysets/#get-or-create-kwargs
>
> which you can use to either get the model containing a specific set of
> fields or create it if it does not exist.
>
> Second, update() with an F() expression can be used to atomically increment
> a counter:
>
>
> http://docs.djangoproject.com/en/dev/ref/models/instances/#updating-attributes-based-on-existing-fields
>
> Karen
>
>
>
> --
> 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=.
>

--

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




Re: Password encryption

2009-11-16 Thread Denis Bahati
Nah;
Here is my Model.
class Title(models.Model):
name = models.CharField(max_length=10)

def __unicode__(self):
return self.name

class UserProfile(models.Model):
title = models.ForeignKey(Title)
address = models.TextField()
date_added = models.DateTimeField()

class UserProfileForm(ModelForm):
username=forms.CharField(label=("User Name"), max_length=100)
password_Confirm=forms.CharField(label=("Confirm Password"),
widget=forms.PasswordInput,max_length=100)
first_name=forms.CharField(label=("First Name"), max_length=100)
last_name=forms.CharField(label=("Last Name"), max_length=100)
date_added=forms.DateField()
class Meta:
model = UserProfile

here is my view.py

from django.contrib.auth import authenticate, login
from django.http import HttpResponse
from django.shortcuts import get_object_or_404
from django.shortcuts import get_list_or_404
from django.template import loader, Context
from django.shortcuts import render_to_response
from django.http import HttpResponseRedirect
from commTrack.commtrack.models import *

def UserProfileEditor(request, id=None):
form = UserProfileForm(request.POST or None,
   instance=id and UserProfile.objects.get(id=id))

# Save new/edited User
if request.method == 'POST' and form.is_valid():
form.save()
return HttpResponseRedirect('/commTrack/userProfile/list/')

return render_to_response('userProfile/adduserProfile.html',
{'form':form})

and here is my form.html

{%
block form_top %}{% endblock %}




{{ form.title.errors }}




Title:



{{ form.title }}




{{ form.first_name.errors }}




First Name:



{{ form.first_name }}




{{ form.last_name.errors }}




Last Name:



{{ form.last_name }}




{{ form.address.errors }}




Address:



{{ form.address }}




{{ form.username.errors }}




User Name:



{{ form.username }}




{{ form.password.errors }}




Password:



{{ form.password }}




{{ form.password_Confirm.errors }}




Confirm Password:



{{ form.password_Confirm }}




{{ form.date_added.errors }}




Date Added:



{{ form.date_added }}











It does not save anything when i click the submit button and it remains on
the same interface. Any ideas?


On Mon, Nov 16, 2009 at 7:50 AM, Gabriel Gunderson  wrote:

> On Thu, Nov 5, 2009 at 12:51 AM, Denis Bahati  wrote:
> > My project require to have my own table for users and roles. Am not using
> > the default auth table.
>
> Does this work for your additional user info?
>
>
> http://docs.djangoproject.com/en/dev/topics/auth/#storing-additional-information-about-users
>
> Gabe
>
> --
>
> 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=.
>
>
>

--

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




RapidSMS on windows

2009-11-17 Thread Denis Bahati
Hi All,

Does RapidSMS work on windows? Please if it does can anyone show me the
detail on how to go through.

--

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




Login Error

2009-11-17 Thread Denis Bahati
#x27;, '')
password = request.POST.get('password', '') user =
authenticate(username=username, password=password) if user is not None and
user.is_active: # Correct password, and the user is marked "active"
login(request, user) # Redirect to a success page. return
HttpResponseRedirect("/commTrack/") else: # Show an error page return
HttpResponseRedirect("/commTrack/commtrack/invalid/")

and here is my model.py

class CustomUserModelBackend(ModelBackend):
def authenticate(self, username=None, password=None):
try:
user = self.user_class.objects.get(username=username)
if user.check_password(password):
return user
except self.user_class.DoesNotExist:
return None

def get_user(self, user_id):
try:
return self.user_class.objects.get(pk=user_id)
except self.user_class.DoesNotExist:
return None

@property
def user_class(self):
if not hasattr(self, '_user_class'):
self._user_class =
get_model(*settings.CUSTOM_USER_MODEL.split('.', 2))
if not self._user_class:
raise ImproperlyConfigured('Could not get custom user
model')
return self._user_class

class CustomUser(User): """User with app settings.""" title =
models.ForeignKey(Title) timezone = models.CharField(max_length=50,
default='Africa/Dar es Salaam') # Use UserManager to get the create_user
method, etc. objects = UserManager()




Any idea plz.
thanks in advance.
Denis.

--

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




Re: Problem with serving static files

2009-11-18 Thread Denis Bahati
how do you make them similar? because its also a problem to with TinyMCE.

On Wed, Nov 18, 2009 at 4:13 PM, jeremyrdavis wrote:

> The document root specified in urlpatterns should match the directory
> where your files are located.  You have "/mysite/media/" in your
> urlpatterns and "C:\django_projects\mysite\media" in your post.  Make
> sure those match.
>
>
> On Nov 18, 6:56 am, "Benjamin W."  wrote:
> > Hi there,
> >
> > I'm new to django and got my first little problem.
> > I want to use a css file in my template. So I read this:
> http://docs.djangoproject.com/en/dev/howto/static-files/
> >
> > I set up everything, but I don't get the file.
> > My config:
> >
> > urls.py:
> > urlpatterns = patterns('',
> > (r'^polls/', include('mysite.polls.urls')),
> > (r'^site_media/(?P.*)$', 'django.views.static.serve',
> > {'document_root': '/mysite/media/'}),
> > )
> >
> > base.html (css include)
> > 
> >
> > Path to media:
> > C:\djanjo_projects\mysite\media
> >
> > When I open the source code of the page and click on the stylesheet, I
> > get this information:
> > Request URL:http://127.0.0.1:8080/site_media/css/design.css
> > /mysite/media/css/design.css does not exist
> >
> > Whats wrong with my pass?
> > Thanks a lot,
> > greets Ben
>
> --
>
> 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=.
>
>
>

--

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




Is there any way of model cross reference placed in different files but in one app?

2009-11-26 Thread Denis Cheremisov
I have models directory with several files in it (models/__init__.py,
models/main.py, ...)
I have basic "Article" model and many models derived from it. So, I
would like to place them into separate file: models/article.py
But I also have several models ("Image" and "Section") which contain
ForeignKey(Article,...) and, on the  other hand, Article also has
ForeingKey on them. I tried to use ".models.main.Image" and
".models.main.Section" as model name, but it didnt' work.
Is there any way to place Article and Article-based models into
separate file

--

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: Is there any way of model cross reference placed in different files but in one app?

2009-11-26 Thread Denis Cheremisov
Oh, thanks, that works!

On 26 ноя, 13:03, Daniel Roseman  wrote:
> On Nov 26, 10:01 am, Denis Cheremisov 
> wrote:
>
> > I have models directory with several files in it (models/__init__.py,
> > models/main.py, ...)
> > I have basic "Article" model and many models derived from it. So, I
> > would like to place them into separate file: models/article.py
> > But I also have several models ("Image" and "Section") which contain
> > ForeignKey(Article,...) and, on the  other hand, Article also has
> > ForeingKey on them. I tried to use ".models.main.Image" and
> > ".models.main.Section" as model name, but it didnt' work.
> > Is there any way to place Article and Article-based models into
> > separate file
>
> As long as your __init__.py is importing all the models from the
> various files, you can just refer to them as appname.Image,
> appname.Section etc.
> --
> DR.

--

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.




Problem with static files (MEDIA_URL and MEDIA_ROOT)

2010-06-27 Thread Denis Ricardo
Hello people! I am having any problems with static files (images, CSS)
in Django. I configured the MEDIA_URL and MEDIA_ROOT in settings.py
and when I execute the server and I go see the webpage, the static
files doesn't are encountered (the page stay without anything).

Screen Shot of my page: http://yfrog.com/jq35546894

I am using the Django 1.1, on Ubuntu 10.04. The following are the
server logs:

http://dpaste.com/211961/

This files exists! They are in this directory, but doesn't are
encountered by the Django.
The directory of my project follows below:

http://dpaste.com/211962/

And these are the files of project:

settings.py: http://dpaste.com/211967/

urls.py: http://dpaste.com/211964/

views.py: http://dpaste.com/211969/

base.html: http://dpaste.com/211971/ # This is the page of the Screen
Shot

Anybody can help me?

(Sorry by my bad english.)

-- 
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: vista install

2008-01-24 Thread Denis Cornehl
Hi,

I think Windows does noch have this feature on the command-line.

Type "python django-admin.py startproject testproject".

If your Python-installation is in the path, it will run.

On Jan 24, 2008 9:46 AM, mtnpaul <[EMAIL PROTECTED]> wrote:

>
> Well I got a new laptop that has vista on it (not my choice). I'm
> trying to install django, but keep getting the same strange message
> when I try to create a project
>
> C:\>django-admin.py startproject testproject
>
> results in the following
> Type 'django-admin.py help' for usage.
>
> I've tried both python2.4 and python2.5 with the same results.
>
> I believe the problem is that windows does not know that the .py files
> are executable.
>
> Any ideas?
>
> Thanks,
>
> Paul
>
> >
>


-- 
Denis Cornehl

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Bugs in Django apps : why not throw exceptions when being in debug mode ?

2006-12-19 Thread Denis Frère

I've just found a bug that made me searching for hours... I'll tell you
the story in case it could help someone else.

I got a strange behaviour with Django views recently : some pages of a
website I'm developping were empty apart from the template. That is,
the template was called but there was no data to fill the variables.
The stranger is that a same view code was OK for some pages and bad for
other pages. It happened with generic views and even with flatpages.

After a long search, I discovered the problem : I had written a buggy
template context processor. Depending on the request.path, I was
returning or not a dictionary. When I was returning the dictionary,
everything was OK, but when not, my templates were empty.

OK, I'm guilty. I knew I had to return a dictionary, but I don't
appreciate having had no clues to find the bug. I love Python because
he's generally kind with me, telling me where I made errors. When
Django fails silently, it makes things much harder for bad programmers
like me.

In conclusion, a question for the developpers : wouldn't it be better
to throw exceptions when being in debug mode and fail silently only
when debug mode is off ?

Regards,

Denis Frère


--~--~-~--~~~---~--~~
 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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Django+mod_python+fedora 6 (x86_64)+apache problem

2006-12-19 Thread Denis Frère

[EMAIL PROTECTED] wrote:
> httpd.conf snippet
> --
> 
> Options FollowSymLinks
> Order allow,deny
> Allow from all
> SetHandler python-program
> PythonHandler django.core.handlers.modpython
> PYTHONPATH "['/usr/local/django_src'] + sys.path"
> [...]
> ImportError: No module named django

Is your package django in the /usr/local/django_src directory ?
If yes, did you try this ?
PYTHONPATH "['/usr/local/django_src/django'] + sys.path" 

Denis Frère


--~--~-~--~~~---~--~~
 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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Initial data for a Select widget in newforms

2007-01-26 Thread Denis Frère

Hi all,

I'm discovering newforms.

It works pretty well, but I can't manage to give an initial selection
in a ChoiceField (Select widget).
I tried to read the code. I understand I have to give a "value"
parameter to Select.render(), but how do I pass that value in the form
initial data dictionary ?

Thank you.

Denis


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Initial data for a Select widget in newforms

2007-01-27 Thread Denis Frère

On Jan 27, 9:23 am, "canen" <[EMAIL PROTECTED]> wrote:
> my_field = ChoiceField(choices=[(1, 1), (2, 2)], initial=1)
> doesn't work?

Yes, thank you.

For information, here is more details.

I have a view function called bill_clone to build a new bill form 
prepopulated with the values from a previous bill (apart from the bill 
number that has to be unique) .
It contained these lines :

billForm = forms.models.form_for_model(Bill)
bill = Bill.objects.get(number__iexact=bill_number)
data = bill.__dict__
del data['number']
form = billForm(initial=data)

Everything was fine except that foreignKey fields were not well 
selected.

Adding the lines :

form['currency'].field.initial = bill.currency_id
form['vendor'].field.initial = bill.vendor_id
form['customer'].field.initial = bill.customer_id

does the thing.

Thank you for your help.

Denis




--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Django Rest Framework using "DjangoModelPermissions" allow readonly

2022-05-20 Thread Denis Morejón


Hi:

I am creating a DRF project. I wanna use traditional 
DjangoModelPermissions. I put this on settings.py and It works fine:
REST_FRAMEWORK = {
'DEFAULT_PERMISSION_CLASSES': [
'rest_framework.permissions.DjangoModelPermissions'
],

But all authenticated users can access reading all data. Even if they had 
no reading permission. 

How can I prevent reading permissions?

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/e5ef4806-4bab-4bb7-8730-f6b750fa4a13n%40googlegroups.com.


Re: Using another database while testing

2012-02-01 Thread Denis Darii
You can redefine your database connection by adding somewhere at the end of
your settings.py something like:

import sys
if 'test' in sys.argv:
DATABASES = ...

hope this helps.

On Wed, Feb 1, 2012 at 6:01 PM, xina towner  wrote:

> I have a problem, django can't create my database because a dependency, I
> create it manually with a script, is there any way I can specify to the
> testing tool to use my database?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.
>



-- 
This e-mail and any file transmitted with it is intended only for the
person or entity to which is addressed and may contain information that is
privileged, confidential or otherwise protected from disclosure. Copying,
dissemination or use of this e-mail or the information herein by anyone
other than the intended recipient is prohibited. If you are not the
intended recipient, please notify the sender immediately by return e-mail,
delete this communication and destroy all copies.

-- 
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: problem with localization

2012-02-04 Thread Denis Darii
Vittorino, this is not related to your initial question and you must
consider that the format() returns always a string. And why do you use
format() in total_no_vat()?

I would separate the "total":

...
 def total_no_vat(self):
return self.total_income + self.total_fee

 def total(self):
 return self.total_no_vat() * 1.21

 def formatted_total(self):
 return format(self.total(), settings.DECIMAL_SEPARATOR, 2)

now you can use formatted_total in your list_display
Denis.


On Sat, Feb 4, 2012 at 2:40 PM, Vittorino Parenti <
vpare...@thundersystems.it> wrote:

> Hi,
> I think this is not the solution.
> I do another example:
>
> MODEL
> 
> class Procedure(models.Model):
>  
>  total_income = models.DecimalField (
>default = 0,
>max_digits = 11,
>decimal_places = 4,
>verbose_name = _("Total Income"),
>  )
>  total_fee = models.DecimalField (
>default = 0,
>max_digits = 11,
>decimal_places = 4,
>verbose_name = _("Total Fee"),
>  )
>  
>   def total_no_vat(self):
> total_no_vat -no= self.total_income + self.total_fee
> return format(total_no_vat, settings.DECIMAL_SEPARATOR, 2)
>
>  def total(self):
>  total = self.total_no_vat() * 1.21
>  return format(total, settings.DECIMAL_SEPARATOR, 2)
>
> type of self.total_no_vat is unicode and I cannot do other operations
> on this field.
> Thanks,
> Vittorino
>
>
> On 4 Feb, 10:15, Denis Darii  wrote:
> > Hi Vittorino, this is happen because the model fields are automatically
> > formatted by django considering your settings.DECIMAL_SEPARATOR, but in
> > your total() you're simply return the sum of two Decimal()
> >
> > To solve this you can import format and pass the result of total() to it
> > like:
> >
> > from django.conf import settings
> > from django.utils.numberformat import format
> > ...
> >  def total(self):
> > total = self.total_income + self.total_fee
> > return format(total, settings.DECIMAL_SEPARATOR, 2)
> >
> > hope it helps! Have a nice weekend!
> > Denis.
> >
> > On Sat, Feb 4, 2012 at 9:52 AM, Vittorino Parenti <
> >
> >
> >
> >
> >
> >
> >
> > vpare...@thundersystems.it> wrote:
> > > Hello,
> > > i've a problem with number format localization. This is an example of
> > > my model and admin:
> >
> > > MODEL
> > > 
> > > class Procedure(models.Model):
> > >  
> > >  total_income = models.DecimalField (
> > >default = 0,
> > >max_digits = 11,
> > >decimal_places = 4,
> > >verbose_name = _("Total Income"),
> > >  )
> > >  total_fee = models.DecimalField (
> > >default = 0,
> > >max_digits = 11,
> > >decimal_places = 4,
> > >verbose_name = _("Total Fee"),
> > >  )
> > >  
> > >  def total(self):
> > > return self.total_income + self.total_fee
> >
> > > ADMIN
> > > ---
> > > class ProcedureAdmin(dmin.ModelAdmin):
> > >  list_display = (..., 'total_income', 'total_fee', 'total', ...)
> >
> > > output is:
> >
> > > ... | 35,22 | 9,28 | 45.50 | ...
> >
> > > with comma in first two cases and dot then.
> > > How can I do?
> > > Thanks in advance,
> > > Vittorino
> >
> > > --
> > > You received this message because you are subscribed to the Google
> Groups
> > > "Django users" group.
> > > To post to this group, send email to django-users@googlegroups.com.
> > > To unsubscribe from this group, send email to
> > > django-users+unsubscr...@googlegroups.com.
> > > For more options, visit this group at
> > >http://groups.google.com/group/django-users?hl=en.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>

-- 
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: rich text editing

2012-02-04 Thread Denis Darii
Take a look at this app: https://github.com/pydanny/django-wysiwyg

On Sat, Feb 4, 2012 at 2:44 PM, yonatan braude wrote:

> I want to enable rich text editing to editor on the site. what is the best
> way?
> thanx
> yonatan
>
> --
> 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.
>



-- 
This e-mail and any file transmitted with it is intended only for the
person or entity to which is addressed and may contain information that is
privileged, confidential or otherwise protected from disclosure. Copying,
dissemination or use of this e-mail or the information herein by anyone
other than the intended recipient is prohibited. If you are not the
intended recipient, please notify the sender immediately by return e-mail,
delete this communication and destroy all copies.

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



Re: Is there a simple way to write the site root as a variable clientside

2012-02-04 Thread Denis Darii
I'm not sure I fully understand your questions, but I think you need to
know more about the stupend "sites" framework:
https://docs.djangoproject.com/en/dev/ref/contrib/sites/

On Sat, Feb 4, 2012 at 5:13 PM, Jason <1jason.whatf...@gmail.com> wrote:

> Hi there,
>
> Is there a simple way to write the site root as a variable clientside?
> i.e. if I'm running locally the site root var with appear clientside as
> http://localhost:1010 however if I deploy the root will be
> http://www.mysite.com?
>
> Cheers,
> J
>
> --
> 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/-/lDnCch_r3lAJ.
> 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.
>



-- 
This e-mail and any file transmitted with it is intended only for the
person or entity to which is addressed and may contain information that is
privileged, confidential or otherwise protected from disclosure. Copying,
dissemination or use of this e-mail or the information herein by anyone
other than the intended recipient is prohibited. If you are not the
intended recipient, please notify the sender immediately by return e-mail,
delete this communication and destroy all copies.

-- 
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: dynamic permissions

2012-02-05 Thread Denis Darii
It seems that you are looking for a "per object permissions" system, so
take a look at django-guardian: https://github.com/lukaszb/django-guardian

On Sun, Feb 5, 2012 at 3:59 PM, Vittorino Parenti <
vpare...@thundersystems.it> wrote:

> i've a model with document'categories and a model with documents. i
> want set permissions per categories: add invoices, download invoices
> and so on (invoice is an example of category).
> Thanks,
> Vittorino
>
>
> On 5 Feb, 12:21, kenneth gonsalves  wrote:
> > On Sun, 2012-02-05 at 03:02 -0800, Vittorino Parenti wrote:
> > > I would like to create dynamic downloading permissions:
> > > - can download invoices
> > > - can upload invoices
> > > - can download contracts
> >
> > what is dynamic about this?
> > --
> > regards
> > Kenneth Gonsalves
>
> --
> 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.
>
>


-- 
This e-mail and any file transmitted with it is intended only for the
person or entity to which is addressed and may contain information that is
privileged, confidential or otherwise protected from disclosure. Copying,
dissemination or use of this e-mail or the information herein by anyone
other than the intended recipient is prohibited. If you are not the
intended recipient, please notify the sender immediately by return e-mail,
delete this communication and destroy all copies.

-- 
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: Making login Testing

2012-02-06 Thread Denis Darii
Yes Rubén you are right,
also you can use directly self.client.login() method:

...

def setUp(self):login =
self.client.login(username='myusername', password='mypass')
self.assertTrue(login)


On Mon, Feb 6, 2012 at 12:46 PM, xina towner  wrote:

> Hi, I've a question, how can I make login while testing? shouldn't be
> enough to do something like this:
>
> def setUp(self):
> response = self.post('/accounts/login/', {'username': 'username',
> 'password': 'username'})
> self.assertEqual(response.status_code, 200, "Login Failure")
> pass
>
> I understand that this setUp makes login before every test. Can you tell
> me if I am right?
>
> --
> Gràcies,
>
> Rubén
>
>  --
> 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.
>



-- 
This e-mail and any file transmitted with it is intended only for the
person or entity to which is addressed and may contain information that is
privileged, confidential or otherwise protected from disclosure. Copying,
dissemination or use of this e-mail or the information herein by anyone
other than the intended recipient is prohibited. If you are not the
intended recipient, please notify the sender immediately by return e-mail,
delete this communication and destroy all copies.

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



Re: Is there a way to prevent /static directory browsing?

2012-02-06 Thread Denis Darii
Under nginx you can set "autoindex" to "off" for "/static/" location:

location /static/
{
autoindex off;
root /path/to/your/static/;
}

More info here: http://wiki.nginx.org/HttpAutoindexModule

On Mon, Feb 6, 2012 at 3:53 PM, Robert Steckroth
wrote:

> Hey Guys, I am looking for a way to hide my media files from
> direct access. What is the common practice here?
> If one would browse to http://www.example.com/static in one of my Django
> sites there would be
> a list of all the files used therein. Is there a way to hide/prevent this
> url from having a directory tree?
>
> --
> Bust0ut Surgemcgee  ---
> BudTVNetwork.com
> RadioWeedShow.com
> PBDefence.com
> "Bringing entertainment to Unix"
> "Finding the exit without looking"
>
> --
> 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.
>



-- 
This e-mail and any file transmitted with it is intended only for the
person or entity to which is addressed and may contain information that is
privileged, confidential or otherwise protected from disclosure. Copying,
dissemination or use of this e-mail or the information herein by anyone
other than the intended recipient is prohibited. If you are not the
intended recipient, please notify the sender immediately by return e-mail,
delete this communication and destroy all copies.

-- 
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: number input format

2012-02-07 Thread Denis Darii
from the django's global_settings:

# Decimal separator symbol
DECIMAL_SEPARATOR = '.'

# Boolean that sets whether to add thousand separator when formatting
numbers
USE_THOUSAND_SEPARATOR = False

# Number of digits that will be together, when spliting them by
# THOUSAND_SEPARATOR. 0 means no grouping, 3 means splitting by thousands...
NUMBER_GROUPING = 0

# Thousand separator symbol
THOUSAND_SEPARATOR = ','

On Tue, Feb 7, 2012 at 11:56 AM, Vittorino Parenti <
vpare...@thundersystems.it> wrote:

> Hi,
> I saw there is this setting DATE_INPUT_FORMATS for date.
> Is there a similar solution for the numbers?
> Thanks,
> Vittorino.
>
> --
> 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.
>
>


-- 
This e-mail and any file transmitted with it is intended only for the
person or entity to which is addressed and may contain information that is
privileged, confidential or otherwise protected from disclosure. Copying,
dissemination or use of this e-mail or the information herein by anyone
other than the intended recipient is prohibited. If you are not the
intended recipient, please notify the sender immediately by return e-mail,
delete this communication and destroy all copies.

-- 
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: Installing Django from GIT/Subversion - package dependency in virtual environment

2012-02-20 Thread Denis Darii
Do you mean django-trunk installation?

If so, I use this in my requirements.txt:

-e svn+http://code.djangoproject.com/svn/django/trunk/#egg=django-trunk

or directly with pip:

$ pip install -e svn+
http://code.djangoproject.com/svn/django/trunk/#egg=django-trunk

Hope it helps.

On Mon, Feb 20, 2012 at 1:36 PM, Mateusz Marzantowicz <
mmarzantow...@gmail.com> wrote:

> Hello,
>
> I'm having a problem with managing Django installation which was done from
> git repository
> (might be svn as well) in clean virtual environment. The problem is that
> when I install some
> other package via pip which has a Django as a dependency, it doesn't find
> my django installation
> and then downloads official release. I really need only one Django
> installation in my virtualenv,
> the one from git :) It is more related to how pip works but does anyone
> has any idea how to do it the right way?
>
>
> Thanks,
> Mateusz Marzantowicz
>
> --
> 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.
>



-- 
This e-mail and any file transmitted with it is intended only for the
person or entity to which is addressed and may contain information that is
privileged, confidential or otherwise protected from disclosure. Copying,
dissemination or use of this e-mail or the information herein by anyone
other than the intended recipient is prohibited. If you are not the
intended recipient, please notify the sender immediately by return e-mail,
delete this communication and destroy all copies.

-- 
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: Year dropdown in Django admin

2012-02-20 Thread Denis Darii
I was in the same situation as you and I found this solution...
in your models.py:

import datetime
YEAR_CHOICES = []for r in range(1980,
(datetime.datetime.now().year+1)):YEAR_CHOICES.append((r,r))


so, your field can now use YEAR_CHOICES:

year = models.IntegerField(_('year'), max_length=4,
choices=YEAR_CHOICES, default=datetime.datetime.now().year)



On Mon, Feb 20, 2012 at 3:47 PM, grimmus  wrote:

> Hi,
>
> I have a car model that contains many fields including a 'year' field. I
> need the dropdown for this field to display the current year as the first
> option and also display the previous 25 years as individual options.
>
> I was thinking i could create a list object and then populate the list
> based on the current year and work my way back to 25 years earlier.
>
> I am not sure how to implement this so it would work in the Django admin
> area.
>
> Could someone please point me in the right direction with this ?
>
> Thank you in advance.
>
>
>  --
> 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/-/NUO22GxW7UEJ.
> 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.
>



-- 
This e-mail and any file transmitted with it is intended only for the
person or entity to which is addressed and may contain information that is
privileged, confidential or otherwise protected from disclosure. Copying,
dissemination or use of this e-mail or the information herein by anyone
other than the intended recipient is prohibited. If you are not the
intended recipient, please notify the sender immediately by return e-mail,
delete this communication and destroy all copies.

-- 
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: Installing Django from GIT/Subversion - package dependency in virtual environment

2012-02-20 Thread Denis Darii
Yes Mateusz, you understood right.

On Mon, Feb 20, 2012 at 4:07 PM, Mateusz Marzantowicz <
mmarzantow...@gmail.com> wrote:

> Yes, it works!
>
> Although I was previously installing Django according to docs at
> https://docs.djangoproject.com/en/1.3/topics/install/#installing-development-version,
>  your method works perfectly so far.
>
> I understand that keep in sync with trunk/master is as easy as invoking
> git pull (svn up) and then setup.py install in src/django directory in
> virtualenv root?
>
>
> Mateusz Marzantowicz
>
>
> On Mon, Feb 20, 2012 at 1:53 PM, Denis Darii wrote:
>
>> Do you mean django-trunk installation?
>>
>> If so, I use this in my requirements.txt:
>>
>> -e svn+http://code.djangoproject.com/svn/django/trunk/#egg=django-trunk
>>
>> or directly with pip:
>>
>> $ pip install -e svn+
>> http://code.djangoproject.com/svn/django/trunk/#egg=django-trunk
>>
>> Hope it helps.
>>
>> On Mon, Feb 20, 2012 at 1:36 PM, Mateusz Marzantowicz <
>> mmarzantow...@gmail.com> wrote:
>>
>>> Hello,
>>>
>>> I'm having a problem with managing Django installation which was done
>>> from git repository
>>> (might be svn as well) in clean virtual environment. The problem is that
>>> when I install some
>>> other package via pip which has a Django as a dependency, it doesn't
>>> find my django installation
>>> and then downloads official release. I really need only one Django
>>> installation in my virtualenv,
>>> the one from git :) It is more related to how pip works but does anyone
>>> has any idea how to do it the right way?
>>>
>>>
>>> Thanks,
>>> Mateusz Marzantowicz
>>>
>>>  --
>>> 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.
>>>
>>
>>
>>
>> --
>> This e-mail and any file transmitted with it is intended only for the
>> person or entity to which is addressed and may contain information that is
>> privileged, confidential or otherwise protected from disclosure. Copying,
>> dissemination or use of this e-mail or the information herein by anyone
>> other than the intended recipient is prohibited. If you are not the
>> intended recipient, please notify the sender immediately by return e-mail,
>> delete this communication and destroy all copies.
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To post to this group, send email to django-users@googlegroups.com.
>> To unsubscribe from this group, send email to
>> django-users+unsubscr...@googlegroups.com.
>> For more options, visit this group at
>> http://groups.google.com/group/django-users?hl=en.
>>
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>



-- 
This e-mail and any file transmitted with it is intended only for the
person or entity to which is addressed and may contain information that is
privileged, confidential or otherwise protected from disclosure. Copying,
dissemination or use of this e-mail or the information herein by anyone
other than the intended recipient is prohibited. If you are not the
intended recipient, please notify the sender immediately by return e-mail,
delete this communication and destroy all copies.

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



Re: Any Singaporean Django developers out there?

2012-02-26 Thread Denis Darii
 Is there some demand for django programmers?

On Sun, Feb 26, 2012 at 5:21 AM, Kolbe  wrote:

> It's like Django is nonexistent in Singapore!
>
> --
> 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.
>
>


-- 
This e-mail and any file transmitted with it is intended only for the
person or entity to which is addressed and may contain information that is
privileged, confidential or otherwise protected from disclosure. Copying,
dissemination or use of this e-mail or the information herein by anyone
other than the intended recipient is prohibited. If you are not the
intended recipient, please notify the sender immediately by return e-mail,
delete this communication and destroy all copies.

-- 
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: method for checking logged in user

2012-02-26 Thread Denis Darii
This is for you:
https://docs.djangoproject.com/en/dev/topics/auth/#django.contrib.auth.models.User.is_authenticated

On Sun, Feb 26, 2012 at 6:55 PM, rafiee.nima  wrote:

> Hi
> I want to know is there any built in function to check if a user is
> logged in
> actually I want to check if a user from a request is logged in or not
> tnx
>
> --
> 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.
>
>


-- 
This e-mail and any file transmitted with it is intended only for the
person or entity to which is addressed and may contain information that is
privileged, confidential or otherwise protected from disclosure. Copying,
dissemination or use of this e-mail or the information herein by anyone
other than the intended recipient is prohibited. If you are not the
intended recipient, please notify the sender immediately by return e-mail,
delete this communication and destroy all copies.

-- 
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: internationalization makemessage don't work

2012-02-27 Thread Denis Darii
Hi Nicolas.
Try to run makemessages script from the root directory of your Django app,
so:

$ cd /your/app/path/
$ mkdir locale
$ django-admin.py makemessages -l en


On Mon, Feb 27, 2012 at 10:54 PM, nicolas HERSOG  wrote:

> Yes, I have my app in INSTALLED_APPS and I also have added this key in my
> settings :
>
> USE_I18N = True
> USE_L10N = True
>
> MIDDLEWARE_CLASSES = (
> 'django.middleware.common.CommonMiddleware',
> 'django.contrib.sessions.middleware.SessionMiddleware',
> 'django.middleware.csrf.CsrfViewMiddleware',
> 'django.contrib.auth.middleware.AuthenticationMiddleware',
> 'django.contrib.messages.middleware.MessageMiddleware',
> 'debug_toolbar.middleware.DebugToolbarMiddleware',
> )
>
> TEMPLATE_CONTEXT_PROCESSORS = (
>  'django.contrib.auth.context_processors.auth',
> 'django.core.context_processors.debug',
>  '*django.core.context_processors.i18n*',
> 'django.core.context_processors.media',
>  'django.core.context_processors.static',
> 'django.contrib.messages.context_processors.messages'
> )
>
> INSTALLED_APPS = (
> 'django.contrib.auth',
> 'django.contrib.contenttypes',
> 'django.contrib.sessions',
> 'django.contrib.sites',
> 'django.contrib.messages',
> 'registration',
> 'mySUPERAPP',
> 'debug_toolbar',
> 'django.contrib.admin',
> 'captcha',
> )
>
> Did I miss something in MIDDLEWARE_CLASSES for exemple ?
>
> Ty all :)
>
> Nicolas
>
>
> On Mon, Feb 27, 2012 at 10:45 PM, Ian Clelland  wrote:
>
>> On Mon, Feb 27, 2012 at 1:36 PM, nicolas HERSOG wrote:
>>
>>> Fun fact, I tried the command manage.py compilemessages, it takes
>>> loong time to finish and parse all of my workspace in order to create
>>> translation file xD.
>>> All my home except my project :| ...
>>>
>>>
>> Does your INSTALLED_APPS setting contain the apps that should be
>> translated?
>>
>>
>> --
>> Regards,
>> Ian Clelland
>> 
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To post to this group, send email to django-users@googlegroups.com.
>> To unsubscribe from this group, send email to
>> django-users+unsubscr...@googlegroups.com.
>> For more options, visit this group at
>> http://groups.google.com/group/django-users?hl=en.
>>
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>



-- 
This e-mail and any file transmitted with it is intended only for the
person or entity to which is addressed and may contain information that is
privileged, confidential or otherwise protected from disclosure. Copying,
dissemination or use of this e-mail or the information herein by anyone
other than the intended recipient is prohibited. If you are not the
intended recipient, please notify the sender immediately by return e-mail,
delete this communication and destroy all copies.

-- 
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: internationalization makemessage don't work

2012-02-27 Thread Denis Darii
Of course, from the django documentation(
https://docs.djangoproject.com/en/dev/topics/i18n/translation/#message-files
):

> The script should be run from one of two places:
>
>- The root directory of your Django project.
>- The root directory of your Django app.
>
> The script runs over your project source tree or your application source
> tree and pulls out all strings marked for translation.
>

So "The script runs over your project source tree or your application
source tree"...

On Mon, Feb 27, 2012 at 11:03 PM, nicolas HERSOG  wrote:

> I've already tried this, django created LC_MESSAGE folder in locale, but
> this folder is empty (no django.po file is generated :/)
>
> I'm guessing if the problem is not the way i tagged the things to
> translate ...
> I added to all the html files i wanted to translate the tag {% load i18n
> %} and all the strings i wanted to translate are between {%trans
> "myStringToTranslate" %}
>
> Is the fact that my /template folder is not in the same path than m apps
> may be a problem ?
>
>
> On Mon, Feb 27, 2012 at 10:58 PM, Denis Darii wrote:
>
>> Hi Nicolas.
>> Try to run makemessages script from the root directory of your Django
>> app, so:
>>
>> $ cd /your/app/path/
>> $ mkdir locale
>> $ django-admin.py makemessages -l en
>>
>>
>>
>> On Mon, Feb 27, 2012 at 10:54 PM, nicolas HERSOG wrote:
>>
>>> Yes, I have my app in INSTALLED_APPS and I also have added this key in
>>> my settings :
>>>
>>> USE_I18N = True
>>> USE_L10N = True
>>>
>>> MIDDLEWARE_CLASSES = (
>>> 'django.middleware.common.CommonMiddleware',
>>> 'django.contrib.sessions.middleware.SessionMiddleware',
>>> 'django.middleware.csrf.CsrfViewMiddleware',
>>> 'django.contrib.auth.middleware.AuthenticationMiddleware',
>>> 'django.contrib.messages.middleware.MessageMiddleware',
>>> 'debug_toolbar.middleware.DebugToolbarMiddleware',
>>> )
>>>
>>> TEMPLATE_CONTEXT_PROCESSORS = (
>>>  'django.contrib.auth.context_processors.auth',
>>> 'django.core.context_processors.debug',
>>>  '*django.core.context_processors.i18n*',
>>> 'django.core.context_processors.media',
>>>  'django.core.context_processors.static',
>>> 'django.contrib.messages.context_processors.messages'
>>> )
>>>
>>> INSTALLED_APPS = (
>>> 'django.contrib.auth',
>>> 'django.contrib.contenttypes',
>>> 'django.contrib.sessions',
>>> 'django.contrib.sites',
>>> 'django.contrib.messages',
>>> 'registration',
>>> 'mySUPERAPP',
>>> 'debug_toolbar',
>>> 'django.contrib.admin',
>>> 'captcha',
>>> )
>>>
>>> Did I miss something in MIDDLEWARE_CLASSES for exemple ?
>>>
>>> Ty all :)
>>>
>>> Nicolas
>>>
>>>
>>> On Mon, Feb 27, 2012 at 10:45 PM, Ian Clelland wrote:
>>>
>>>> On Mon, Feb 27, 2012 at 1:36 PM, nicolas HERSOG wrote:
>>>>
>>>>> Fun fact, I tried the command manage.py compilemessages, it takes
>>>>> loong time to finish and parse all of my workspace in order to create
>>>>> translation file xD.
>>>>> All my home except my project :| ...
>>>>>
>>>>>
>>>> Does your INSTALLED_APPS setting contain the apps that should be
>>>> translated?
>>>>
>>>>
>>>> --
>>>> Regards,
>>>> Ian Clelland
>>>> 
>>>>
>>>> --
>>>> You received this message because you are subscribed to the Google
>>>> Groups "Django users" group.
>>>> To post to this group, send email to django-users@googlegroups.com.
>>>> To unsubscribe from this group, send email to
>>>> django-users+unsubscr...@googlegroups.com.
>>>> For more options, visit this group at
>>>> http://groups.google.com/group/django-users?hl=en.
>>>>
>>>
>>>  --
>>> You received this message because you are subscribed to the Google
>>> Groups "Django users" group.
>>> To post to this group, send email to django-users@googlegroups.com.
>>> To unsubscribe from this group, se

Re: Learning Django: DjangoProject Poll application

2012-02-29 Thread Denis Darii
try to use DjangoStack 1.4b1-0 instead of 1.3.1-1

On Wed, Feb 29, 2012 at 7:07 AM, WuWoot  wrote:

> https://docs.djangoproject.com/en/dev/intro/tutorial01/
>
> I'm using the Djangostack (Python 2.7.2+; Django 1.3.1-1) from Bitnami
> ran on Ubuntu 11.10 with PostgreSQL 9.1.2
>
> Sorry for my newbie question.
>
> I got to the portion where it asks me to import timezone from the
> django.utils module but all I manage to receive is:
>
> >>> from django.utils import timezone
> Traceback (most recent call last):
>  File "", line 1, in 
> ImportError: cannot import name timezone
>
> If I cannot do the above, I cannot get to the next line in the shell:
>
> >>> p = Poll(question="What's new?", pub_date=timezone.now())
>
>
> Anybody ever encounter this issue? I've attempted to look for a
> timezone setting in my settings.py and the only setting I can modify
> seems to be the location. A preliminary Google search and
> StackOverflow search turned up nothing. Your help is greatly
> appreciated. 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.
>
>


-- 
This e-mail and any file transmitted with it is intended only for the
person or entity to which is addressed and may contain information that is
privileged, confidential or otherwise protected from disclosure. Copying,
dissemination or use of this e-mail or the information herein by anyone
other than the intended recipient is prohibited. If you are not the
intended recipient, please notify the sender immediately by return e-mail,
delete this communication and destroy all copies.

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

2012-03-02 Thread Denis Darii
1. http://pinaxproject.com/
2. http://django-userena.org/

On Fri, Mar 2, 2012 at 9:26 PM, Bolang  wrote:

> Can someone suggest me an application for adding user profile to django?
> I have found 
> http://code.google.com/p/**django-profile/and
> https://bitbucket.org/**ubernostrum/django-profilesbut
>  those 2 projects don't receive update recently.
>
> 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+unsubscribe@**
> googlegroups.com .
> For more options, visit this group at http://groups.google.com/**
> group/django-users?hl=en
> .
>
>


-- 
This e-mail and any file transmitted with it is intended only for the
person or entity to which is addressed and may contain information that is
privileged, confidential or otherwise protected from disclosure. Copying,
dissemination or use of this e-mail or the information herein by anyone
other than the intended recipient is prohibited. If you are not the
intended recipient, please notify the sender immediately by return e-mail,
delete this communication and destroy all copies.

-- 
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 filters and translations to russian language

2012-03-07 Thread Denis Darii
Try to change also the language of your browser, this because you have
LANGUAGES = (('ru', 'Russian'), ('en_US', 'English'))

and probably in your browser is set EN.

Or force it to RU:

from django.utils.translation import activate
activate('ru')


On Wed, Mar 7, 2012 at 12:20 PM, Tom Evans  wrote:

> On Wed, Mar 7, 2012 at 9:38 AM, filias  wrote:
> > Hi,
> >
> > I am developing a website in russian and the original is in english. We
> are
> > using the po file to translate the strings.
> >
> > My problem now is that when I use template filters, for example date or
> > localnaturalday the translations do not appear. Everything appears in
> > english.
> > However, if I change the LANGUAGE_CODE from 'ru' to 'de_DE' everything
> > appears correctly in german.
> >
> > My settings are:
> >
> > LANGUAGES = (('ru', 'Russian'), ('en_US', 'English'))
> > LANGUAGE_CODE = 'ru'
> >
> > What am I missing here?
> >
> > Thanks for the help.
>
> I think you are missing this:
>
>
> https://docs.djangoproject.com/en/1.3/topics/i18n/localization/#locale-restrictions
>
> Although it looks like Django 1.3 has a ru translation, so I'm not
> convinced..
>
> Cheers
>
> Tom
>
> --
> 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.
>
>


-- 
This e-mail and any file transmitted with it is intended only for the
person or entity to which is addressed and may contain information that is
privileged, confidential or otherwise protected from disclosure. Copying,
dissemination or use of this e-mail or the information herein by anyone
other than the intended recipient is prohibited. If you are not the
intended recipient, please notify the sender immediately by return e-mail,
delete this communication and destroy all copies.

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

2012-03-07 Thread Denis Darii
using django? hmmm...

you can browse your current repo via http on port 8000 by launching:

$ hg se

or:

$ hg se -n "Your repo"

On Wed, Mar 7, 2012 at 1:39 PM, siva <85s...@gmail.com> wrote:

>
>
> Is it possible can we see hg repository using django ?
>
> --
> 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.
>
>


-- 
This e-mail and any file transmitted with it is intended only for the
person or entity to which is addressed and may contain information that is
privileged, confidential or otherwise protected from disclosure. Copying,
dissemination or use of this e-mail or the information herein by anyone
other than the intended recipient is prohibited. If you are not the
intended recipient, please notify the sender immediately by return e-mail,
delete this communication and destroy all copies.

-- 
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 admin login

2012-03-14 Thread Denis Darii
Try to create your superuser again:

./manage.py createsuperuser


On Wed, Mar 14, 2012 at 6:25 PM, vikalp sahni  wrote:

> You have to check your
>
> SESSION_COOKIE_DOMAIN in settings file if i.e pointing to "localhost" (if
> not cookies will not properly set and hence login will not be allowed)
>
> the best would be to use some host entry like example.com 127.0.0.1 and
> then use that in SESSION_COOKIE_DOMAIN and for accessing project on browser.
>
> Regards,
> //Vikalp
>
>
> On Wed, Mar 14, 2012 at 10:51 PM, dummyman dummyman wrote:
>
>>
>> Hi,
>> I created a new project in django
>>
>> 1.I created a new database
>> 2. I created a new user
>> 3.python manage syncdb
>> 4.python manae.py runserver
>>
>> when i visit localhost:8080/admin -> it asks for username n passwd. but
>> the login fails inspite of entering correct one
>>
>> But it works for a different project
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To post to this group, send email to django-users@googlegroups.com.
>> To unsubscribe from this group, send email to
>> django-users+unsubscr...@googlegroups.com.
>> For more options, visit this group at
>> http://groups.google.com/group/django-users?hl=en.
>>
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>



-- 
This e-mail and any file transmitted with it is intended only for the
person or entity to which is addressed and may contain information that is
privileged, confidential or otherwise protected from disclosure. Copying,
dissemination or use of this e-mail or the information herein by anyone
other than the intended recipient is prohibited. If you are not the
intended recipient, please notify the sender immediately by return e-mail,
delete this communication and destroy all copies.

-- 
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: What directory do I install Django on Linux server

2012-03-14 Thread Denis Darii
Hello Alex.

Yes, when you install django using *"pip install django*" or "*python
setup.py install*" directly from the source, the code goes to the correct
directory inside of the "current" sites-packages.

To find out where your installed django code is placed you can simply run:

$ python -c "import django; print(django.__path__)"

Hope it helps.

On Wed, Mar 14, 2012 at 7:00 PM, Alex Glaros  wrote:

> Does it make any difference what directory I download and unzip Django
> tarball on a Linux server?
>
> Should it be nside the Python directory?
>
> When I install, does it find its correct directory by itself?
>
> thanks,
>
> Alex Glaros
>
> --
> 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.
>
>


-- 
This e-mail and any file transmitted with it is intended only for the
person or entity to which is addressed and may contain information that is
privileged, confidential or otherwise protected from disclosure. Copying,
dissemination or use of this e-mail or the information herein by anyone
other than the intended recipient is prohibited. If you are not the
intended recipient, please notify the sender immediately by return e-mail,
delete this communication and destroy all copies.

-- 
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: playing with random number

2012-03-25 Thread Denis Darii
Nikhil please only django related questions here. Write to python-users
group for your problem but only after googling it... I'm pretty sure you
will find lots and lots of related questions/solutions.

Denis.

On 25 March 2012 19:07, Nikhil Verma  wrote:

> Hi all
>
> I have a list say
>
> li = [13,2,13,4]
>
> Now i want to use random number such that the list modifies into a
> dictionary like this:-
>
> di = {13: 'abc',2:'def',13:'abc',4:'xyz'}
>
> Point to be noted is if the list contains the number it should generate
> the same random number.
> How can i achieve this ?
>
> Thanks in advance.
>
> --
> Regards
> Nikhil Verma
> +91-958-273-3156
>
>  --
> 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.
>



-- 
I'm using Linux because i'm freedom dependent.

-- 
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: Simple question on queryset.

2012-03-27 Thread Denis Darii
I think the error "Memberships has no attribute all" is not related to your
QuerySet. Try to look deeply into your code.

BTW, your QuerySet must be:

queryset = Memberships.objects.get(id=4)

or better, if your id is also the primary key:

queryset = Memberships.objects.get(pk=4)

On 27 March 2012 08:57, Stanwin Siow  wrote:

>
> Hello,
>
> How do i transform this SQL query into a queryset?
>
> select membership_type from memberships where id ='4'
>
> i tried the following:
>
> queryset = Memberships.objects.get(id__exact=4)
>
> however django is throwing me an error with the following:
>
> Memberships has no attribute all.
>
>
> I know this is a trivial question but i've been through the tutorials
> https://docs.djangoproject.com/en/dev/topics/db/queries/
>
> and i don't unds where this error is coming from.
>
> Do appreciate any help rendered.
>
> Thank you.
>
>
> Best Regards,
>
> Stanwin Siow
>
>
>
>  --
> 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.
>



-- 
I'm using Linux because i'm freedom dependent.

-- 
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: Problem with get_or_create

2012-04-23 Thread Denis Darii
Murilo, try to debug your "task" variable - must be an int.
Also next time please provide full traceback of your error.

On 23 April 2012 17:42, akaariai  wrote:

> On Apr 23, 4:26 pm, Murilo Vicentini 
> wrote:
> > Hey guys,
> > I'm having a bit of a problem using the get_or_create with a
> > ManyToManyField in my model.
> > class Run(models.Model):
> > distros = models.ForeignKey('Distro')
> > compilers = models.ManyToManyField('Compiler', blank=True,
> > null=True)
> > adapters = models.ForeignKey('Adapter')
> >
> > Task = models.IntegerField()
> > Path = models.CharField(max_length = 300)
> > Date_Time = models.DateTimeField()
> >
> > class RunForm(ModelForm):
> > class Meta:
> > model = Run
> >
> > What I'm trying to do is merely trying to save in the database if the
> entry
> > does not exist already (hence why I'm trying to use get_or_create). Here
> is
> > how I'm doing:
> > fields = {
> >  'Task': task,
> >  'Path': runpath,
> >  'Date_Time': datetime(2012, 4, 10, 10, 20, 0),
> >  'adapters': adapters.id,
> >  'distros': distros.id,}
> >
> > form = RunForm(fields)
> > if form.is_valid():
> >   runs, created = Run.objects.get_or_create(**form.cleaned_data)
>
> Try "runs = form.save()", get_or_create doesn't seem to be the correct
> method in this situation.
>
> If you want to skip some fields you can use the form's Meta attributes
> to do that.
>
>  - Anssi
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>


-- 
I'm using Linux because i'm freedom dependent.

-- 
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 + ajax waiting page, can not redirect to result page

2011-12-16 Thread Denis Darii
You can view your js errors by pressing CTRL+SWIFT+J in Firefox but i
highly recommend you to install Firebug addon which allow you to view also
the received data from your ajax request.

On Fri, Dec 16, 2011 at 5:24 AM, yun li  wrote:

> Since I am really know nothing about ajax, I am not sure if I
> understand "try changing the return value from the view to a string "
> the right way. I changed the definition of run_DHM this way
>
> def run_DHM(request):
>xx = {'ok':true}
>return(xx)
>
> but still the same as before.
>
> and how I can check if there is any error in JavaScript console in my
> browser ?
>
>
> On 12月15日, 上午8时57分, Brett Epps  wrote:
> > I think the problem might be that you're using the getJSON function,
> which
> > expects a JSON response, but your view returns 'OK', which is not valid
> > JSON. The callback you have given to getJSON only gets called on
> "success"
> > (meaning a JSON document was retrieved) - that's why nothing is happening
> > for you right now. Try changing the return value from the view to a
> string
> > containing:
> >
> > {"ok": true}
> >
> > And then change this line in the JavaScript:
> >
> > if (data == 'OK') {
> >
> > to:
> >
> > if (data.ok) {
> >
> > I think it should work with those changes. If it doesn't, try checking
> the
> > JavaScript console in your browser for any errors.
> >
> > Brett
> >
> > On 12/14/11 4:03 PM, "yun li"  wrote:
> >
> >
> >
> >
> >
> >
> >
> > >But it still cannot work. when I submit something, it goes to the
> > >please_wait page showing "please wait" and then nothing happened. I
> > >really have no knowledge on ajax, so is there something I need to
> > >install or import in my projects? and how can I test if codes in
> > > ... really invoked?
> >
> > >Thanks,
> >
> > >On 12月14日, 下午1时47分, Brett Epps  wrote:
> > >> I think the problem is that your  tag is incorrect. You're
> using
> > >> the same one to load jQuery and to add your code, so your JavaScript
> is
> > >> not getting run. The file "please_wait.html" should look like this:
> >
> > >> 
> > >> 
> > >> 
> > >> Please wait.
> > >> 
> > >>