On 21/02/11 16:45, Tom Evans wrote:
On Mon, Feb 21, 2011 at 3:28 PM, Pascal Polleunus
wrote:
Hi,
How can one internationalize/translate a string like "Community" in this
code?
{% with _("Community") as link_label %}
{% include "includes/utils-more.html" %}
{% endwith %}
That simple,
On Feb 21, 4:22 am, Andre Terra wrote:
> I'd also like some input on this, as I'm reaching a point of my project
> where I'll have to deal with a similar issue. I was planning on using ajax,
> which actually means keeping it simple IMHO, but I would really like to
> follow best practice.
>
> Shoul
> SELECT * FROM table WHERE id IN (1, 3, 2) ORDER BY
> FIELD( id, 1, 3, 2 )
I got it to work, but I had to borrow .extra(where=[]), which I
consider a spectacular design failure of the .extra(order_by=[])
system.
Firstly, I TDD using SQLite3, so I had to write code to build either
FIELD(
On Feb 20, 2:19 pm, galago wrote:
> What is the best way, to select X random rows from DB? I know that
> method: .all().order_by('?')[:X] is not good idea.
> What methods do you use?
order_by('RAND()')
That might use the same seed each time.
To create, for example, a rotating home page with
On Feb 21, 12:47 pm, Cody Django wrote:
> Thanks -- I didn't know about mock objects, and this is good to know.
> But this doesn't feel like this is the solution I'm looking for. It's
> a large project, and your proposal would require extensive patching.
Does your project access the CAPTCHA set
Djangoes:
I have this question, copied from the archives:
8<-
I want to fetch a list of items in my database, and I have their id
ready:
my_ids_to_get = [ 1, 3, 2, ]
In mysql I would fetch them like this:
SELECT * FROM table WHERE id IN (1, 3,
Hello,
I'm working on tourism site and I'm searching for apps . Is there an
app for tourism, what is the best Apps for maps, Video and Image
gallery , ads help in adesne revenue share and users profile and panel
(like admin) , tags, RSS , reviews and forums
I know it is too much apps but I'm usi
2011/2/21 Vinicius Massuchetto :
> 2011/2/21 Daniel Roseman :
>> On Monday, February 21, 2011 5:47:42 PM UTC, Vinicius Massuchetto wrote:
>
>> You can't "convert" a list to queryset, as a queryset is - as the name
>> implies - a database query.
>
> I imagined that. =/
>
>> What you could do is get
If you know this is going to be an important part of the application, it might
make sense to have a random primary key, such as a UUID.
--
-- Christophe Pettus
x...@thebuild.com
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this
2011/2/21 Daniel Roseman :
> On Monday, February 21, 2011 5:47:42 PM UTC, Vinicius Massuchetto wrote:
> You can't "convert" a list to queryset, as a queryset is - as the name
> implies - a database query.
I imagined that. =/
> What you could do is get all the IDs from the list and pass that into
The default (from the doc F00_set so: )
playerVital_set
and playerSkills_set
So I want the first set for each of them ...
(sorry for the double post by the way)
On Feb 20, 9:10 pm, Shawn Milochik wrote:
> What are the related_name values you gave to the foreign key fields of
> your related mode
Hi Thomasz,
I have it working with your solution.
Thank you very much!
On 21 feb, 23:28, Tomasz Zieliński
wrote:
> On 21 Lut, 21:50, "Mishen'ka" wrote:
>
> > Hello all,
>
> > I have make a site with translated menu items etc.
> > Now i want to change the language on login.
>
> > By example i'm
On 21 Lut, 21:50, "Mishen'ka" wrote:
> Hello all,
>
> I have make a site with translated menu items etc.
> Now i want to change the language on login.
>
> By example i'm from the netherlands and want the Dutch language.
> or i'm from america, so i want English as language.
>
> So i have change f
Why doesn't setattr work? Just make sure you're setting the proper
option because apps often cache options at e.g. their 'config.py' file
in order to provide default values:
# captha_app/config.py
from django.conf import settings
CAPTCHA = getattr(settings, 'CAPTCHA', True)
So you'll have to chan
Please see my previous post with the django snippet for more info on this
method (as it uses this same principle).
On Mon, Feb 21, 2011 at 10:06 PM, Mikhail Korobov wrote:
> This is the function for getting 1 item that works even if some rows
> were deleted that works times faster than order_by('
Stackoverflow:
http://stackoverflow.com/questions/962619/how-to-pull-a-random-record-using-djangos-orm/971671#971671
On 22 фев, 03:06, Mikhail Korobov wrote:
> This is the function for getting 1 item that works even if some rows
> were deleted that works times faster than order_by('?') even for
This is the function for getting 1 item that works even if some rows
were deleted that works times faster than order_by('?') even for not-
so-big datasets at least on mysql:
def get_random_item(model, max_id=None):
if max_id is None:
max_id = model.objects.aggregate(Max('id')).values()
Hello People,
I have a blog I'm currently designing and I have a little challenge.
I can from the view get a template to render all the blogs in the database by
fetching
articles = Article.objects.all()
from the view and then loop over it in my template like so:
{% for article in articles %}
I need to do this in my tagcloud.
--
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 m
On Monday, February 21, 2011 5:47:42 PM UTC, Vinicius Massuchetto wrote:
>
> Hi.
>
> I know that's not exactly the proper way of building a queryset, but I
> managed to build a list of objects of a model across operations and
> annotations, and I want to show that an admin change list.
>
> I'm curr
Hi,
I want to test if a receiver function is connected to a signal in django,
but I don't want other receivers from other apps to be called when my test
runs.
I thought of verifying if my callback function is in the receivers list of
the signal, but this list stores the receivers in a strange way
Hello all,
I have make a site with translated menu items etc.
Now i want to change the language on login.
By example i'm from the netherlands and want the Dutch language.
or i'm from america, so i want English as language.
So i have change few things in the login pagina,
but it doesn't change my
Thanks -- I didn't know about mock objects, and this is good to know.
But this doesn't feel like this is the solution I'm looking for. It's
a large project, and your proposal would require extensive patching.
Is the solution to create a new testrunner that sets a different
environment (with diffe
I forgot to mention my development server is fastcgi/apache.
Thnaks
On Feb 21, 11:15 am, Josh Cartmell wrote:
> I have a simple login form on every page like this:
>
> {% csrf_token %}
>
> type="password">
>
>
>
> It was working great on the dev server. Then I went into production.
> Now ev
I have a simple login form on every page like this:
{% csrf_token %}
It was working great on the dev server. Then I went into production.
Now every form submission is being interpreted as a GET rather than a
POST unless I am actually on the page /shop/account/ (the forms
action). Has anyone
Why are you re-posting this? You posted it over the weekend. I
replied. If my reply didn't help, tell us the new problem you're
having.
--
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@googlegroup
On Feb 21, 2011, at 10:34 AM, Eric Chamberlain wrote:
> If you have lots of rows, this query is really slow as the db must build a
> new table for the ORDER BY.
You can do better if you have a guaranteed ordinal on the rows; otherwise, it
has to do a full table scan no matter what.
--
-- Chris
On Feb 20, 2011, at 4:30 PM, Christophe Pettus wrote:
>
> On Feb 20, 2011, at 2:19 PM, galago wrote:
>
>> What is the best way, to select X random rows from DB? I know that method:
>> .all().order_by('?')[:X] is not good idea.
>
> The best way is to push it onto the DB, using a raw query:
>
On Monday, February 21, 2011 07:53:03 am hank23 wrote:
> I have an html page which I'm trying to code. On it I have a form with
> multiple html controls/elements. In order to reference the elements on
> the page can I reference them directly with a
> document.getElementBy('') or do I need to refere
Greetings,
I'm having problem showing from the value a sub model.
I have a main model (team) I'm displaying the information, a team
contain a list players and these are listed in the page too.
So far so good, but here where its doesn't work, players have skill
and vital and I can't get to show the
Hi.
I know that's not exactly the proper way of building a queryset, but I
managed to build a list of objects of a model across operations and
annotations, and I want to show that an admin change list.
I'm currently declaring a queryset() method in modelAdmin, and
building this list there, but it
On Mon, Feb 21, 2011 at 4:39 PM, ju wrote:
> Is it possible to add form errors (not a field specific errors) to a
> form that is already validated (form.is_valid() is already called and
> the result is True)?
>
> I have additional validation logic (with database requests) which I
> prefer to execu
Is it possible to add form errors (not a field specific errors) to a
form that is already validated (form.is_valid() is already called and
the result is True)?
I have additional validation logic (with database requests) which I
prefer to execute after standard form validation is passed, but it
wil
Hi all,
I found a solution by myself and was already documented in the Django
documentation:
the best solution is to set apache with mod_python and the follwing
configuration:
SetHandler python-program
PythonHandler django.core.handlers.modpython
PythonPath "['/home/uolter/pycode/pootl
On Mon, Feb 21, 2011 at 9:00 AM, Jason Mayfield wrote:
> You can't just copy your Python binary around (which is what you'd be doing
> if you attempt to copy the virtualenv itself) unless the systems are exactly
> the same (and even then I'd be reticent to do so). Why not just download and
> c
I have an html page which I'm trying to code. On it I have a form with
multiple html controls/elements. In order to reference the elements on
the page can I reference them directly with a
document.getElementBy('') or do I need to reference them with the form
id as a prefix? If so how do I code that
On Mon, Feb 21, 2011 at 3:28 PM, Pascal Polleunus
wrote:
> Hi,
>
> How can one internationalize/translate a string like "Community" in this
> code?
>
{% with _("Community") as link_label %}
{% include "includes/utils-more.html" %}
{% endwith %}
Cheers
Tom
--
You received this message becau
Hi,
How can one internationalize/translate a string like "Community" in this
code?
{% with "Community" as link_label %}
{% include "includes/utils-more.html" %}
{% endwith %}
Thanks,
Pascal
--
You received this message because you are subscribed to the Google Groups "Django
users" group
Chris, please don't tell someone "this is the best way", when the solution
is dependant on so many other factors (as stated in my original reply). Our
answers strongly influence other peoples decisions, and "best practice"
answers should only ever be given if you are 100% sure it is correct, and
ha
You can't just copy your Python binary around (which is what you'd be doing if
you attempt to copy the virtualenv itself) unless the systems are exactly the
same (and even then I'd be reticent to do so). Why not just download and
compile Python 2.7 to the production server? You can install tha
Thank you
On Feb 21, 3:51 pm, Bill Freeman wrote:
> Use % escapes in your SQL, but instead of using the % operator to do
> the substitution, pass the tuple of values as a second parameter to
> cursor execute. If you tell the db back end that this is a string, by using
> %s, then in will quote it
Use % escapes in your SQL, but instead of using the % operator to do
the substitution, pass the tuple of values as a second parameter to
cursor execute. If you tell the db back end that this is a string, by using
%s, then in will quote it properly so that it won't be interpreted as SQL,
so that an
I use extended UserProfile. Now I want to make a profile edition. I need to
place all my custom profile fields and email, firstname, lastname from
original User model.
I try to do this, but can't make it work. Email field is not shown. None of
the User model are shown.
My forms:
class MainUser
On Mon, Feb 21, 2011 at 3:08 PM, yolabingo wrote:
> On Feb 20, 9:16 pm, ravi krishna wrote:
>> Can we use SimpleDB like sqlite or mysql with Django?
>
> Not at this time.
This is a potentially misleading oversimplification.
Yes, you can use SimpleDB with Django. SimpleDB has Python bindings,
an
On Mon, Feb 21, 2011 at 5:18 AM, Ash wrote:
> Hi , I am new to Python and Django.
>
> Can some please let me know -
>
> 1) can I use Django framework for my existing Python application.
> 2) or do I need to write the whole application again,
> 3) If I can use , can someone tell me how to proceed?
El dom, 20-02-2011 a las 21:18 -0800, Ash escribió:
> Hi , I am new to Python and Django.
>
> Can some please let me know -
>
First of all, when you write a mail to a mailing list, you should put a
more descriptive subject (almost everyone who writes here is requiring
help).
> 1) can I use Djan
On Feb 20, 9:16 pm, ravi krishna wrote:
> Can we use SimpleDB like sqlite or mysql with Django?
Not at this time.
> What are the process involved in doing it ?
Check out this project under development:
http://www.allbuttonspressed.com/projects/django-nonrel
--
You received this message becau
Hi , I am new to Python and Django.
Can some please let me know -
1) can I use Django framework for my existing Python application.
2) or do I need to write the whole application again,
3) If I can use , can someone tell me how to proceed?
--
You received this message because you are subscribed
Hi all,
just i want to pass the request object to my form for
doing some dynamic operation even i am using formset
This is my form:
class PostJobForm(forms.ModelForm):
""" Post Job Form """
def __init__(self, *args, **kwargs):
request = kwargs.pop('request')
I need to construct a long SQL request to my database, but I'm not
sure how can I escape parameters correctly
How can I explicitly escape parameters in SQL like cursor.execute()
does?
Can you also give me an example what exactly this escaping have to do,
so I can test it?
Is there any difference
Hi,
i have a Django project in a virtualdev.
Because it was developed before Debian squeeze, i wanted a recent version of
python
and compiled my own 2.7 version, then installed that in my virtual dev.
Now for deploying to the production server, i had following scenario in mind:
- install progra
51 matches
Mail list logo