How to model this in django:
1) have a base network of manufacturers
2) under each network their might be several distributors
3) a user of the system can access items through the distributor
4) if a user access the item through the distributor we want that item to be translated where each manufacturer will have their own translation...
I am having some issues with django-haystack template usage. Particularly the highlight tag.
below is the line of code that is having the issue.
<h4><a href='/discuss/{{ thread.id }}/{{ thread.title|slugify }}'>{% highlight thread.title with request.GET.q max_length 40 css_class "highlight_title" html_tag "div" %}</a></h4>
I have tr...
Is it possible to use the django ORM to order a queryset by the sum of two different fields?
For example, I have a model that looks like this:
class Component(models.Model):
material_cost = CostField()
labor_cost = CostField()
and I want to do something like this:
component = Component.objects.order_by(F('material_cost') + F...
I have a project in production. Everthing was working fun, but suddenly, I'm getting an error:
Caught NoReverseMatch while rendering: Reverse for 'forum.views.tag' with arguments '(u'',)' and keyword arguments '{}' not found.
I believe this is being called by this line from the template:
href="{% url forum.views.tag tag|urlencode ...
Hello
I have a number of elements that can be of one or more types.
class Type(models.Model):
name = models.CharField(max_length=128, unique=True)
class Element(models.Model):
name = models.CharField(max_length=128, unique=True)
type = models.ManyToManyField('Type')
Let's say that I have 3 types and 3 elements:
In [3]: ...
Hi guys, im want to know if there is any way to make a SlugField unique for Any field different to pub date?
for example i would like a slug unique (city field) for a field called country
any idea?
thanks
...
Hi,
I have a Django app we're attempting to deploy to a Tomcat server, using django-jython.
Just to test things, I've created the WAR archive file for a empty Django app successfully. The test Django application is called "chair".
Our Tomcat server apparently doesn't like WAR archives files, so I exploded (unzipped this), and copied t...
In my view for editing friends I'm checking if form is valid, and then save the form. But somehow the data are not updated. Why my updated form is not saved ? It is 100% valid, since I've checked it earlier.
My form :
class FriendForm(forms.ModelForm):
first_name = forms.CharField(widget=forms.TextInput(attrs=dict(attrs_dict, maxle...
I want to enter to administration application of my site.
on request: http://mysite.ru/admin/ - i get an error:
ImportError at /admin/
No module named admin.site.urls
Request Method: GET
Request URL: http://mysite.ru/admin/
Django Version: 1.2.1
Exception Type: ImportError
Exception Value:
No module named admin.site.urls
Except...
I am trying to implement the photologue django photo gallery here:
http://skam.webfactional.com/blog/2007/08/08/django-based-photo-gallery-tutorial/
I dont understand this part:
You need to have the current user’s info outside requests, have a look at CookBookThreadlocalsAndUser and add the middleware in your “MIDDLEWARE_CLASSES” set...
I have apps Users and Projects and would like to define another app called Roles for extending django-auth for per-project basis.
I defined ProjectMembership in the Roles app as a custom ManyToMany relationship model. But how can I define the M2M field in User or Project model with through declaration?
So question is can we define mode...
I'm building an ecommerce website.
I have a Product model that holds info common to all product types:
class Product(models.Model):
name=models.CharField()
description=models.CharField()
categories = models.ManyToManyField(Category)
Then I have SimpleProduct and BundleProduct that have FK to Product and hold info specific to the...
can we integrate djangobb in django app. means djangobb should use our django application systems auth system instead of its own ??
...
Hello,
I'm new to web development using python. I've good amount of experience in building dynamic websites using PHP. Also, I've never used MVC on PHP. For the first time I'm using MVC (or MTV to be more correct). I'm following
One thing different from PHP world is that. URLs doesn't point to files but to functions. This single point...
Hi !
My problem is simple, I have an url, I would like to resolve it, but get the url name instead of the view function associated with it ...
For example... this is urlconf :
urlpatterns = patterns('',
...
url('^/books/$', book_list, name="overview_books"),
...
)
And this is what I would like :
>>> resolve('/books/')
'overview_...
When one needs to define action parameter of form ? Across different projects I've seen forms with action defined as {% url app.view parameters %} or simply '/contact/' but also with action = "." . When do we need to provide each type of action ?
...
I'm unable to upload a file using django. When I hit submit button I get "This webpage is not available. The webpage at http://127.0.0.1:8000/results might be temporarily down or it may have moved permanently to a new web address." error in chrome.
For the file upload HTTP query the corresponding webserver's log entry is:
[02/Jul/2010 ...
I've create a custom field "Private FileField". I'm not able to get it to work with django-south.
My understanding of South field rules is based on
http://south.aeracode.org/docs/tutorial/part4.html#tutorial-part-4 and
http://south.aeracode.org/docs/customfields.html
Relevant snippets are:
class FileField(models.CharField):
__meta...
Hi all.
I've a django application, served via Twisted, which also serves ohter services (three sockets, mainly).
I need to have it working under windows, and I decide to write a PyQt4 application which acts quite like Apache Service Monitor for windows.
I was not able to connect twisted reactor to pyqt application reactor, so any hint...
Hi All,
I am developing an application in google application engine which would have a user profiles kind of feature. I was going through the Google App's online tutorial where I found that the maximum number of static files (app files and static files) should not exceed 3000. I am afraid whether the user's would be able to upload their...