Is there a way to make this the default at the project level?
I see a number of tricks out there for making it easier to do within
your own views, but I'm using an auth check in django-navbar, so I
need the full context on every page, and not all reusable apps I'm
using are passing the
this is my form+formset and the validation/error display works for both
at the same time.
maybe you can get yours working by comparing it
def myform(request):
idea_form = ProjectideaForm
activity_formset = inlineformset_factory(Projectidea, Activity,
extra=5)
if
hi all,I have solve the problem ,I custom a Storage class and assign it to
the ImageField , then OK!
On Fri, Dec 11, 2009 at 3:16 PM, Xia Kai(夏恺) wrote:
> Hope this link would be of use to you:
>
>
>
Hope this link would be of use to you:
http://docs.djangoproject.com/en/dev/topics/db/models/#overriding-predefined-model-methods
Xia Kai(夏恺)
xia...@gmail.com
http://blog.xiaket.org
--
From: "PanFei"
Sent: Friday, December 11,
Ps : I use the model in django admin .
On Dec 11, 3:02 pm, PanFei wrote:
> Hi all, I have a model that use ImageField , now i want to delete a
> recorder from the database,but after call delete() my the file is also
> deleted ! i think i should override some method ,but where
Hi all, I have a model that use ImageField , now i want to delete a
recorder from the database,but after call delete() my the file is also
deleted ! i think i should override some method ,but where it
is ,looking forward for you reply ,thank you .
--
You received this message because you are
Hi group,
Is there any break statement in Django template like one in java to
break for loop as an element if found .
{% for enqhasparent in enqhasparentobjs %}
{% ifequal enobj.id enqhasparent.enquiry.id %}
{{enobj.student_name|capfirst}}
{%
Hey Daniel,
First of all thanks a lot for your response. You understood it right
that i just want to split up the columns by the blog id so the
defintion of blogs_one and blogs_two was really helpful, thanks. So in
the shell i found out the blogs_x sort the posts. But unfortunately i
can't get it
Is is possible to change the uploaded filename like:
request.FILES['file']['filename']=current.user.username+'_'+str(
current.user.id)
It says 'InMemoryUploadedFile' object does not support item assignment.
Anyway to override this?
Thanks.
--
You received this message because you are
Hi,
I'm using Django 1.1.1 with the ssl redirect middleware.
Sessions data (authentication etc.) created via HTTPS are not
available in the HTTP portions of the site.
What is the best way to make it available without having to make the
entire site HTTPS?
--
You received this message because
Hi All
I'm stuck with a seemingly simple problem. I have MyInline inherited
from GenericStackedInline that I use in several other ModelAdmins. In
some of these ModelAdmins I want to have MyInline.max_num=1 in others
I need MyInline.max_num=3.
Apparently binding locally to the class MyInline does
same problem with paramiko,i tried paramiko first in fact.
success login and execute commands with paramiko,but got http response
code 499,when got host key invalid with commands.
both success in django shell when fail to get http response in view.
On Dec 10, 5:47 pm, Tom Evans
Hi there,
I am playing around with Django's sitemap app and I have a question.
When I pass a normal query in a sitemap class like Shop.objects.all()
everything works fine. My problem begins when I try to publish a model
with a many to many field in it.
When I test this code below in the Python
> render_to_response('foo.html', {'form' : form'})
Forgot to add: the form instance in this case will be bound to the
submitted data and will contain the appropriate errors.
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this
First of all, any reason why you're using different views and not the
same view?
Second, yes it's possible to do what you're trying to do. Try this:
if form.is_valid():
# do something and redirect
else:
render_to_response('foo.html', {'form' : form'})
--
You received this message because
On Dec 10, 10:01 pm, edward9 wrote:
> Ok. Probably that its. But where can i found proper configuration for
> apache?
What do you mean by proper configuration? That is how Apache/
mod_python works, you can't readily change that behaviour.
If you want your Django instance
This worked fine before but now I get the error
C:\...\Django\sw2\wkw2>csv2json.py csvtest1.csv wkw2.Lawyer
Converting C:\...\Django\sw2\wkw2csvtest1.csv from CSV to JSON as C:...
\Django\sw2\wkw2csvtest1.csv.json
Traceback (most recent call last):
File "C:\...\Django\sw2\wkw2\csv2json.py",
> python manage.py test --xml
just a note; django-test-extensions broke --verbosity. Google
Codesearch sez the fix is in there, but pip didn't have it. I'm now
patching this up internally.
other than that the package works great!
Oh, except the assertions need embellished diagnostics...
--
I got advice from someone in the IRC channel to do this:
from django.contrib.sites.models import Site
def __unicode__(self):
return self.name
Site.__unicode__ = __unicode__
And it worked.
On Dec 9, 6:02 pm, bfrederi wrote:
> In one of my models, I have a foreign
I tried to convert my csv file with csv2json.py and it worked before
(see this thread
http://groups.google.com/group/django-users/browse_frm/thread/a00b529ba2147d91/efb82ba2893cc0a7?lnk=gst=csv#efb82ba2893cc0a7)
but now I am trying the same exact thing in a different directory and
I get this
hi,
when submitting my form using jQuery form plugin, the request received
by the target view is different than that received when the form is
submitted in the standard way (with no javascript), and my Django
template does not render as expected. When submitted in the standard
way, the template
I have a page with a form on it, and I want to use a separate view
function to handle the form submission and redirect to the page view.
So, the form's action would be "action="{% url views.handleform %}".
This works fine when the form has no errors; it just needs a simple
HttpRedirectResponse.
Thanks, I'll try it now. What does
os.environ['DJANGO_SETTINGS_MODULE'] = 'myproject.settings'
do? I read the documentation here http://docs.python.org/library/os.html
but I didn't understand.
My app is in
C:.../Documents/PROJECTS/Django/sw2/wkw2.
Do I enter?
I've got data that looks like this from a query
{'status': u'E', 'env__count': 15, 'env': u'dev'}
{'status': u'H', 'env__count': 31, 'env': u'dev'}
{'status': u'I', 'env__count': 164, 'env': u'dev'}
{'status': u'N', 'env__count': 149, 'env': u'dev'}
{'status': u'I', 'env__count': 17, 'env':
You could also use OpenOffice with the SQLIte connector (I think)
I use Access in Windows, works great!
But you might try getting the CSV into a JSON format that the
manage.py loaddata command could use, that set's you up for the future
too.
J
On Dec 10, 8:57 am, Zeynel
I'm afraid this isn't the case for me. My sessions (if these setting does
what they're supposed to) are stored in memcached
CACHE_BACKEND = 'memcached://127.0.0.1:11211/'
SESSION_ENGINE = "django.contrib.sessions.backends.cache"
And memcached is running (there are other sites on the server).
But
Thanks, for the advice. I am checking it out.To clarify, my table
names have changed when I realize styling erros have been
incorporated, (ie. capitalization errors, etc). I wouldn't expect
the table names to change in the operational db.
Thanks again.
Guy
On Dec 10, 12:32 pm, Shawn
Sure, here's a quick & dirty sample I put up on pastebin:
http://pastebin.com/f651cf8de
--
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
Thanks. I couldn't make the sqlite3 shell work on windows command
prompt, so I cannot use .import.
> read the csv with csv.DictReader, then create instances of my model
> with the values from the resulting dictionary, then calling a .save() on
> the new instance.
Do you have more detailed
On Dec 9, 4:25 pm, Russell Keith-Magee wrote:
> > In general, Django "encourages" screwing with the Admin, then
> > extruding sample records, while RoR "encourages" writing very terse,
> > very templated YAML files as test code source.
>
> What rubbish.
Just a netiquette
The current best tool for this is South: http://south.aeracode.org/
You can do complicated data and database migrations smoothly, with the ability
to roll-back changes.
I don't know why you mention changing table names, since that should never be
necessary. But anything is possible.
If you're
What is the "best practice" for editing table names or attributes
after they have been established by manage.py syncdb?
Since I am in the very early stages, I either delete the database and
create a new one with syncdb, or manually change the table names (I
generally use the SQLite manager
Alexander Dutton wrote:
>
> The alternative would be to stick an Alias in your apache conf (assuming
> you're using apache) to serve the files directly from the filesystem.
> This solution wouldn't let you perform any authorisation, though.
>
N.B. There is nowadays the X-SendFile thing, should
There are different ways to do it, depending on how much data you have and how
often you plan to do it.
The fastest way for large files is to use sqlite3's .import command to directly
import a file. However, this will bypass any validation done by your models.
The way I do it is to read the
I'm building a library system and have models Member, Loan and
LoanItem (relationships as you'd expect), and an inline formset to
enter a new loan (Loan and LoanItems).
A member can borrow up to 6 books at a time, so my form contains 7
individual forms (1 loan and 6 loan items), I need to get the
On Dec 10, 4:45 pm, Mark Freeman wrote:
> I have recently created a python module which parses an input string
> and invokes the program lilypond to generate a music score image. All
> of this works fine as a standalone python app. I'm now looking to add
> this to my
Hi Mark
On 10/12/09 16:45, Mark Freeman wrote:
> I have recently created a python module which parses an input string
> and invokes the program lilypond to generate a music score image. All
> of this works fine as a standalone python app. I'm now looking to add
> this to my django site so users
Can anyone point me in the right place in documentation for populating
my sqlite3 tables with the data in the .csv file? 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-us...@googlegroups.com.
I have recently created a python module which parses an input string
and invokes the program lilypond to generate a music score image. All
of this works fine as a standalone python app. I'm now looking to add
this to my django site so users can enter the text on a form, hit
submit, and have the
Hi,
I am trying to figure out the best way to do this.
I have built a django application where users are members in projects.
Thus, i need to assign users different permission sets that correspond
to different projects. The django core permission system cannot solve
this by itself. I took a look
Awesome thanks... But then that removes the need for a Category... :
( The projects have to be linked to the Specs which are only linked to
the Category of the Project.
class ProjectSpecs(models.Models):
Project=models.ForeignKey(Project)
Specs=models.ForeignKey(Specs, ##Limit by Category
It sounds like you just need a ProjectSpecs Table:
class ProjectSpecs(models.Models):
Project=models.ForeignKey(Project)
Specs=models.ForeignKey(Specs)
Values=models.CharField(max_length=200)
That would let you assign as many specs to a project that you want,
with additional fields
By the way this is what the three models roughly look like.
Class Projects(model.Models):
title = models.CharField(max_length=200)
category = models.ForeignKey(Category)
Class Category(model.Models):
title = models.CharField(max_length=200)
specs =
Thank you DR for your response.
Yes that helps in a way, as that is what I am planning to do. But at
the moment I can store the name of Projects, Categories and Specs in
the three different models. Where can I store the values for the Specs
for each Project? There is no table that contains that
On 28 nov, 03:45, Rodrigo Cea wrote:
> I have a parent Class "ComponentBase", with abstract=False, that many
> other classes extend.
Same problem here, and I found these two snippets:
http://www.djangosnippets.org/snippets/1037/
http://www.djangosnippets.org/snippets/1034/
On Dec 10, 3:19 pm, Superman wrote:
> Hi guys, I can't wrap my head around this problem I have... someone
> please help.
>
> The Problem: I have a list of various projects, in a Project Model.
> Each of them has a foreign Key to a Category model. Each Category has
> a Many
Can you not create another Field in SubForm 1 model? Like so:
class SubForm1(models.Model):
def __unicode__(self):
return "SubForm1"
Form1 = models.ForeignKey(Form1)
Form2 = models.ForeignKey(Form2)
## some fields here
On Dec 10, 8:53 am, Shai wrote:
> Hi all,
>
Hi guys, I can't wrap my head around this problem I have... someone
please help.
The Problem: I have a list of various projects, in a Project Model.
Each of them has a foreign Key to a Category model. Each Category has
a Many to Many Relationship to a Specification model. So it is like
this.
Hi,
you might take a look at this snippet:
http://www.djangosnippets.org/snippets/950/
Basically it's a negative of what you want (i.e. w/o subclasses) but
the idea I guess is there: you want a custom DB manager for which
SuperClass.objects returns in fact the SubClass instances. I bet there
are
On Dec 10, 4:57 am, Oli Warner wrote:
> A couple of days ago I moved a site from one server to another server and
> changed the DNS on the domain so it stayed the same. After the DNS had
> migrated everybody but me could log in. All other users trying to log into
> the admin
and i solved it in the view. dont know if this is the right way but it
works:
def topic_detail(request, slug):
topic = get_object_or_404(Topic, slug=slug)
t = topic.project_set.all()
techlist = []
for p in t:
for t in p.technologies.all():
if t in techlist:
On Thu, Dec 10, 2009 at 7:10 AM, Baurzhan Ismagulov wrote:
> When I try this, I get NoReverseMatch at /apps/: Reverse for 'app-list'
> with arguments '()' and keyword arguments '{}' not found.
>
> I'd like to avoid hard-coding URLs. Is there a way to do that?
the problem is
Hi all,
I'm not sure my title is correct. Here Is my problem: I want to use
the django admin for data entry into some models. The models are based
on actual paper forms. There are several forms. and they share some
fields. I would like to follow the principle of DRY when creating this
app. As an
Hello,
Can I use reverse() in urlpatterns, similar to the following?
urlpatterns = patterns('',
...
(r'^apps/$', list_detail.object_list,
{'queryset': App.objects.all()},
'app-list'),
(r'^app/new/$': create_update.create_object,
{'model': App, 'post_save_redirect':
bruno desthuilliers wrote:
> First point, you have a tree structure. There are a couple ways to
> handle trees in a relational model, each has pros and cons. The most
> obvious one is the recursive relationship (also known as 'adjacency
> list'):
>
> create table Person(
>id integer primary
for my needs i will patch django/db/backends/mysql/validation.py
producing my own locally used django rpm to allow more than 255. in my
configuration this works fine. thanks all for your time and guidance!
--
You received this message because you are subscribed to the Google Groups
"Django
Hi Alexander,
I wanna to ask you how do you configure django debian postgres apache and
psycopg2
i try it but i could not have i wanan to run it on apache with svn .
Thanks
- Mail Original -
De: "Alexander Dutton"
À: django-users@googlegroups.com
Envoyé: Jeudi 10
Hi all,
As of last Thursday we've been seeing ~100% CPU usage from Apache, which
we believe was caused by Debian Bug #528529[0], whereby psycopg2 was
attempting to double free pointers, resulting in segfaults. This was
then (we think) leaving database connections open, resulting in postgres
but another error appeared in base.py :(
Caught an exception while rendering: Traceback (most recent call
last):
File "/Users/iM1/jython2.5.1/Lib/site-packages/doj/backends/zxjdbc/
sqlite3/base.py", line 143, in xFunc
assert self.args() == num_args
AttributeError: 'func' object has no
I found the bug ...
http://code.google.com/p/django-jython/source/detail?r=147
On 10. Dec., 12:38 h., gentlestone wrote:
> Does anyone using Django 1.1 and Jython?
>
> File "/Users/iM1/Downloads/django-jython-1.0.0/doj/backends/zxjdbc/
> sqlite3/base.py", line 106, in
Does anyone using Django 1.1 and Jython?
File "/Users/iM1/Downloads/django-jython-1.0.0/doj/backends/zxjdbc/
sqlite3/base.py", line 106, in __init__
self.client = DatabaseClient()
TypeError: __init__() takes exactly 2 arguments (1 given)
After a real nightmare installation procedure I
ok im still stucking on this one:
i dont think the regroup tag can help in this case
but i cant understand how i can query the technologies used within a
specific topic.
i mean i have alredy the projects assigned to this topic, now i need the
technologies used by this projects.
any ideas?
On Wed, 9 Dec 2009 21:58:39 -0500
Karen Tracey wrote:
> On Wed, Dec 9, 2009 at 8:24 PM, Kenny Meyer
> wrote:
>
> >
> > /urls.py[shortened]:
> > urlpatterns = patterns('',
> >(r'', include('posts.urls')),
> >(r'^comments/$',
Ok. Probably that its. But where can i found proper configuration for
apache?
Or can U help me by pasting samples Apache configuration? I have read
some tutorials about configuration Django with Apache and mod_python
but nothing works :(
And about quotas i think this is not it. Code without
A couple of days ago I moved a site from one server to another server and
changed the DNS on the domain so it stayed the same. After the DNS had
migrated everybody but me could log in. All other users trying to log into
the admin were getting the "Looks like your browser isn't configured to
accept
El Wed, 9 Dec 2009 21:23:20 -0600
Kenneth McDonald escribió:
> Where would one find such beasties? Once I've taught myself Django,
> I'd like to think I might be able to get some sort of job with it,
> albeit a very junior one.
If you're an experienced
On Thu, Dec 10, 2009 at 5:23 PM, Mikhail Korobov wrote:
> Performance monitoring doesn't have to be related to django itself.
> There are external projects that cant do performance monitoring (CPU,
> i/o, memory usage over time). You may give munin (http://
>
On Thu, Dec 10, 2009 at 9:36 AM, victor wrote:
> i need to execute remote commands through ssh in views,following is my
> code:
> @login_required
> def reposCheck(request):
> if request.method == 'POST':
> from commands import getoutput
> rs = getoutput('ssh
Not sure about your first error, but you are getting this second error
because you forgot to put quotes around main_page in your urls.py
On Dec 10, 12:28 am, edward9 wrote:
> Yes. I restart Apache every configuration change.
>
> Error from text box:
> Environment:
>
>
i need to execute remote commands through ssh in views,following is my
code:
@login_required
def reposCheck(request):
if request.method == 'POST':
from commands import getoutput
rs = getoutput('ssh t...@192.168.1.2 "[ -d /home/shing3d/
shin/ ] && echo 1 || echo 0"')
Firstly, we have simple template.
---
{% load pagination_tags %}
{% block first_column %}
{% autopaginate object_list %}
{% paginate %}
{% endblock %}
---
Suppose, we have "second_column", so how do I get the current page
number, number of all pages paginated, or even
You do understand that when running under Apache that the code runs as
a special Apache user.
So, not only would the home directory not even be that for your home
account, Apache scrubs the HOME user environment variable from the
process environment anyway, and so trying to access HOME variable
Chris: Sure, there's that possibility – however, I think it would be
very bad practise to insert a redundant field like this, just for
formatting matters. Also, one might want the option of using localised
units, etc.
Shawn: Of course you are generally correct and I know that the core
developers
73 matches
Mail list logo