I need to develop an app that runs side by side with a django-app.
This will be the first time i develop a multithreaded app that runs next to a django-app so are there any 'gotchas' and 'traps' i should be aware of?
...
In django-mptt full_tree_for_model returns full tree and using drilldown_tree_for_node I can get tree without siblings.
How to include siblings?
lets say i have:
a1
-b1
--c1
-b2
-b3
--c3
I want to generate from a1 node:
a1
-b1
-b2
-b3
from b1:
a1
-b1
--c1
-b2
-b3
from b2:
a1
-b1
-b2
-b3
and so on...
...
I have few uploads in this app, uploading csv files is working fine.
I have a model that has zip upload in it. Zip file is uploaded, can be viewed, but having issues extracting it.
class Message(models.Model):
uploadFile = models.FileField(_('images file (.zip)'),
upload_to='message/',
...
I can't running Unit Test with formset.
I try to do a test:
class NewClientTestCase(TestCase):
def setUp(self):
self.c = Client()
def test_0_create_individual_with_same_adress(self):
post_data = {
'ctype': User.CONTACT_INDIVIDUAL,
'username': 'dupond.f',
'email': '...
I'm writing a Game Website, where the draw is a series of four digits. e.g 1234
I"m trying to write a query in django that will select all winners based on the four digits entered. winners are any combination of the same numbers or the same combination, 1 2 3 4, 2 3 1 4, 4 1 3 2 are all winners.
how is the most efficient way to write ...
I'm working on a new Django project, and the client wants to "feature" content on the homepage and a few other sections of the website. Content in this case could be a blog post, an event, a news story, etc. Each item would have a "start featuring" datetime and an "stop featuring" datetime.
I've done this a few different ways in the pa...
In my view I create a formset of photos belonging to a specific article, this works brilliantly, and I am able to render and process the forms. However for the image field I would like to display the already uploaded image. Normally I would access the path through the instance form.instance.image.get_thumbnail_url however that doesn't wo...
In my web application I send emails occasionally using a reusable mailer application like this:
user - self.user
subject = ("My subject")
from = "[email protected]"
message = render_to_string("welcomeEmail/welcome.eml", {
"user" : user,
})
send_mail(subject, message, from, [email], priority="high" )
I wa...
I have Django running in Apache via mod_wsgi. I believe Django is caching my pages server-side, which is causing some of the functionality to not work correctly.
I have a countdown timer that works by getting the current server time, determining the remaining countdown time, and outputting that number to the HTML template. A javascript...
I have the following models:
class City(models.Model):
name = models.CharField(max_length=100)
class Pizza(models.Model):
name = models.CharField(max_length=100)
cities = models.ManyToManyField('City')
class Price(models.Model):
cad = models.DecimalField()
usd = models.DecimalField()
pizza = models.ForeignKey(P...
There must be a problem with super(InviteManager, self).get_query_set() here but I don't know what to use. When I look through the RelatedManager of a user instance,
len(Invite.objects.by_email()) == len(user.invite_set.by_email())
Even if the user does not have any invites. However, user.invite_set.all() correctly returns all of th...
Hello,
I'm loading a json string in Django using simplejson
obj = json.loads('{"name": "joe"}')
person = obj.name
this throws an error: 'dict' object has no attribute 'name'
but when I pass 'obj' down to the view template and print it out via {{ obj.name }} it works!
Why??
Many thanks,
g
...
I added following command to Sessions -> Startup program but it didn't work. I'm using Ubuntu.
sudo -u www-data python manage.py 192.168.1.2:8001
192.168.1.2 is the ip address on ath0. Is it still not available for binding at the stage when this command is executed?
What I currently do is add another cronjob to restart the developmen...
In Django I am using two applications:
python manage.py startapp books
python manage.py startapp contacts
Still I am only using the books application models. So I am using DATABASE_NAME like:
DATABASE_NAME = 'C:/WorkBase/Python/first/books/book.db'
Now I want to use the second one contacts application models. How can I add cont...
I am trying to do a PhoneField that convert the value as a standardized value.
In this case, I want to use this clean method.
def clean(self):
phone = self.cleaned_data.get('phone')
# Is it already standardized ?
if phone.startswith('+'):
mo = re.search(r'^\+\d{2,3}\.\d{9,11}$', phone)
if not mo:
raise...
The default choice field display of a reference property in appengine returns the choices
as the string representation of the entire object. What is the best method to override this behaviour? I tried to override str() in the referenced class. But it does not work.
...
I am using both Zend framework and Django, and they both have they strengths and weakness, but they are both good framworks in their own way.
I do want to create a highly modular web application, like this example:
modules:
Admin
cms
articles
sections
...
...
...
I also want all modules to be self contained with all confid...
hello
I want to generate a list using my django model
say I have these model:
class AlarmServer(models.Model):
ip = models.IPAddressField()
and such a list
server_ips = [i.ipfor i in AlarmServer.objects.all()]
Doesn't seem to work, what am I doing wrong?
...
I'm developing a Django site. I'm making all my changes on the live server, just because it's easier that way. The problem is, every now and then it seems to like to cache one of the *.py files I'm working on. Sometimes if I hit refresh a lot, it will switch back and forth between an older version of the page, and a newer version.
My se...
How to make all forms in django formset required? I tried to validate presence of all fields in cleaned_data overriding formset's clean() method but it just fails silently without any error displayed.
Thanks!
Source code:
class BaseScheduleForm(forms.ModelForm):
def __init__(self, *args, **kwargs):
super(BaseScheduleForm,...