Hey,
I am currently writing an application which I plan to sell as SaaS. Without giving away "secrets," I can say that it is basically a "document editing system" in which many users will be submitting documents.
The basic heirarchy is this:
Institution
Individual
Document
Sub-document
So each Individual should be able to BROWSE al...
I have a simple Post model with a m2m field to a Tag model.
The Tag had for some reason to use a non default primary key.
Inside the admin page for a Post, the labels for the multiple selection field for Tags appear, but not the input field itself. I also tried using the filter_horizontal for the tags, but still only the labels appear ...
Hi,
I have a text file being written by another process on a server which I want to watch for changes. Each time a change occurs I'd like to read the new data and send it to client .
Any suggestions will be valuable . Using Django,Python
Tazim.
...
Hello!
I want to enable debug (DEBUG = True) For my Django project only if it runs on localhost. How can I get user IP address inside settings.py? I would like something like this to work:
#Debugging only on localhost
if user_ip = '127.0.0.1':
DEBUG = True
else:
DEBUG = False
How do I put user IP address in user_ip variable ...
models.py
class Head(models.Model):
total_amount=models.DecimalField(max_digits=9,decimal_places=2)
class Items(models.Model):
head = models.ForeignKey(Head)
item_amount=models.DecimalField(max_digits=9,decimal_places=2)
admin.py
class ItemsInline(admin.TabularInline):
model = Items
class HeadAdmin(admin.ModelAdmin:...
Intro
I am working on an e-commerce website. And we want to add a feature where a user can refer others via a custom link e.g.:
http://mysite.com/a1t2312 or http://mysite.com/?ref=a1t2312 (a1t231 being the referral code).
A user following such a link, will navigate a few pages on the site. And if he reached the 'buy' page and purchase...
I have the following models:
class Application(models.Model):
users = models.ManyToManyField(User, through='Permission')
folder = models.ForeignKey(Folder)
class Folder(models.Model):
company = models.ManyToManyField(Compnay)
class UserProfile(models.Model):
user = models.OneToOneField(User, related_name='profile')
company = mode...
def _table_(request,id,has_permissions):
dict = {}
dict.update(get_newdata(request,rid))
return render_to_response('home/_display.html',context_instance=RequestContext(request,{'dict': dict, 'rid' : rid, 'has_permissions' : str(has_permissions)}))
In templates the code is as,
{% if has_permissions == "1" %}
<input type="b...
In models,
class Getdata(models.Model):
title = models.CharField(max_length=255)
state = models.CharField(max_length=2, choices=STATE, default="0")
name = models.ForeignKey(School)
created_by = models.ForeignKey(profile)
def __unicode__(self):
return self.id()
In templates
<form>
<input type="submit" s...
I want to have two custom made app dealing with two different tasks.
i have a page(template) where the data from the both app come together.
how to deploy url for that, in the common urls.py so that the two app work together. how to integrate the views from both app to return data to same template simultaneously. is that possible?
I fou...
I have a model in wich i'm using m2m Django ORM feature, in order to create an aditional table to hold my 'classrom members'.
My problem is: the membership to a classroom must be accepted by the invited one, so i need a boolean field :1=accepted, 0=refused/unseen yet. How can i include this boolean variable in the aditionally generated c...
In case of views that contain login or logout,
this sessionid is different from the one submitted in request's Coockie header.
I need to retrieve it before returning response for some purpose.
How can I do this ?
...
I have a number of currency values in a form select box (i.e. £2,500). When the form is rendered though it keeps the £ as is, is there any way to convert it to an actual pound sign?
...
Hey,
I have got a choiceField in my form, where I display filtered data. To filter the data I need two arguments. The first one is not a problem, because I can take it directly from an object, but the second one is dynamically generated. Here is some code:
class GroupAdd(forms.Form):
def __init__(self, *args, **kwargs):
sel...
Hi,
I'm having strange error with installing fixture from dumped data. I am using psycopg2, and django1.1.1
silver:probsbox oleg$ python manage.py loaddata /Users/oleg/probs.json
Installing json fixture '/Users/oleg/probs' from '/Users/oleg/probs'.
Problem installing fixture '/Users/oleg/probs.json': Traceback (most recent call last):...
In a Django template, how could I refer to the URL. I want to use it in static pages, to avoid having live links to the current page. Is there a way to do this with the Django template language or do I have to use JavaScript to do it?
I would like to do something like
{% if current_url == "/about/" %}
About
{% else %}
<a href='/abou...
I'm working on a Django-based web service and I'm trying to figure out what the best way to do my serialization will be.
The tricky requirement, though, is that I'd like to have pretty much full control over format of, and fields contained in, the response.
For example, the Django serializers (which, unfortunately, includes the wadofst...
In my Django app, I just ran
$ python manage.py sqlall
and I see a lot of SQL statements that look like this, when describing FK relationships:
ALTER TABLE `app1_model1` ADD CONSTRAINT model2_id_refs_id_728de91f FOREIGN KEY (`model2_id`) REFERENCES `app1_model2` (`id`);
Where does "7218de91f" come from? I would like to know becau...
Hi, this is a rather basic question (I'm new to Django) but I'm having trouble using a variable set in my view inside my template. If I initialize a string or list inside my view (i.e. h = "hello") and then attempt to call it inside a template:
{{ h }}
there is neither output nor errors. Similarly, if I try to use a variable inside my ...
Hi, is there a good way to gather the mac addresses of machines on a local network using Python. If it helps I'm trying to execute this python script from the DHCP server for the network. I'm new to Python but would it be a bad idea to look at the DHCP leases file for this info? I'd like to use this inside a Django app eventually. Thank...