I trying to restful server that one can upload image, By use django-piston I can put,get,post information restfully but don't know how to upload image.
Hi All, Im new to django and trying to make a user registration form with few validations.
Apart from this I also want a username suggestion code which will tell the user if the username he is trying to register is available or already in use. Then it should give few suggestions that might be available to choose from. Can anyone who might have worked on the same or somewhat same project help me with this.
Thanks
Within Django, can a function local to a model be called on object creation to dynamically fill a field?
class someModel(models.Model):
id = models.FloatField(primary_key=True, default=generate_id())
def generate_id(self):
newId=time.time()
return newId
So far I haven't had any luck with getting it to work or with locating documentation that covers it.
How can I set up Django in Window Xp and Ubuntu OS
I finished the step for connection with Database and some problem with connect to admin..
I do it from reading ebook and do it..So there is any easy steps for me..
Please share all idea.
There is a form ,which is submitted and then the page is redirected to another page.But if the user hits the refresh button again on the new page .the following message is displayed
To display this page, Firefox must send information that will repeat any action (such as a search or order confirmation) that was performed earlier.
And on press "OK"
A duplicate entry is created how do i prevent this or how do i handle this
I am using a django,application
Thanks..
In django models say this model exist in details/models.py
class OccDetails(models.Model):
title = models.CharField(max_length = 255)
occ = models.ForeignKey(Occ)
So when sync db is made the following fields get created
and later to this of two more fields are added and sync db is made the new fields doesnt get created.How is this to be solved,Also what is auto_now=true in the below
these are the new fields
created_date = models.DateTimeField(auto_now_add=True)
modified_date = models.DateTimeField(auto_now_add=True, auto_now=True)
Hi,
I have a XML file that is managed by other programs, I am writing a web service such that users are able to query this file. In essence i am using a xml based database instead of using sql as the model database in Django.
how do i do this? all the tutorials that i find use a sql database in the backend. is there a way to use the xml file as a database.
I am using the delete() function from django.contrib.comments.views.moderation module. The staff-member is allowed to delete ANY comment posts, which is completely fine. However, I would also like to give registered non-staff members the privilege to delete their OWN comment posts, and their OWN only. How can I accomplish this?
In Django, I have SESSION_COOKIE_DOMAIN set to my domain name. But I would actually like to run the same site with two different domain names.
With SESSION_COOKIE_DOMAIN set, only the named domain allows the user to login. Is it possible to allow both domains to login?
In Django there is a settings file that defines the middleware to be run on each request. This middleware setting is global. Is there a way to specify a set of middleware on a per-view basis? I want to have specific urls use a set of middleware different from the global set.
Hi!
I need to implement a "Remember me" button in a login form that uses the django-registration app. Any ane can help me showing me the way for do this?
Thanks
I am working on a Silverlight project that uses Django on the server using piston for the REST API. I understand that Silverlight doesn't support the PUT and DELETE http verbs. Is there another way i can pass these kinds of commands to piston?
Ive defined a a class that inherits from django.contrib.syndication.feeds.Feed
class Rss(Feed):
...
def item_title(self, item):
return "Hello"
def item_description(self, item):
return "Test"
The issue those strings are never used, even when not using a template whats used is the templates you define.
Am I missing something?
Hi,
is there something like getters and setters for django model's fields?
For example, I have a text field in which i need to make a string replace before it get saved (in the admin panel, for both insert and update operations) and make another, different replace each time it is read. Those string replace are dynamic and need to be done at the moment of saving and reading.
As I'm using python 2.5, I cannot use python 2.6 getters / setters.
Any help?
Hello All,
I m not able to change the locale of django -admin when i switch to different locale from browser.But if i mention in my settings.py the language code then it is working but browser locale doesnot have any impact on it
#setting.py
LANGUAGES = (
('ar', gettext_noop('Arabic')),
('ja', gettext_noop('japanese')),
('bg', gettext_noop('Bulgarian')),
LANGUAGE_CODE = ''#
LANGUAGE_COOKIE_NAME = 'django_language'
LOCALE_PATHS = ()
In a django template, I want to get an value from the first object in a list's field.
I have the following code
{{ list.object|first.field }}
But it results in an error.
Is there a way to achieve this without writing a loop or doing it in the view?
Hi Im using Filebrowser for Django and also TinyMCE. I include TinyMCE in my admin text area editor by adding a admin template to folder media in my templates with filename base_site.html
Now when I add a image with filebrowser, tiny_mce adds a leading ../../../../ before /media/uploads/etc/image.jpg
Any ideas why? I guess its some URL thats not set correct. But im not sure if its tiny_mce or filebrowser.
I have a simple django's query set like:
qs = AModel.objects.exclude(state="F").order_by("order")
I'd like to use it as follows:
qs[0:3].update(state='F')
expected = qs[3] # throws error here
But last statement throws:
"Cannot update a query once a slice has been taken."
How can I duplicate the query set?
In Django admin site, when listing all the objects for a given model, I know we can customize which columns get displayed for a ModelA via list_display
Say that ModelA has a one-to-many relationship with ModelB. I would like to add another column on the listing page for ModelA, where each entry is a URL pointing to all objects of ModelB having a foreign key relationship on corresponding instance of Model A in that row. How can I achieve this customization with the admin app?
Using the django admin, I would like to be able to specify which models a user sees when he logs in. For a stretch goal, for each model types a user can see, I would like to specify a filter to limit which instances of the model the user can see.
Could someone please provide a pointer for how to go about achieving this?
I am trying to extend the User model so that I can add my own custom fields but I keep getting an error stating:
'NoneType' object has no attribute '_default_manager'
whenever I try to use
user.get_profile()
to add values to the custom field i.e. whenever I use it like so:
user = User.objects.create_user(username, email, password)
user.first_name = fname
user.last_name = lname
user.save()
uinfo = user.get_profile()
uinfo.timezone = "Asia/Pune"
uinfo.save()
I have already followed the steps given at
http://stackoverflow.com/questions/44109/extending-the-user-model-with-custom-fields-in-django/965883#965883 with no luck.
Every time I create an instance of the TestForm specified below, I have to overwrite the standard id format with auto_id=True. How can this be done once only in the form class instead? Any hints are very welcome.
views.py
from django.forms import ModelForm
from models import Test
class TestForm(ModelForm):
class Meta:
model = Test
def test(request):
form = TestForm(auto_id=True)
Hi all,
I am having an attribute error while working with django-registration it says
'NoneType' object has no attribute 'strip'
I dropped my db table and created again but the error doesnt go..can anyone help..
I'm trying to use ModelAdmin.filter_horizontal and ModelAdmin.filter_vertical for ManyToMany field instead of select multiple box but all I get is:
My model:
class Title(models.Model):
#...
production_companies = models.ManyToManyField(Company, verbose_name="????????-?????????????")
#...
My admin:
class TitleAdmin(admin.ModelAdmin):
prepopulated_fields = {"slug": ("original_name",)}
filter_horizontal = ("production_companies",)
radio_fields = {"state": admin.HORIZONTAL}
#...
The javascripts are loading OK, I really don't get what happens. Django 1.1.1 stable.