Akash Deshpande

1

votes
1

answer
181

views

Django form cleaned data “too many values to unpack” error

I have a very simple login form : class LoginForm(forms.Form): username = forms.CharField(max_length=100,required = True) password = forms.CharField(widget = forms.PasswordInput(),max_length=100,required = True) I am using it following way in the views : def login(request): msg = [] form = LoginFor...
Akash Deshpande
1

votes
1

answer
426

views

What is the best way to implement one to many image field

I have multiple models 'Foo,Foo1,Foo2'. I want to add multiple images to each of them. What is the best way to implement one to many image field here ? class Foo(models.Model) images = models.OneToManyField('Image',null=True,blank=True) class Foo1(models.Model) images = models.OneToManyField('Image'...
Akash Deshpande
1

votes
1

answer
449

views

How to send multiple messages to mandrill

I have around 1000 unique mails with unique content. I want to bulk send them to mandril i.e. I dont want to make individual network calls for every message I am sending. The following document shows the api. But it does not define what I want to. https://mandrillapp.com/api/docs/messages.python.ht...
Akash Deshpande
1

votes
1

answer
198

views

How to create a patch/update (i.e. update an object) request in Django test client?

I am using Django 1.5. and django-tastypie I am testing a use case where, first I have to create an object and then update that object via rest api. e.g. class FooTest(TestCase): fixtures = ['df_fixtures1.json'] def setUp(self): print 'SETTING UP?' def tearDown(self): print 'Tear Down' def test_foo...
Akash Deshpande
1

votes
1

answer
354

views

How to Scale images in Django

Background: I have to upload images from users. Problem: The images need to be re-sized so that I don't end up with huge images on my disk. This re-sizing should happen just after the image is saved. I have checked the following code Django Snippet for image scaling But couldn't use it directly, a...
Akash Deshpande
1

votes
1

answer
737

views

Windows 8:How to use external images in windows 8 Metro app

Context: Hi, I am a complete newbie in windows based development. I am building an app for windows 8. I am using the grid app available in visual studio along with javascript, html-5 and css. Problem: I want to use external images(from my server ) while displaying a list of objects. But the followi...
Akash Deshpande
1

votes
1

answer
1.8k

views

How to play a particular item from media play list?

I am using windows media player in windows forms application. I have 10 media items in my playlist. foo, foo1,foo2,foo3 .... Now my playlist is playing lets say foo1. Now on button click I want to play item foo6. How do I play this ? i.e. how do I change my current playing item too foo6 ? If this is...
Akash Deshpande
1

votes
1

answer
68

views

What is the best way to create select form for multiple object dynamically in Django

I have some objects lets say foo1,foo2,foo3,foo4 .. etc. I want to create a form where I can select any one of these foo objects. I can do this in a few ways. 1) class FooReportForm(forms.Form): foo = forms.CheckboxInput() def __init__(self,*args,**kwargs): foos= kwargs.get('foos') foo_choice = []...
Akash Deshpande
1

votes
1

answer
1.2k

views

How to use django admin many to many field selector widget

I want to use this How can I use it for my many to many modelform. Basically I want the add button, which allows me to add the many to many objects.
Akash Deshpande
1

votes
1

answer
465

views

How to create a pdf from html5 and css3 in Django?

I have a very simple use case. I want to create a pdf from a html file that I have. Problem: I have checked this tool. But it does not work for css3. And gives errors while parsing bootstrap files. xhtml2pdf I am currently checking Prince (giving some issues when I am running it.) Has anyone face...
Akash Deshpande
1

votes
2

answer
796

views

How to access a Django object in jQuery

I have a Ajax function which gets the Django object from a view. I want to access all the attributes of the object in jQuery but I am not able to do so. $.ajax( { url: domain+'/game/android/', type:'POST', success:function(response){ response = jQuery...
Akash Deshpande
1

votes
1

answer
672

views

How to write custom obj_create and obj_update in django tasty pie

I am trying to override obj_create and obj_update in Django tasty pie class HomeTasksResource(ModelResource): class Meta: queryset = HomeTasks.objects.filter(is_deleted = False) resource_name = 'tasks' authorization = Authorization() authentication = MyAuthentication() excludes = [ 'datetime'] allow...
Akash Deshpande
1

votes
2

answer
359

views

How to update apps which are not on google play, i store or windows store

Am making an app for our company. This is a specific app only for internal use. Its size will be around 200 -250 mb. It is a cross platform app (Using phone-gap), i.e., it will be active on windows, android and on apple. Am not putting it on any store, i.e., istore, wondows store or google play. Pro...
Akash Deshpande
1

votes
2

answer
1.3k

views

How to reset the database for a particular app in Django 1.5

What I want is the functionality python manage.py reset myapp What is the equivalent in django 1.5 ? I am using this in development environmenti.e. sqlite (I dont want flush. )
Akash Deshpande
1

votes
1

answer
365

views

Set socket opt failed bad file number exception

Am getting set socket option failed exception in Android. What am I doing wrong ? setsockopt failed: EBADF (Bad file number) For the following code: int timeout = 500; Socket socket = new Socket(InetAddress.getByAddress(new byte[]{10, 0, 2, 2}), Integer.parseInt(m.destPort)); ObjectOutputStream oos...
Akash Deshpande
1

votes
2

answer
568

views

How to to override database settings in a Django TestCase

I am writing test cases for a Django application. I want to use different databases for different test cases. Hence, I want to override the default database settings for a particular test case. e.g. class FooTest(TestCase): fixtures = ['df_fixtures1.json'] def setUp(self): print 'SETTING UP?' def t...
Akash Deshpande
1

votes
2

answer
6.5k

views

How to set max time and min time in c# datetime picker

I am using a datetime picker in c# windows forms application. How to set the the min time and max time ? I have a string '07:52:22' and I want to set this as the max or min time. How can I do this ? DatetimePicker.MinDate.TimeOfDay = '07:52:22'; This is wrong but this is what I want.
Akash Deshpande
18

votes
1

answer
8.4k

views

How to include templates dynamically in Django using “include” tag

I have 10 html files with the names 1.html, 2.html ..etc What I want is according to a variable, a certain file should be included in the template. e.g. {% if foo.paid %} {% include 'foo/customization/{{ foo.id }}.html' %} {% endif %} Is this possible ? Cause the foo.id is not being translated bef...
Akash Deshpande
18

votes
3

answer
6.2k

views

Git conflicted copy error while cloning a repository

I am using dropbox as a git repository. Now due to some issue in the syncing, there is some conflicted copy present in the git. How do I remove this conflict ? Due to this conflict I am unable to clone the contents of that repository. The error I am getting while cloning the repository is:- Git :-...
Akash Deshpande
1

votes
2

answer
2.1k

views

How to delete a windows media playlist programmatically

I am using a C# application where I have to create a playlist. At the end of this application on form close I want to delete this play list which has been created. How do I do this? what I want is WMP.playlistCollection.remove('myplaylist'); This is wrong and does not work. Is there something simil...
Akash Deshpande
5

votes
3

answer
744

views

How to map 2 lists with comparison in python

I have a list of objects of say foos. I have a loop for creating a new list. foo1 = {id:1,location:2} for e.g. foos = [foo1,foo2,foo3] Now I want to create a new list based on location. new_list = [] for foo in foos: if foo.location==2: new_list.append(foo) What I want to know is there any way in...
Akash Deshpande
5

votes
1

answer
8.3k

views

Record a video via a usb WebCam in csharp

I have a simple use case. Where I want to display a usb webcam and record the the live video(Not as screen capture). I have checked these links 1) WebCam 2)Simple Webcam But it does not show how to record a video. Can I extend these to record a video or should I look at some other dll ? Edit: Cu...
Akash Deshpande
5

votes
1

answer
4.8k

views

How to send pdf as an email attachment in Django

Hi I am using the follwoing 2 functions to create and send a pdf via mail on the fly. What Am I doing wrong. (The export pdf function works properly when showing it in the browser.) The error I am getting is 'TypeError: 'ContentFile' object does not support indexing'. What I am doing wrong? Almost a...
Akash Deshpande
5

votes
2

answer
6.9k

views

How to store a (dictionary) object in JavaScript localStorage?

I have a very simple dictionary . var meta = {'foo':'1','moo':'2'} I want to store this in the local storage and retrieve it. window.localStorage.setItem('meta', meta); var meta1 = window.localStorage.getItem('meta'); alert(meta1['foo']); The above does not work. How can I do it?
Akash Deshpande
2

votes
1

answer
2.5k

views

Display facebook user images in PhoneGap (Android)

I have a very simple use case. I have an xhr object of ids of facebook users. Now I just want to display the images of the users in the following way. xhr.objects.forEach(function (user) { $('#userimage').append( '< img src='https://graph.facebook.com/'+user.user_id+'/picture/?type=small'/>'); });...
Akash Deshpande
11

votes
4

answer
12k

views

How to get a model object using model name string in Django

Desciption: I have a generic function def gen(model_name,model_type): objects = model_name.objects.all() for object in objects: object.model_type = Null (Or some activity) object.save() How Can I achieve the above ? Is it possible?
Akash Deshpande
3

votes
1

answer
120

views

Fatal execution error when a file is opened, closed and disposed multiple times in C#

In a thread, a file is being opened, closed and disposed continuosly. Does this cause an issue ? Here is the code StreamWriter file1 = new StreamWriter(filepath4, true); for (int i = 0; i < ChannelValueForTcp; i++) { file1.WriteLine(data[i]); } file1.WriteLine(data[data.Length-1]); file1.WriteLine(...
Akash Deshpande
2

votes
2

answer
263

views

How to prefill the image field on form validation error Django?

I have a simple Django form with Image field and some other fields. Now the user has entered the form field and pressed on submit. Due to some error, the form has not validated. As a result of the form not validated, the form image field is cleared of i.e. the user has to again enter the image fiel...
Akash Deshpande
6

votes
3

answer
5.8k

views

All jQuery mobile events firing twice

I have a very simple use case on my index page. $('body').on('swipeleft', function(event) { alert('hello'); /*window.location.href = 'html/first.html';*/ }); For some reason this event is firing 2 times. Now I am sure I haven't binded another event on the body tag as this is the first...
Akash Deshpande
2

votes
1

answer
5.6k

views

Python ImportError: No module named datetime

Hi am getting an error while trying a simple datetime import. ImportError: No module named datetime I am trying the following code in the git console. >>> from datetime.datetime import strptime I have tried re-installing python and it doesn't seem to work. What am I doing wrong?
Akash Deshpande
5

votes
3

answer
4.5k

views

Phonegap Offline Database (Across all platforms)

I have gone through the Phone Gap Storage. But this is not supported on windows phones. Now I want to create a app which will be truly compatible across all platforms. i.e. windows 8 ,windows 7, windows xp, iOS, Android. Is there a plugin or alternative to sqlite on windows phone? I have found this...
Akash Deshpande
3

votes
3

answer
13k

views

Gstreamer Error: pipeline could not be constructed: no element “v4l2src”

Am using Ubuntu(14.04) and I am getting this error while trying to use gstreamer. gst-launch-1.0 v4l2src ! video/x-raw,width=640,height=480 ! x264enc ! h264parse ! rtph264pay ! udpsink host=127.0.0.1 port=5000 I have checked the gst-inspect-1.0 v4l2src It say element not found 'No such element o...
Akash Deshpande
2

votes
1

answer
332

views

How to connect windows7 Git to dreamhost server Git

I am planning to use Git as SCM tool, the repository I am using is Dreamhost. I'm trying to connect Git from my local machine (Windows 7) to the Git on my dreamhost server. I have installed git version 1.7.6 n both the Dreamhost and my local machine. Note: I have tried the dreamhost docs for git, bu...
Akash Deshpande
7

votes
5

answer
13.2k

views

How to make a form field numeric only in Django

While using Django modelforms I have a Integer field which is numeric only. But in the browser it comes as a text field in which I can enter 'characters'. I want to make this only 'numeric'. How to do this ? i.e. users should be able to enter only numbers. We can do it 1 way by setting the attribut...
Akash Deshpande
3

votes
1

answer
2.7k

views

Curl Post Json data not being read in Python Django

Am using curl exe in windows, to communicate with my Django backend. Following is the command am using. curl --dump-header - -H 'Accept: application/json' -H 'Content-Type: application/json' -X POST --data '{\'uid\':12,\'token\':\'asdert\'}' http://localhost:8000/restapi/v1/foo/ Now this give the da...
Akash Deshpande
2

votes
3

answer
977

views

How to open and detect closing of an exe in c#

I am developing a Windows Forms application in which I need to edit certain config files. Now when the user clicks on the edit option, I want to launch these config files in a simple notepad editor. Once launched I want to stall my application. Only when the user closes the notepad editor, I want to...
Akash Deshpande
2

votes
0

answer
108

views

In django send_mass mail creates a new http connection everytime it sends a mail

I have a use case where I need to send 16000+ users unique mails. To do this I am using mandrill api( djrill). To make it more efficient and optimized I am trying to use send_mass_mail functionality along with celery. While doing so I was checking the celery logs and found that for each email, the...
Akash Deshpande
7

votes
1

answer
576

views

How to add individual objects to django haystack?

I have a search index that I have created using Solr. I want to add individual django objects to the search index. To remove objects from the solr database we use remove_object. some = SomFooModel.objects.get(pk=1) foo = FooIndex() foo.remove_object(some) #This works To add it, is there something...
Akash Deshpande
1

votes
1

answer
1.7k

views

Dynamic select options not validating Django

I have a model Foo. I have a modelform FooForm. In FooForm I am adding a dynamic field 'too'. This is a select field. FooForm(modelform) too = forms.ChoiceField(widget = forms.Select()) class Meta: model = Foo In the template I am adding options dynamically to this 'too field' $('.too').append(''+t...
Akash Deshpande
2

votes
1

answer
2k

views

Axwindows media player dectect keydown in full screen mode

I have ax windows media player in my windows forms application. When the user double clicks on it, it becomes full screen. PROBLEM: I want the user to be able to go back to normal screen when he presses the 'escape key'. I have put a keydown event on the ax media player. This key down event works w...
Akash Deshpande

View additional