Hi Guys,
> And i want ask about settings.py, if we make the settings become a folder
> and put dev.py, prod.py, any step to make manage.py know which one to
> load. Seems there is no info about it in the blog.
>
I often create a settings module like above:
settings
-->__init__.py
-->ba
Hi guys!
I didn't find anything suitable about it. I want to create a way to
the admin "add" button be affected by the changelist filter. Suppose I
have a list of blog posts and I filtered it by category:
.../admin/blog/post/?category=1
I want that the add button have the same query string:
...
Hi Russ,
> ... this is an
> area where I think there is lots of room for improvement now that we
> have a class-based foundation to work with.
Thanks for your reply!
I started my own "multiple forms view":
https://gist.github.com/1029336
I see the ticket's approach is much more complete, I wil
Hi guys,
Is there a general guideline to work with class based generic views
and multiple forms? I already use FormView but it seems focused on a
single form.
Suppose a user profile registration: with function based views, I use
two forms, one for the user account and other for the profile.
I ca
Hi,
> I love markdown for writing content on websites. I use it almost all the
> time when I'm working with django.
I like markdown too. I found an wysiwym editor for it:
http://code.google.com/p/wmd/
It is pretty simple to attach it on the admin interface.
Regards,
Michel Sabchuk
Brasil
--
You can hit the counter through ajax and still keep the cache of the
entire page. This is useful if you have a cache through nginx +
memcached.
Regards,
On 7 fev, 20:15, "Henrik Genssen" wrote:
> are you using middleware or a decorator for caching your view?
> if you are using a decorator like @
Hi!
> basically does what i'm think of doing, but in a different area
I make the thumb generation using the template tag but AFAIK easy
thumbnails have a ThumbnailerImageField that can be configured to pre
generate the thumbs.
> also doesn't send the thumbnail over to cloudfiles, which is really
Hi,
> setting up django-storages was simple...
I recommend you to use django-cumulus [1] rather than django-storages.
The first one is a rewrite made by the same author.
> however... on the save of my gallery application i'm creating
> thumbnails. this is easy to do with my custom field... norma
Hi,
> I have 2 css files. One specifically for IE because it's so horrible.
> I'd like to load either or css files depending on the browser.
Why don't you use conditional comments?
http://www.quirksmode.org/css/condcom.html
Best regards,
--
Michel Sabchuk
--
You received this message because
Hi guys,
First of all, merry christmas for all of you ;)
I using an ajax approach to show the comments form. I need to mix this
approach with a common approach, this is not a problem for the preview
page because I can create app specific templates (i.e. "comments/app/
preview.html" instead of "co
Hi guys,
I'm working on a group buying website like groupon. This page have a
regressive counter that tells the user how many time is available
before the end of the deal publishing.
I want to cache this site: I want to put nginx to serve memcached
directly and only when the page is not found in
Hi,
> I'm not sure this is even a task for Django. If your primary concern is
> performance, try doing this directly in Apache or another web server via
> rewrite rules and use the access logs to do the accounting. Apache is good at
> access statistics.
Does your CDN offers statistics? I use r
Hi guys, how are you?
I'm using some model forms to edit DateTimeFields and DecimalFields. I
wanted to localize the input/output of these fields. Django 1.2 comes
with a localization method. If I set the USE_L10N setting, it is
supposed to have the forms fields localized.
The DateTimeField works
Why not redirect all variants to http://mysite.com/?
Nginx could do the job for you ;)
Best regards.
On 5 out, 13:17, harryos wrote:
> hi
> I am trying out a web app where it needs to process user given website
> addresses .My problem is that ,I need to treat
> http://mysite.com,www.mysite.com
Hi guys!
I'm migrating from sorl thumbnails to the good easy_thumbnails [1] for
image dealing. It let me store the thumbnails on a container on
Rackspace Cloudfiles [2] (similar to Amazon S3).
I try it for jpeg images and it worked perfectly: it get's the file
from my container, crop the image wi
Hi guys,
I manage a Brazilian free ads portal and recently I migrated the
static files to rackspace cloud files [1] (Amazon S3 like). Now the
site open much faster but the media files are still in the same server
of django.
I couldn't migrate the dynamic media files to rackspace cloud files
becau
Hi guys!
I've found the sollution. If I use to following code, it works:
"""
from django.views.generic.simple import direct_to_template
urlpatterns = patterns('',
(r'^$', cache_page(direct_to_template, 60*15),
{'template':'home.html'}),
)
"""
Note that I specify the cache timeout in the cac
Hi guys,
I'm migrating a project from django1.1 to django1.2.1 and I have
problems with cache.
I used to write on the urls:
"""
from django.views.generic.simple import direct_to_template
urlpatterns = patterns('',
(r'^$', cache_page(direct_to_template), {'template':'home.html'}),
)
"""
Thi
Hi guys,
I make use of archive_month to a monthly navigation of an object_list.
I have a previous month and a next month context variables that helps
me to create a navigation menu.
Now I must use archive_week to do the same approach but I missed
next_week and previous week context variables.
I
Hi Andy,
I do not use a different server for media yet but it is in project.
Maybe I could help:
> 2. Do you typically use a different hosting company for the media
> server than you do for the django server? If so, can you suggest any
> names?
There is the Amazon S3 and Rackspace Cloudfiles ser
Hi guys,
I found 2 e-commerce applications available for django: Satchmo [1]
and LFS [2]. None of then is widely used in country (Brazil). I
planning to adapt them to the Brazilian reality, create payment
modules, etc.
I will try both before make a choice. Anyway, do you have any useful
note abou
> The problem is that this expanding of callables are done on
> "formfield" method of the field class and this method is called in the
Sorry by this email guys, I just found a ticket talking about it:
http://code.djangoproject.com/ticket/11940
It seems the problem is fixed.
Thanks!
--
Michel
Hi guys,
I'm working on a cms running over django1.1.1 and I'm facing a weird
problem.
I have a BlogPost model that uses a callable (datetime.datetime.now)
as default value for some field.
I created my own views for manage blog posts. The view make use of a
BlogPostForm ModelForm class, defined
Hi Waqqas,
> Ideally, yes, the design should only by in CSS, but how about we want to
> make a theme for mobile user? The contents of the page (html) can not be the
> same.
> Having different html for theme helps in incorporating different CSS.
I working on a CMS that uses that idea. I have theme
Hi,
> I have a Ticket model that has a Requirement foreign key. The problem
> is, there could be hundreds of requirements. Offering the user a drop
> down combo box of requirements to choose from isn't the best option.
> So how would you let the user select one record from a large
> selection? Wha
Hi guys,
> You're not going to get any meaningful feedback by looking at high
> profile sites, because you don't know if the backend is similar to yours
> or what they did for scaling.
Alexandru is right. The server arrangement can speed up your
performance.
> I'm currently developing a custom-
Hi guys,
I'm using the following snippet to duplicate instances of objects:
http://www.djangosnippets.org/snippets/1282/
The problem is that some objects have signals connected to auto create
some related information. What do you suggests me to avoid problems
with these signals? I found the fol
Hi guys,
Is there a way, or at least some talk about make complex filters on
the admin interface? See my use case:
I have a list of cities and I already do a "list_filter" to the
provinces. My cities queryset do an aggregation to append the people
count for each city, I want to have a list_filte
Hi Thomas,
> If you use raw_id the ID of the foreign key gets displayed right to the
> input field. It would be nice to make it a hyperlink.
I use this ticket to get what you want:
http://code.djangoproject.com/ticket/7923
It would be good to have this ticket applied on django trunk ;)
Best r
Hi guys,
Is there a way to filter an aggregation? Suppose the following code:
Book.objects.annotate(num_authors=Count('authors')).order_by
('num_authors')
How can I count only masculine authors or authors by age? I think a
cool way could be:
Book.objects.annotate(
num_authors=Count('authors
Hi Ramdas,
> It would be great if you can throw some more light on your solution. Sounds
> like a splendid idea and will be helpful for many including me
This is easy, I loaded the page through urllib and write it to a
static file, then I served the file through nginx. Anyway, I will
create a sn
Hi Ramdas,
> I have a web site where around 15 SQL semi complex queries run on the home
> page. Traffic is increasing and the page loads are getting slower. What is
> the best way to cache just the home page. I have already done standard
> memcached on the server.
I'm still learning about cachin
Hi Adam,
> I'm presuming I will use the sites app. However, I don't see how I
> can create and set the SITE_ID through the admin (which is necessary
> for number 2).
>
> Would people suggest that I use the RequestSite class from the sites
> app which uses the HttpRequest variables? If so, does
Hi Tino,
> Wouldn't it be easier to create a 'lock-file'? Have your middelware check
> for the lock file, if it's present, block access, if not, do nothing.
You are right, a lock file is easier, thanks for pointing me at that.
Anyway, I want to use the settings file instead of a lock file,
supp
Hi guys,
I need to block access to my site during a time period, when a script
is running and do some calculations. I want to avoid user interaction
during this calculations, this is why I want to block access to the
site when the script starts and liberate when the script ends.
First of all, I
Hi guys,
>> That is very odd indeed. Are there other Django instances within the
>> same virtual host?
> It doesn't strictly have to be other Django instances, it can be PHP
> or mod_perl as well. Basically anything that runs embedded in Apache
> processes and which expects a different timezone
Hi guys,
I'm having a weird problem with TIME_ZONE settings. Some view list
objects based on the time, future time objects are not shown.
The problem is that sometimes all objects that need to be shown appear
normally, sometimes the latest objects are not shown.
Digging on the problem I found t
Hi guys,
I'm facing strange problems with dates in django. I have an object
list called from a view with the following code is
...
now = datetime.datetime.now()
period_limit = now - datetime.timedelta(days=30)
queryset = queryset.filter(
item__pub_date__lte=now, # no future items
item_
Hi guys,
I'm loooking for a way to update only one field when changing a model.
I started from:
object = get_object_or_404(SomeModel)
object.hits += 1
object.save()
I using django1.1. I saw there is a ticket talking about this:
http://code.djangoproject.com/ticket/4102
And a snippet too:
htt
Michael,
The 1.0.2 version of comments is buggy, at least it can't be used on a
custom interface. Try reading the __init__.py, views/comments.py
functions of comments framework. I tryed to apply a custom form on the
comments framework (without a new model, only adding captcha), I have
no success
Hi,
> You don't say what version of Django you are using. This sounds like you
> want exactly the kind of customization described here:
>
> http://docs.djangoproject.com/en/dev/ref/contrib/comments/custom/
Yes, I already following it, but with 1.0.2 django version :)
> That page doesn't exist i
I found a better way to hack :)
In the django.contrib.comments.__init__ file, I changed the get_model,
get_form and get_form_target method to something like:
def get_form():
if get_comment_app_name() != __name__ and hasattr(get_comment_app
(), "get_form"):
return get_comment_app().ge
Hi Guys,
I created a custom comments app to make use of captcha. I didn't
change the mode, I just change the form to make use of django-simple-
captcha [1].
To make all magic works I need to do some hacks in django comments
framework. I want to use the existing views, I don't want to write it
my
Hi guys,
Is there a way to use advanced list_filter in admin? I can filter by
pub_date but is there a way to filter by pub_date__isnull or by some
python function?
I want to filter all entries with pub_date set to None but I don´t
want to change the modeladmin queryset, how can I do this?
Best
Hi Ricardo,
> 1) Is there a sane way to make a custom widget that extends Select and
> that has its options grouped by in tags according to some
> criteria?
Pass a grouped list to choices:
['group1', [(1, 'item 1'), (2, 'item 2'), ...], ...]
> 2) How one does make the built-in admin app to us
Hi Merrick,
> How can I access request.user in a clean method of a ModelForm?
>
> class UserEmailForm(ModelForm):
> ...
>
You can instantiate your form passing the request or the user as
argument:
class UserEmailForm(ModelForm):
def __init__(self, *args, **kw):
self.request = kw.pop
Hi guys,
What is the best way to work with 2 models on the same forms? Suppose
I have the following case:
class Profile(models.Models):
user = models.ForeignKey(User)
some_data = models.CharField()
How can I add a profile and a user on the same form using ModelForm? I
used to do:
class
Hi nsash,
> def save(self, size=(80, 80)):
> super(Artwork, self).save()
> if self.file:
> filename = self.file
> image = Image.open(filename)
>
> image.thumbnail(size, Image.ANTIALIAS)
Hi guys,
I have a server structure similar to yours. The settings.py file
differs, the settings.py is under version control and I have a
custom_settings.py not versioned. At the end of the settings.py file I
import the custom one. The custom_settings.py is not versioned.
Best regards,
--~--~
Hi guys,
I´m using newforms-admin and I have a suggestion on newforms-admin
that I want you look at. I have a news application and each entry has
an author, the superuser can add entries choosing an author on the
author list but when a staff user adds an entry, I want the author
field be autofill
Hi guys!
I´m using the has_permission method of the AdminSite class to filter
which users can access the admin page:
class SuperuserAdminSite(admin.AdminSite):
def has_permission(self, request):
return super(SuperuserAdminSite, self).has_permission(request)
and request.user.is_superu
Hi guys,
I´m using the newforms-admin branch and I have one thing to note about
modelforms. I used a revision (I can´t tell what) and to instanciate
the form I need to do:
edit_form = ModelForm(request.POST, instance=instance_object)
create_form = ModelForm(request.POST)
Now the revision change
Hi!
> The newforms.txt documentation in the newforms-admin branch contains a
> detailed discussion on the capabilities of the new Media class.
I will take a look on the newforms and modeladmin documentation. Very
thanks!
Best regards...
Michel
--~--~-~--~~~---~--~---
Hi guys,
I'm trying to extend a ModelForm, I had success but I must redefine
the Meta class, it doesn't got extended. Is this a bug? See the
following code:
class Form1(forms.ModelAdmin):
class Meta:
model = SomeType
class Form2(Form1):
extra_field = forms.CharField(max_length=6
late extending the "admin/
change_form.html" and appending the proper scripts I need. Is this the
recomended way now? The lack of js option in the admin configuration
is proposital?
Thanks for help!
--
Michel Thadeu Sabchuk
--~--~-~--~~~---~--~~
You re
Hi!
I could not find an open ticket so I open it myself ;)
http://code.djangoproject.com/ticket/6226
I could write the patch, but I don't know what is the best approach,
if we must port allow_tags or if the function should return a
SafeString instance. Even breaking backward compatibility, I thi
Hi again Simon,
> @ Michel: I think the best approach is to use a separate IP for Lighttpd to
> listen on, but it should be equally easy to have Lighttpd listen on
> for example port 81.
Hum, understood. The last one question (I think :-P). The use of
apache to redirect connections to lighttpd t
stions!
Thanks all help!
Best regards,
--
Michel Thadeu Sabchuk
MisterApe
--~--~-~--~~~---~--~~
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
on the other server I got and serve the
partners header throught it to see what does happen. Do you know any
performance logging tool I can use to measure if my action solves
anything?
Graham, thanks for all the help :-P
Best regards!
--
Michel Thadeu Sabchuk
MisterApe
--~--~-~--~~--
er server, but the header is on my
server), but I don´t know if it is a pertinent information :P
I am very thankfull for all your help,
Best regards.
[1] http://www.jacobian.org/writing/2005/dec/12/django-performance-tips/
[2] http://www.car-chase.net/2007/apr/30/django-deployment-lessons-learned/
database and maybe
another to media files?
Thanks for any help,
Best regards.
--
Michel Thadeu Sabchuk
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email
?
Thanks in advance...
Michel Thadeu Sabchuk
--~--~-~--~~~---~--~~
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 g
Hi guys,
First, thanks for the great help. I read your recomendations and fall
on 2 solutions:
1) Upgrade django to version 0.96. I see some people run into problems
with mysql (postgresql too), the recomended revision is [5511]. I don
´t work on this project (the site I´m keeping) from the star
Hi guys!
First of all, thanks for all help, I was busy on a project last week
and could not dig into the problem.
Let me remeber the thread, I having a problem, sometimes my server
stuck and goes down, just before it happens, I receive many messages
telling "Too many connections". I use apache +
of emails.
I don´t know where should I look at to solve my problem. Some people
tell me to use a static index page server by apache, generated by a
cron job, do you think it´s really necessary? Does anyone is facing
such problem?
Any help will be greatfull,
Best Regards!
--
Michel Thad
Hi guys!
Is there a default way to count how many times a user logged in over
the django auth framework? As I read the source of django.contrib.auth
I didn´t find anything, but I must be sure of this before starting my
own solution.
Thanks in advance!
--~--~-~--~~~-
Hi guys!
I think it's not possible but I think this will be a good addition it
we could have a template extending itself. I made a project that used
sites framework and I missed this feature, now I need some improves on
admin interface to let flatpages use tinymce as default editor.
To let flatp
Hi
I use tinymce too, what rich text editor would you use (just to know
another options)?
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 dja
Index page doesn't need a view. Generally it is a static page, if it
have some dynamic data, it access through template tags. So, I follow
this structure:
project/
project/templates/
project/templates/main/
project/templates/main/base.html
project/templates/main/index.html
project/templates
Hi guys!
I have the following models:
...
from django.contrib.sites.models import Site
class Type(models.Model):
sites = models.ManyToManyField(Site)
class Product(models.Model):
type = models.ForeignKey(Type)
data = models.CharField()
class Admin:
list_filter = ['type'
Yep!
I got the last checkout and it's working now :) sorry about that...
Thanks Vinay!
Best regards
Michel Thadeu Sabchuk
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
"Django users" group.
l": "people.person", "fields":
{"name": "Mahatma Gandhi"}}, {"pk": "5", "model": "people.person",
"fields": {"name": "Homer Simpson"}}]
Thanks for any help, best regards!
--
Michel Th
Hi guys!
I have the following models:
class Product(models.Model):
data = models.TextField()
class Admin:
pass
class Photo(models.Model):
product = models.ForeignKey(Product, edit_inline=models.TABULAR)
file = models.ImageField(upload_to='', core=True)
descriptio
Hi guys!
I have the following models:
class Product(models.Model):
data = models.TextField()
class Admin:
pass
class Photo(models.Model):
product = models.ForeignKey(Product, edit_inline=models.TABULAR)
file = models.ImageField(upload_to='', core=True)
descriptio
Hi guys!
I'm having troubles to load fixtures data to the database, first of
all I try to dump the data:
./manage dumpdata noticias > noticias.json
Then I try clear the database for the "noticias" (news) application
and try to load the data:
...
$ ./manage.py loaddata noticias.json
Loading 'no
Hi guys!
Is there a way to define a custom manager on a ManyToMany
relationship? See the code above:
...
from django.contrib.sites.models import Site
class Country(models.Model):
...
class Person(models.Model):
country = models.ManyToMany(Country, related_name="people")
site = m
Hi Robbin,
> > I've done a method to resize images on demand on a template, it is a
> > simple filter that made use of PIL.Image, see the following template
> > code:
>
> Sounds similair to the nesh thumbnail
> utils:http://code.google.com/p/django-utils/wiki/Thumbnail
Hugh, very similar :), bu
Hi people!
I've done a method to resize images on demand on a template, it is a
simple filter that made use of PIL.Image, see the following template
code:
...
...
The code is already running, but I have another approach, reather than
use a filter, I can define an automatic custom method on t
Hi guys!
I've done a custom tag to use on my templates and I ned to pass a
variable to it, but this variable can or cannot exists. If the
variable doesn't exists, I get an error telling that form.data doesn't
have the key "city".
To avoid this error I've done:
{% block body_onload %}
{% if
Ok, and I think this is the right approach ;)
I have just one note: the admin interface turns the first character of
a custom label to uppercase. Should the admin interface follow the
same pattern and keep the custom label as is? I only get confused in
this question because of the different way t
Hi guys,
If I have a form defined on newforms as:
class MyForm(forms.Form):
field1 = forms.CharField(max_length=100)
field2 = forms.Charfield(max_length=100, label='custom field')
When I render the field, the label for field1 get his first character
uppercased and becomes "Field1", th
Hi guys,
I want to be able to add a images with same filename but I don't want
to replace old images when I repeat a name. Suppose I will add a
object with an image field and the filename is image.jpg, I want to be
able to add another object with another file, but this file is called
image.jpg to
Hi guys!
I want to use generic views to show all events on a year. I made use
of year_archive view to accomplish my task. I want to show up the
events on the year page categorized by its month, there won't be a
month page, but the object_list gives the events uncategorized.
I think on a filter,
Hi guys!
I want to do a 2 layer join, look at the tables:
class State(models.Model):
name = models.CharField(maxlength=200)
class Region(models.Model):
state = models.ForeignKey(State)
name = models.CharField(maxlength=200)
class City(models.Model):
region = models.ForeignKey(
Hi guys!
I'm having troubles using admin interface to add an inline object that
have a unique constraint in it. Look the code:
class Office(Model):
name = CharField(maxlength=200)
def website(self):
return self.office_set.all()[0]
def __str__(self):
return self.nam
Hi guys,
I have my database and my application set up to the UTF-8 charset (my
settings file have an option DEFAULT_CHARSET = 'UTF-8'). I don't have
to pass verbose_names or help_texts as unicode strings, I didn't have
any problem with character encoding using the admin interface, but now
I want
Hi guys,
I developing a site that uses i18n, I make my .po file, it's ok for
almost everything, my only question is how can I work with
internationalization on my objects. Suppose I have an object Article
and I must must insert an Article in English and in Brazilian
portuguese, what is the better
a way to order offices
by host_name (maybe working with joins) and is there a way to filter
by host_name?
Thanks in advance, best regards!
--
Michel Thadeu Sabchuk
Curitiba - Paraná - Brasil
--~--~-~--~~~---~--~~
You received this message because you are subscribe
Hi guys,
Does anyone worked on some way to django models work with composite
primary keys? I need to implement a login system and the login should
be unique for an specified username and a specified site url. I see the
ticket above and it seems the wasn't any advance after it.
http://code.django
Hi!
> See
> here:http://groups.google.com/group/django-users/browse_frm/thread/3328829...
But this uses the oldforms library, it will be deprecated, isn't it?
Is there a way to achieve the same with newforms?
Best Regards,
Michel
--~--~-~--~~~---~--~~
You rec
Hi guys!
The newforms.CharField class expects a max_length keyword to define the
max_length, the models.CharField expects a maxlength keyword (without
the underscore). Shouldn't the newforms.CharField class use maxlength
too?
Thanks
Michel Thadeu Sa
Hi Guillermo!
But what would happen in this case if two sites use very different
templates for the same app?
My templates used to have the same skeleton, the diference could be the
base_site.tmpl, I can replace the base_site.tmpl on the
project/templates/appname, I can use stylesheets to defi
Hi,
Yeah. And conversely, it's weird that in other places django smooshes
together what ought to be separate namespaces. For example, a
template can refer to the templatetags of any app without
qualification. Is there even a way to add qualification to
disambiguate? If I have two apps with
Hi!
I'm just a beginner with django but I miss this functionality too.
I will be glad if django loops could unpack the values of the list.
Regards,
Michel Thadeu Sabchuk
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the G
Hi!
I'm just a beginner with django but I miss this functionality too.
I will be glad if django loops could unpack the values of the list.
Regards,
Michel Thadeu Sabchuk
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the G
Hi guys!
I'm not very familiar with pg_hba.conf file but with your help I will
:D
Thanks for help!
--
Michel Thadeu Sabchuk
Curitiba/PR
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Django
users&
Hi guys!
I'm deploying a django project with postgresql as database backend. I
used to create a local user with the same name of the database user
(owner of the database), so I just need to run the webserver as the
local user and the database should work without problems (this was true
for webwa
Hi guys!
I'm porting a webware application to django. I really like the
autogenerated admin interface of django and the url design is terrific
:D, these project I'm porting has an own way to manipulate the data
from database, it uses MochiKit and SQLObject to do that.
So I change from SQLObject
Hi guys!
I used webware for a long time and I want to test newer tecnologies
now. I really liking the way Django works. One of the coolest thing I
see in django is the decoupling of applications to be able to attach
then in many projects.
Well, I'm trying the polls application and I try to be a
99 matches
Mail list logo