Hi,
I want to place the project hierarchy in this way
project
|-app
| \app1
| |-templates
| \app1_templ.html
| |- views.py
| \-models.py
|-templates
| \main.html
|-views.py
|-models.py
...
But in the main.html i want to use `{%include app1_templ.html%}. Assuming the views.py from the app1:
def...
I've searched several threads and bug reports, but couldn't find a solution.
I changed the locale of my Django project to pt-br but it made no difference. I excepted all input fields and outputs to localize dates and numbers, specially DECIMAL_SEPARATOR and THOUSAND_SEPARATOR, including in the admin API. But the dates there continue to ...
I am having a few problems setting up Django Piston. I have managed to get as far as generating authentication via the oauth_client.py sample shown here (http://github.com/clemesha/django-piston-oauth-example). When I run "python oauth_client.py" i am taken to http://localhost:8000/api/oauth/authorize/?oauth_token=8wm33jeWR92BpsrHjs wher...
I'm tyring to use this snippet as my event calendar. Unfortunately it constantly raises new errors. Currently I get:
TemplateSyntaxError at /event/while-rendering-nothing-repeat/
Caught an exception while rendering: 'NoneType' object has no attribute 'date'
I'm pretty sure it comes from the line :
if day >= event.date.date() and day...
I have a from based on ModelForm and use formset_factory to create a formset based on two dictionaries. There is also one extra form.
In my view, I use the formset JS plugin and I delete the two forms with data. When I POST the remaining empty extra form, it fails validation because of a required field.
I don't understand why that form...
I have the following code in a view:
def controller_details(request, object_id):
controller = Controller.objects.get(pk=object_id)
controllerURI = controller.protocol + '://' + controller.server + '/' + controller.name
FilterFormSet = inlineformset_factory(Controller, Filter, extra=2)
if request.method == 'POST':
...
I like mongodb and django,and there are some frameworks to select:
mongodbengine
django-mongodb-engine
Mongodbengine has good performance and django ORM like api,but when serialize ,it's not supported now.
Django-mongodb-engine is a django backend,you can use it with django ORM.
So django-mongodb-engine is better? and how about its...
I have a foreign key reference which shows up as a select box on the client but it is pre-populated with values. I want the select box to be empty when it shows because it will be populated by an Ajax call.
This is my model
class RecipeIngredient(models.Model):
recipe = models.ForeignKey(Recipe)
ingredient = models.ForeignKey(I...
Hi, I'm using django-googlecharts to generate a simple pie chart. Inside the img tag, it works just fine, but if I paste the img src in the location bar of the browser, google returns "Bad Request", "Your client has issued a malformed or illegal request".
I followed the example in the django-googlecharts documentation here:
http://gith...
I tried to access django template variable in html page inline javascript, it works fine.
But if I include js using <script src="..> then it dont work.
Is this limitation or I'm doing something wrong?
I really appreciate your help.
...
Hi, I am trying to set up django shared hosting at iPage.com using FastCGI but I keep running into issue. The CGI script lods in the browser as text instead of executing. Below is the .htaccess and the fcgi script
.htacess
AddHandler fastcgi-script .fcgi
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ cgi-bin/my...
models.py
class Subject(models.Model):
code = models.CharField(max_length = 31)
name = models.CharField(max_length = 31)
credit = models.CharField(max_length = 31)
def __unicode__(self):
return str(self.code) + "-"+ str(self.name)
class Student(models.Model):
name = models.CharField(max_length = 31)
...
I'd like to filter objects to the day with datetime, but can't find examples on how to do this anywhere.
This, for example, works perfectly in pulling together all following events:
@login_required
def invoice_picker(request):
"""Grab a date from the URL and show all the invoicable deliveries for that day."""
query = request.GE...
class Blog(models.Model):
name = models.CharField()
def get_posts_belonging_to_this_blog_instance(self):
return Post.objects.filter(blog__exact=self.id)
class Category(models.Model):
name = models.CharField()
def get_posts_with_this_category(self):
return Post.objects.filter(category__exact=self.id)
class Post(models.Model):
...
Lets say I have this model
class Egg(models.Model):
file = FileField(upload_to='media')
img = ImageField(upload_to='media')
How to get an Egg instance if I only have the file URL string like 'http://example.com/media/spam.tar.gz'? Can I query by this URL??
...
Is it possible to check how many rows were deleted by a query?
queryset = MyModel.object.filter(foo=bar)
queryset.delete()
deleted = ...
Or should I use transactions for that?
@transaction.commit_on_success
def delete_some_rows():
queryset = MyModel.object.filter(foo=bar)
deleted = queryset.count()
queryset.delete()
PHP...
Hi,
I have followed a number of tutorials and examples on the web to setup and use django piston. They all work flawlessly, until i try to integrate oauth authentication. I have been working against the following examples:
http://blog.carduner.net/2010/01/26/django-piston-and-oauth/
http://github.com/clemesha/django-piston-oauth-exampl...
I want to use the remote_api to update the GAE bigtable (which can do save on many objects at once). However the model is created in Django and I don't have the bigtable model. Is there something like sqlall that produce the GAE model classes from Django non-rel?
...
I am thinking of "rolling my own" Affiliate marketing system - using either PHP (or more preferably, Python). I am relatively new to Affiliate marketing, so before I get started though I wanted to make sure that I had covered all bases, and was also not reinventing the wheel (in terms of there being a good open source [Python based] syst...
Hi,
I have a form MyForm which I update using ajax as the user fills it out. I have a view method which updates the form by constructing a MyForm from request.POST and feeding it back.
def update_form(request):
if request.method == 'POST':
dict = {}
dict['form'] = MyForm(request.POST).as_p()
return HttpResp...